cpython/.github/workflows/reusable-wasi.yml
Hugo van Kemenade cf31c2454b
[3.13] Lock GitHub Actions workflows (GH-161811) (GH-161882) (#161889)
(cherry picked from commit 023c3d1d63)


(cherry picked from commit 16b9ac289d)
2026-11-16 13:36:27 +02:00

63 lines
2.2 KiB
YAML

name: Reusable WASI
on:
workflow_call:
permissions:
contents: read
env:
FORCE_COLOR: 1
jobs:
build-wasi-reusable:
name: 'build and test'
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
WASMTIME_VERSION: 38.0.3
WASI_SDK_VERSION: 24
WASI_SDK_PATH: /opt/wasi-sdk
CROSS_BUILD_WASI: cross-build/wasm32-wasip1
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
# No problem resolver registered as one doesn't currently exist for Clang.
- name: "Install wasmtime"
uses: bytecodealliance/actions/wasmtime/setup@v1.1.3
with:
version: ${{ env.WASMTIME_VERSION }}
- name: "Restore WASI SDK"
id: cache-wasi-sdk
uses: actions/cache@v6.1.0
with:
path: ${{ env.WASI_SDK_PATH }}
key: ${{ runner.os }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}
- name: "Install WASI SDK" # Hard-coded to x64.
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
run: |
mkdir "${WASI_SDK_PATH}" && \
curl -s -S --location "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz" | \
tar --strip-components 1 --directory "${WASI_SDK_PATH}" --extract --gunzip
- name: "Install Python"
uses: actions/setup-python@v7.0.0
with:
python-version: '3.x'
- name: "Runner image version"
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
- name: "Configure build Python"
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
run: python3 Tools/wasm/wasi.py make-build-python
- name: "Display build info of the build Python"
run: python3 Tools/wasm/wasi.py pythoninfo-build
- name: "Configure host/WASI Python"
# `--with-pydebug` inferred from configure-build-python
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
- name: "Make host/WASI Python"
run: python3 Tools/wasm/wasi.py make-host
- name: "Display build info of the host/WASI Python"
run: python3 Tools/wasm/wasi.py pythoninfo-host
- name: "Test"
run: make --directory "${CROSS_BUILD_WASI}" test