Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd196b8

Browse files
authored
Create a dedicated WASI container (#56)
* Create a dedicated WASI container* Fix the naming of the WASI test CI job* Update base image label in Dockerfile* Fix CI references to "devcontainer" for the WASI container* Fix symlinking wasmtime* Fix naming for the checkout action
1 parent3d64c15 commitdd196b8

File tree

5 files changed

+96
-2
lines changed

5 files changed

+96
-2
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
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
@@ -32,6 +32,31 @@ jobs:
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:
@@ -43,7 +68,7 @@ jobs:
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

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
options:
1212
-autoconf
1313
-devcontainer
14+
-wasicontainer
1415

1516
run-name:"Release: ${{ inputs.package }}"
1617

‎wasicontainer/Dockerfile‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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

‎wasicontainer/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
A container for developing CPython for WASI.
2+
3+
It is based on the dev container, and thus includes the same common utilities.

‎wasicontainer/install-wasi.sh‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
forVERSIONin"${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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp