From 2ece324e58befe83e6a0c124173431fec75f6aa4 Mon Sep 17 00:00:00 2001 From: Abdulrahim Al Methiab Date: Thu, 30 Nov 2023 16:27:35 +0100 Subject: [PATCH] Action build and test + audit --- .github/workflows/audit.yml | 30 ++++++++++++++++ .github/workflows/build-and-test.yml | 53 ++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..3ad214f --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,30 @@ +name: Audit + +on: + schedule: + - cron: '0 0 * * *' # run at midnight every day + push: + branches: + - main + paths: + - "**/Cargo.lock" + - "**/Cargo.toml" + - ".github/workflows/audit.yml" + - ".cargo/audit.toml" + pull_request: + branches: + - main + paths: + - "**/Cargo.lock" + - "**/Cargo.toml" + - ".github/workflows/audit.yml" + - ".cargo/audit.toml" + +jobs: + audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..cc284c3 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,53 @@ +name: Build and run tests + +on: + push: + branches: + - main + pull_request: + types: [ opened, synchronize, reopened, ready_for_review ] + branches: + - main + - 'epic/**' + - 'support/**' + paths: + - '.github/workflows/build-and-test.yml' + - '.github/actions/**' + - '**.rs' + - '**.toml' + +env: + RUST_BACKTRACE: full + +jobs: + check-for-run-condition: + runs-on: ubuntu-latest + outputs: + should-run: ${{ !github.event.pull_request || github.event.pull_request.draft == false }} + steps: + - run: | + # this run step does nothing, but is needed to get the job output + + build-and-test: + runs-on: ${{ matrix.os }} + needs: [ check-for-run-condition ] + if: ${{ needs.check-for-run-condition.outputs.should-run == 'true' && needs.check-for-modification.outputs.core-modified == 'true' }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, windows-latest ] + + steps: + - uses: actions/checkout@v3 + + - name: Setup Rust and cache + uses: './.github/actions/rust/rust-setup' + + - name: Build + run: cargo build --workspace --tests --examples --all-features --release + + - name: Run tests + run: cargo test --workspace --all-features --release + + - name: Run Rust example + run: cargo run --example sd_jwt