diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 488880cc..aee6900f 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -8,7 +8,7 @@ runs: using: "composite" steps: # Setup Python and the Python dependencies of this project - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} - run: pip install -e ".[testing]" @@ -27,36 +27,14 @@ runs: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" # Ensure the Rust lockfile is up-to-date - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry/index - ~/.cargo/git/db - key: cargo-registry-${{ hashFiles('rust/Cargo.lock') }} - run: cargo fetch --manifest-path rust/Cargo.toml --locked shell: bash # Install the `wasm-tools` binary with the `component` subcommand that is all # that's needed here. - - run: | - echo WASM_TOOLS=wasm-tools-1.0.53 >> $GITHUB_ENV - mkdir -p '${{ runner.tool_cache }}/wasm-tools' - echo '${{ runner.tool_cache }}/wasm-tools' >> $GITHUB_PATH - shell: bash - - run: | - curl -L https://github.com/bytecodealliance/wasm-tools/releases/download/$WASM_TOOLS/$WASM_TOOLS-x86_64-linux.tar.gz | tar xzv -C ${{ runner.tool_cache }}/wasm-tools --strip-components 1 - if: runner.os == 'Linux' - shell: bash - - run: | - curl -L https://github.com/bytecodealliance/wasm-tools/releases/download/$WASM_TOOLS/$WASM_TOOLS-x86_64-macos.tar.gz | tar xzv -C ${{ runner.tool_cache }}/wasm-tools --strip-components 1 - if: runner.os == 'macOS' - shell: bash - - run: | - path='${{ runner.tool_cache }}/wasm-tools' - curl -o "$path/bins.zip" -L https://github.com/bytecodealliance/wasm-tools/releases/download/$WASM_TOOLS/$WASM_TOOLS-x86_64-windows.zip - 7z e "$path/bins.zip" -o"$path" - if: runner.os == 'Windows' - shell: bash + - uses: bytecodealliance/actions/wasm-tools/setup@v1 + with: + version: "1.208.1" # Build the bindgen wasm blob with some extra Rust targets. - run: | @@ -65,7 +43,7 @@ runs: echo CARGO_PROFILE_DEV_DEBUG=0 >> $GITHUB_ENV echo RUSTC_VERSION=`rustc --version` >> $GITHUB_ENV shell: bash - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: rust/target key: rust-target-${{ env.RUSTC_VERSION }}-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock') }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 47b16652..4b237757 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,6 +73,11 @@ jobs: python ci/download-wasmtime.py win32 x86_64 python ci/build-rust.py python setup.py bdist_wheel --plat-name win-amd64 + - run: | + git clean -fdx wasmtime build + python ci/download-wasmtime.py musl x86_64 + python ci/build-rust.py + python setup.py bdist_wheel --plat-name musllinux_1_2_x86_64 # Build an "any" wheel with: # diff --git a/ci/download-wasmtime.py b/ci/download-wasmtime.py index c3537a9b..aba0be10 100644 --- a/ci/download-wasmtime.py +++ b/ci/download-wasmtime.py @@ -16,13 +16,20 @@ def main(platform, arch): is_zip = False version = WASMTIME_VERSION + + # Temporarily use `dev` artifacts for musl until Wasmtime 22 is released. + if platform == 'musl': + version = 'dev' + if arch == 'AMD64': arch = 'x86_64' if arch == 'arm64': arch = 'aarch64' - if platform == 'linux': - filename = 'wasmtime-{}-{}-linux-c-api.tar.xz'.format(version, arch) + dirname = '{}-{}'.format(platform, arch) + if platform == 'linux' or platform == 'musl': + filename = 'wasmtime-{}-{}-{}-c-api.tar.xz'.format(version, arch, platform) libname = '_libwasmtime.so' + dirname = 'linux-{}'.format(arch) elif platform == 'win32': filename = 'wasmtime-{}-{}-windows-c-api.zip'.format(version, arch) is_zip = True @@ -36,7 +43,6 @@ def main(platform, arch): url = 'https://github.com/bytecodealliance/wasmtime/releases/download/{}/'.format(version) url += filename print('Download', url) - dirname = '{}-{}'.format(platform, arch) dst = Path('wasmtime') / dirname / libname try: shutil.rmtree(dst.parent) @@ -54,8 +60,9 @@ def main(platform, arch): def final_loc(name): parts = name.split('include/') - print(parts) - if len(parts) > 1 and name.endswith('.h'): + if '/min/' in name: + return None + elif len(parts) > 1 and name.endswith('.h'): return Path('wasmtime') / 'include' / parts[1] elif name.endswith('.dll') or name.endswith('.so') or name.endswith('.dylib'): if '-min.' in name: @@ -70,6 +77,7 @@ def final_loc(name): loc = final_loc(member) if not loc: continue + print(f'{member} => {loc}') contents = t.read(member) with open(loc, "wb") as f: f.write(contents) @@ -79,6 +87,7 @@ def final_loc(name): loc = final_loc(member.name) if not loc: continue + print(f'{member.name} => {loc}') contents = t.extractfile(member).read() with open(loc, "wb") as f: f.write(contents)