From e267ea876f6a7446dbd6fc8fc66c9cd9569cce77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Granh=C3=A3o?= Date: Tue, 25 Feb 2025 23:09:52 +0000 Subject: [PATCH] Adjust GH actions --- .github/workflows/build.yaml | 10 ++++++---- .github/workflows/lint.yaml | 6 +++++- .github/workflows/test.yaml | 8 +++++++- Makefile | 10 +++++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7463b05..b6539f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,13 +16,11 @@ jobs: rust: - stable - nightly - features: - - default steps: - name: checkout uses: actions/checkout@v3 - name: Generate cache key - run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key + run: echo "${{ matrix.rust }}" | tee .cache_key - name: cache uses: actions/cache@v2 with: @@ -33,9 +31,13 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - name: Set default toolchain run: rustup default ${{ matrix.rust }} + - name: Add wasm target + run: rustup target add wasm32-unknown-unknown - name: Set profile run: rustup set profile minimal - name: Update toolchain run: rustup update - name: Build - run: cargo build --features ${{ matrix.features }} + run: make cargo-build + - name: Build wasm + run: make wasm-build diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 9b0c1fe..3c8ca67 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -22,9 +22,13 @@ jobs: run: rustup component add rustfmt - name: Add clippy run: rustup component add clippy + - name: Add wasm target + run: rustup target add wasm32-unknown-unknown - name: Update toolchain run: rustup update - name: Check fmt run: cargo fmt --all -- --check - name: Clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: make cargo-clippy + - name: Clippy wasm + run: make wasm-clippy diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0fd924f..8718ca5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,5 +17,11 @@ jobs: run: rustup default nightly - name: Set profile run: rustup set profile minimal + - name: Add wasm target + run: rustup target add wasm32-unknown-unknown + - name: Install wasm-pack + run: cargo install wasm-pack - name: Run cargo test - run: cargo test -- --nocapture + run: make cargo-test + - name: Run wasm-pack test + run: make wasm-test diff --git a/Makefile b/Makefile index ce051e0..1afccf6 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,14 @@ endif init: cargo install wasm-pack +build: cargo-build cargo-clippy + +cargo-build: + cargo build --all-targets --all-features + +wasm-build: + cargo build --target=wasm32-unknown-unknown --all-features + clippy: cargo-clippy wasm-clippy test: cargo-test wasm-test @@ -15,7 +23,7 @@ cargo-clippy: cargo clippy --all-targets --all-features -- -D warnings cargo-test: - cargo test + cargo test -- --nocapture wasm-clippy: $(CLANG_PREFIX) cargo clippy --target=wasm32-unknown-unknown --all-features -- -D warnings