CI #2560
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
merge_group: | |
defaults: | |
run: | |
shell: bash | |
# Cancel any in-flight jobs for the same PR/branch so there's only one active | |
# at a time | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build wit-bindgen | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: x86_64-linux | |
os: ubuntu-latest | |
- build: x86_64-macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
- build: aarch64-macos | |
os: macos-latest | |
target: aarch64-apple-darwin | |
- build: x86_64-windows | |
os: windows-latest | |
- build: aarch64-linux | |
os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: rustup update stable --no-self-update && rustup default stable | |
- uses: bytecodealliance/wasmtime/.github/actions/[email protected] | |
with: | |
name: ${{ matrix.build }} | |
- run: | | |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV | |
rustup target add ${{ matrix.target }} | |
if: matrix.target != '' | |
- run: $CENTOS cargo build --release | |
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bins-${{ matrix.build }} | |
path: dist | |
test: | |
name: Test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# moonbit removed from language matrix for now - causing CI failures | |
lang: [c, rust, teavm-java, go, csharp] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup update stable --no-self-update && rustup default stable | |
- run: rustup target add wasm32-wasip1 | |
- run: rustup target add wasm32-unknown-unknown | |
if: matrix.lang == 'rust' | |
- uses: ./.github/actions/install-wasi-sdk | |
if: matrix.lang == 'c' || (matrix.lang == 'csharp' && matrix.os == 'windows-latest') | |
- run: | | |
curl.exe -LO https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1 | |
powershell -File dotnet-install.ps1 -Channel 8.0.1xx -Verbose | |
echo DOTNET_ROOT=$LOCALAPPDATA'\Microsoft\dotnet' >> $GITHUB_ENV | |
export DOTNET_ROOT=$LOCALAPPDATA\\Microsoft\\dotnet | |
echo $LOCALAPPDATA'\Microsoft\dotnet' >> $GITHUB_PATH | |
echo $LOCALAPPDATA'\Microsoft\dotnet\tools' >> $GITHUB_PATH | |
$LOCALAPPDATA/Microsoft/dotnet/dotnet --info | |
if: matrix.os == 'windows-latest' && matrix.lang == 'csharp' | |
# Hacky work-around for https://github.com/dotnet/runtime/issues/80619 | |
- run: dotnet new console -o /tmp/foo | |
if: matrix.os != 'windows-latest' && matrix.lang == 'csharp' | |
- run: | | |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash | |
echo "$HOME/.moon/bin" >> $GITHUB_PATH | |
if: matrix.os != 'windows-latest' && matrix.lang == 'moonbit' | |
- run: | | |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex | |
"C:\Users\runneradmin\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Append | |
shell: powershell | |
if: matrix.os == 'windows-latest' && matrix.lang == 'moonbit' | |
- run: ci/download-teavm.sh | |
if: matrix.lang == 'teavm-java' | |
- uses: actions/setup-java@v4 | |
if: matrix.lang == 'teavm-java' | |
with: | |
java-version: '18' | |
distribution: 'adopt' | |
- uses: actions/setup-go@v4 | |
if: matrix.lang == 'go' | |
with: | |
go-version: '1.20' | |
- uses: acifani/setup-tinygo@v2 | |
if: matrix.lang == 'go' | |
with: | |
tinygo-version: 0.31.0 | |
- run: | | |
cargo test \ | |
-p wit-bindgen-cli \ | |
-p wit-bindgen-${{ matrix.lang }} \ | |
--no-default-features \ | |
--features ${{ matrix.lang }} | |
test_unit: | |
name: Crate Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup update stable --no-self-update && rustup default stable | |
- run: rustup target add wasm32-wasip1 | |
- run: cargo test -p wit-bindgen-core | |
- run: cargo test -p wit-bindgen | |
- run: cargo test --workspace --exclude 'wit-bindgen*' | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update stable --no-self-update && rustup default stable | |
- name: Install wasm32-unknown-unknown target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Install wasm32-wasip1 target | |
run: rustup target add wasm32-wasip1 | |
# Verify the output of the `./ci/rebuild-libcabi-realloc.sh` script is | |
# up-to-date. | |
- uses: ./.github/actions/install-wasi-sdk | |
- run: ./ci/rebuild-libcabi-realloc.sh | |
- run: git diff --exit-code | |
# Test various feature combinations, make sure they all build | |
- run: cargo build | |
- run: cargo build --no-default-features | |
- run: cargo build --no-default-features --features rust | |
- run: cargo build --no-default-features --features c | |
- run: cargo build --no-default-features --features teavm-java | |
- run: cargo build --no-default-features --features go | |
- run: cargo build --no-default-features --features csharp | |
- run: cargo build --no-default-features --features markdown | |
- run: cargo build --no-default-features --features moonbit | |
# Feature combos of the `wit-bindgen` crate | |
- run: cargo build --target wasm32-wasip1 -p wit-bindgen --no-default-features | |
- run: cargo build --target wasm32-wasip1 -p wit-bindgen --no-default-features --features realloc | |
- run: cargo build --target wasm32-wasip1 -p wit-bindgen --no-default-features --features macros | |
- run: cargo build --target wasm32-wasip1 -p wit-bindgen --no-default-features --features macros,realloc | |
# Verity that documentation can be generated for the rust bindings crate. | |
- run: cargo doc -p wit-bindgen --no-deps | |
env: | |
RUSTDOCFLAGS: --cfg=docsrs | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update stable && rustup default stable && rustup component add rustfmt | |
- name: Format source code | |
run: cargo fmt -- --check | |
verify-publish: | |
if: github.repository_owner == 'bytecodealliance' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- run: rustup update stable && rustup default stable | |
- run: rustc ci/publish.rs | |
# Make sure the tree is publish-able as-is | |
- run: ./publish verify | |
# Make sure we can bump version numbers for the next release | |
- run: ./publish bump | |
# "Join node" which the merge queue waits on. | |
ci-status: | |
name: Record the result of testing and building steps | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- test_unit | |
- rustfmt | |
- build | |
- verify-publish | |
- check | |
if: always() | |
steps: | |
- name: Successful test and build | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing test and build | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
- name: Report failure on cancellation | |
if: ${{ contains(needs.*.result, 'cancelled') || cancelled() }} | |
run: exit 1 |