File tree Expand file tree Collapse file tree 5 files changed +93
-0
lines changed
Expand file tree Collapse file tree 5 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 3333 - name : Test Wasmtime
3434 run : docker run --rm ${{ env.TAG }} wasmtime --version
3535
36+ build_wasi_container :
37+ name : Build and test (Devcontainer)
38+ strategy :
39+ fail-fast : false
40+ matrix :
41+ os : [ubuntu-latest, ubuntu-24.04-arm]
42+ runs-on : ${{ matrix.os }}
43+ env :
44+ TAG : cpython-devcontainer:1.0.0-${{ github.run_id }}
45+ steps :
46+ - name : Checkout Push to Registry action
47+ uses : actions/checkout@v5
48+ - name : Set up Docker Buildx
49+ uses : docker/setup-buildx-action@v3
50+ - name : Build Dockerfile
51+ uses : docker/build-push-action@v6
52+ with :
53+ context : ./devcontainer
54+ load : true
55+ tags : ${{ env.TAG }}
56+ - name : Test WASI SDK
57+ run : docker run --rm ${{ env.TAG }} /opt/wasi-sdk/bin/clang --version
58+ - name : Test Wasmtime
59+ run : docker run --rm ${{ env.TAG }} wasmtime --version
60+
3661 build_autoconf :
3762 name : Build and test (Autoconf)
3863 strategy :
Original file line number Diff line number Diff line change 1111 options :
1212 - autoconf
1313 - devcontainer
14+ - wasicontainer
1415
1516run-name : " Release: ${{ inputs.package }}"
1617
Original file line number Diff line number Diff line change 1+ FROM ghcr.io/python/devcontainer:latest
2+
3+ LABEL org.opencontainers.image.base.name="ghcr.io/python/devcontainer:latest"
4+ LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcontainers"
5+ LABEL org.opencontainers.image.title="CPython WASI development container"
6+ LABEL org.opencontainers.image.description="CPython development container with the tooling to work on WASI builds."
7+ LABEL org.opencontainers.image.authors="Brett Cannon"
8+
9+ ARG TARGETARCH
10+
11+ # WASI SDK versions are controlled in install-wasi.sh.
12+ ENV WASI_SDK_ROOT=/opt
13+
14+ ENV WASMTIME_VERSION=36.0.2
15+ ENV WASMTIME_HOME=/opt/wasmtime
16+
17+ RUN mkdir -p /opt/cpython-devcontainer/bin
18+ COPY --chmod=755 install-wasi.sh /opt/cpython-devcontainer/bin/
19+
20+ RUN /opt/cpython-devcontainer/bin/install-wasi.sh
Original file line number Diff line number Diff line change 1+ A container for developing CPython for WASI.
2+
3+ It is based on the dev container, and thus includes the same common utilities.
Original file line number Diff line number Diff line change 1+ #! /bin/bash -ex
2+
3+ mkdir --parents ${WASI_SDK_ROOT}
4+
5+ # For 3.11, 3.12.
6+ # There is no Arm support for WASI SDK < 23.
7+ if [ " ${TARGETARCH} " = " amd64" ]; then
8+ URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz
9+ curl --location $URL | tar --directory ${WASI_SDK_ROOT} --extract --gunzip
10+ fi
11+
12+ case " ${TARGETARCH} " in
13+ amd64) WASI_ARCH=" x86_64" ;;
14+ arm64) WASI_ARCH=" arm64" ;;
15+ * ) echo " Unsupported TARGETARCH: ${TARGETARCH} " && exit 1 ;;
16+ esac && \
17+
18+ # 24: 3.13, 3.14
19+ # The URL format only works for WASI SDK >= 23.
20+ WASI_SDK_VERSIONS=(24)
21+ for VERSION in " ${WASI_SDK_VERSIONS[@]} " ; do
22+ URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${VERSION} /wasi-sdk-${VERSION} .0-${WASI_ARCH} -linux.tar.gz
23+ curl --location $URL | tar --directory ${WASI_SDK_ROOT} --extract --gunzip
24+ done
25+
26+ # For Python 3.13 as Tools/wasm/wasi.py expects /opt/wasi-sdk.
27+ ln -s ${WASI_SDK_ROOT} /wasi-sdk-24.0* / /opt/wasi-sdk
28+
29+
30+ mkdir --parents ${WASMTIME_HOME}
31+
32+ case " ${TARGETARCH} " in
33+ amd64) WASMTIME_ARCH=" x86_64" ;;
34+ arm64) WASMTIME_ARCH=" aarch64" ;;
35+ * ) echo " Unsupported TARGETARCH: ${TARGETARCH} " && exit 1 ;;
36+ esac
37+
38+ URL=" https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION} /wasmtime-v${WASMTIME_VERSION} -${WASMTIME_ARCH} -linux.tar.xz"
39+
40+ curl --location $URL |
41+ xz --decompress |
42+ tar --strip-components 1 --directory ${WASMTIME_HOME} -x
43+
44+ ln -s ${WASMTIME_HOME} /usr/local/bin
You can’t perform that action at this time.
0 commit comments