From e463d4094637d2fd5be79e11c02f6a5e7e3b9fa3 Mon Sep 17 00:00:00 2001 From: Justyna Hudziak Date: Thu, 1 Aug 2024 12:42:55 +0200 Subject: [PATCH] Add CI & CD for Wasm --- .github/workflows/continuous_deployment.yml | 30 ++++++++++++++++++++ .github/workflows/continuous_integration.yml | 25 ++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/continuous_deployment.yml create mode 100644 .github/workflows/continuous_integration.yml diff --git a/.github/workflows/continuous_deployment.yml b/.github/workflows/continuous_deployment.yml new file mode 100644 index 0000000..3fa203f --- /dev/null +++ b/.github/workflows/continuous_deployment.yml @@ -0,0 +1,30 @@ +# from: https://plippe.github.io/blog/2021/07/12/rust-wasm-github.html +name: Continuous deployment +on: + workflow_run: + branches: [main] + workflows: [Continuous integration] + types: [completed] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + + - uses: jetli/wasm-pack-action@v0.4.0 + - uses: jetli/wasm-bindgen-action@v0.2.0 + + - uses: actions/checkout@v4 + + - run: wasm-pack build --target web --release --out-dir ./wasm/pkg + + - uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./wasm + diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml new file mode 100644 index 0000000..00b6fbd --- /dev/null +++ b/.github/workflows/continuous_integration.yml @@ -0,0 +1,25 @@ +# from: https://plippe.github.io/blog/2021/07/12/rust-wasm-github.html +name: Continuous integration +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: cargo test --all + + format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: cargo clippy --all -- -D warnings