name: Reusable WASI on: workflow_call: permissions: contents: read env: FORCE_COLOR: 1 jobs: build-wasi-reusable: name: 'build and test' runs-on: ubuntu-26.04-arm timeout-minutes: 60 env: WASMTIME_VERSION: 48.0.2 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 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@9152e710e9f7182e4c29ad218e4f335a7b203613 # v1.1.3 with: version: ${{ env.WASMTIME_VERSION }} - name: "Read WASI SDK version" id: wasi-sdk-version run: | import tomllib from pathlib import Path import os config = tomllib.loads(Path("Platforms/WASI/config.toml").read_text()) version = config["targets"]["wasi-sdk"] with open(os.environ["GITHUB_OUTPUT"], "a") as f: f.write(f"version={version}\n") shell: python - name: "Install WASI SDK" id: install-wasi-sdk uses: bytecodealliance/setup-wasi-sdk-action@77d09f3df1e8da344d8403cf8631af8977938b4c with: version: ${{ steps.wasi-sdk-version.outputs.version }} add-to-path: false - name: "Install Python" uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # 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 Platforms/WASI configure-build-python -- --config-cache --with-pydebug - name: "Make build Python" run: python3 Platforms/WASI make-build-python - name: "Display build info of the build Python" run: python3 Platforms/WASI pythoninfo-build - name: "Configure host/WASI Python" # `--with-pydebug` inferred from configure-build-python run: python3 Platforms/WASI configure-host -- --config-cache env: WASI_SDK_PATH: ${{ steps.install-wasi-sdk.outputs.wasi-sdk-path }} - name: "Make host/WASI Python" run: python3 Platforms/WASI make-host - name: "Display build info of the host/WASI Python" run: python3 Platforms/WASI pythoninfo-host - name: "Test" run: | CROSS_BUILD_WASI=$(python3 Platforms/WASI path) make --directory "${CROSS_BUILD_WASI}" test