File tree Expand file tree Collapse file tree 5 files changed +96
-2
lines changed Expand file tree Collapse file tree 5 files changed +96
-2
lines changed Original file line number Diff line number Diff line change 1919 # Dummy tag; version does not matter.
2020 TAG : cpython-devcontainer:1.0.0-${{ github.run_id }}
2121 steps :
22- - name : Checkout Push to Registry action
22+ - name : Checkout
2323 uses : actions/checkout@v5
2424 - name : Set up Docker Buildx
2525 uses : docker/setup-buildx-action@v3
3232 - name : Test clang
3333 run : docker run --rm ${{ env.TAG }} clang --version
3434
35+ build_wasi_container :
36+ name : Build and test (WASI container)
37+ strategy :
38+ fail-fast : false
39+ matrix :
40+ os : [ubuntu-latest, ubuntu-24.04-arm]
41+ runs-on : ${{ matrix.os }}
42+ env :
43+ TAG : cpython-wasicontainer:1.0.0-${{ github.run_id }}
44+ steps :
45+ - name : Checkout
46+ uses : actions/checkout@v5
47+ - name : Set up Docker Buildx
48+ uses : docker/setup-buildx-action@v3
49+ - name : Build Dockerfile
50+ uses : docker/build-push-action@v6
51+ with :
52+ context : ./wasicontainer
53+ load : true
54+ tags : ${{ env.TAG }}
55+ - name : Test WASI SDK
56+ run : docker run --rm ${{ env.TAG }} /opt/wasi-sdk/bin/clang --version
57+ - name : Test Wasmtime
58+ run : docker run --rm ${{ env.TAG }} wasmtime --version
59+
3560 build_autoconf :
3661 name : Build and test (Autoconf)
3762 strategy :
4368 env :
4469 TAG : autoconf:${{ matrix.autoconf_version }}-${{ github.run_id }}
4570 steps :
46- - name : Checkout Push to Registry action
71+ - name : Checkout
4772 uses : actions/checkout@v5
4873 - name : Set up Docker Buildx
4974 uses : docker/setup-buildx-action@v3
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/wasicontainer: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 by default.
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+ # Put `wasmtime` on $PATH.
45+ ln -s ${WASMTIME_HOME} /wasmtime* /usr/local/bin
You can’t perform that action at this time.
0 commit comments