From 3ac160bf14061440c9ca8d7619536302c97fe888 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 23 Feb 2024 14:34:47 +0000 Subject: [PATCH 1/2] CI: Add a job to check that the `wasm32-wasi` target builds Part of sugyan/atrium#116. --- .github/workflows/wasm.yml | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/wasm.yml diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml new file mode 100644 index 00000000..4eb5bb18 --- /dev/null +++ b/.github/workflows/wasm.yml @@ -0,0 +1,55 @@ +name: WASM + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + name: Build target ${{ matrix.target }} + runs-on: ubuntu-latest + strategy: + matrix: + target: + - wasm32-wasi + + steps: + - uses: actions/checkout@v4 + with: + path: crates + # We use a synthetic crate to ensure no dev-dependencies are enabled, which can + # be incompatible with some of these targets. + - name: Create synthetic crate for testing + run: cargo init --lib ci-build + - name: Copy Rust version into synthetic crate + run: cp crates/rust-toolchain.toml ci-build/ + - name: Copy patch directives into synthetic crate + run: | + echo "[patch.crates-io]" >> ./ci-build/Cargo.toml + cat ./crates/Cargo.toml | sed "0,/.\+\(patch.crates.\+\)/d" >> ./ci-build/Cargo.toml + - name: Add atrium-api as a dependency of the synthetic crate + working-directory: ./ci-build + run: > + cargo add + --path ../crates/atrium-api + - name: Add atrium-xrpc as a dependency of the synthetic crate + working-directory: ./ci-build + run: > + cargo add + --path ../crates/atrium-xrpc + - name: Add atrium-xrpc-client as a dependency of the synthetic crate + working-directory: ./ci-build + run: > + cargo add + --path ../crates/atrium-xrpc-client + --no-default-features + - name: Copy pinned dependencies into synthetic crate + run: cp crates/Cargo.lock ci-build/ + - name: Add target + working-directory: ./ci-build + run: rustup target add ${{ matrix.target }} + - name: Build for target + working-directory: ./ci-build + run: cargo build --verbose --target ${{ matrix.target }} From b62e1280e8a69e3cf471e46417128597b95fa728 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 27 Feb 2024 01:56:42 +0000 Subject: [PATCH 2/2] CI: Run checks against `wasm32-unknown-unknown` as well --- .github/workflows/wasm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 4eb5bb18..6c18d570 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -13,6 +13,7 @@ jobs: strategy: matrix: target: + - wasm32-unknown-unknown - wasm32-wasi steps: