From 09b4eb45d3c9344a869972a2ee503da827e531d2 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 28 Nov 2023 23:31:35 +0000 Subject: [PATCH] CI: Modernise workflows --- .github/workflows/bench.yml | 2 +- .github/workflows/book.yml | 20 ++++----- .github/workflows/ci.yml | 71 +++++++++++++++++------------- .github/workflows/lints-beta.yml | 17 ++++--- .github/workflows/lints-stable.yml | 8 ++-- 5 files changed, 62 insertions(+), 56 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 47bc90925..b2430047c 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -13,7 +13,7 @@ jobs: name: Performance regression check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run benchmark run: cargo bench -- --output-format bencher | tee output.txt - name: Store benchmark result diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 666080296..f5fd6cc82 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -7,20 +7,18 @@ on: jobs: deploy: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Setup mdBook - uses: peaceiris/actions-mdbook@v1 + - uses: actions/checkout@v4 with: - mdbook-version: '0.4.5' + fetch-depth: 0 - - name: Install mdbook-katex - uses: actions-rs/cargo@v1 - with: - command: install - args: mdbook-katex + - name: Install mdbook and mdbook-katex + run: | + mkdir mdbook + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + curl -sSL https://github.com/lzanini/mdbook-katex/releases/download/v0.5.8pub/mdbook-katex-v0.5.8-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH - name: Build Orchard book run: mdbook build book/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32377b4f3..3f9c2255e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,31 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run tests run: cargo test --verbose + - name: Verify working directory is clean + run: git diff --exit-code - build: + build-latest: + name: Latest build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + id: toolchain + - run: rustup override set ${{steps.toolchain.outputs.name}} + - name: Remove lockfile to build with latest dependencies + run: rm Cargo.lock + - name: Build crate + run: cargo build --all-features --verbose + - name: Verify working directory is clean (excluding lockfile) + run: git diff --exit-code ':!Cargo.lock' + + build-nodefault: name: Build target ${{ matrix.target }} runs-on: ubuntu-latest strategy: @@ -24,7 +44,7 @@ jobs: - wasm32-wasi steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Add target run: rustup target add ${{ matrix.target }} - run: cargo fetch @@ -35,7 +55,7 @@ jobs: name: Bitrot check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # Build benchmarks to prevent bitrot - name: Build benchmarks run: cargo build --benches @@ -44,54 +64,43 @@ jobs: name: Book tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup mdBook - uses: peaceiris/actions-mdbook@v1 - with: - mdbook-version: '0.4.5' + - uses: actions/checkout@v4 + - name: Install mdbook and mdbook-katex + run: | + mkdir mdbook + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH - name: Test Orchard book run: mdbook test book/ codecov: name: Code coverage runs-on: ubuntu-latest + container: + image: xd009642/tarpaulin:develop-nightly + options: --security-opt seccomp=unconfined steps: - - uses: actions/checkout@v2 - # Use stable for this to ensure that cargo-tarpaulin can be built. - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Install cargo-tarpaulin - uses: actions-rs/cargo@v1 - with: - command: install - args: cargo-tarpaulin + - uses: actions/checkout@v4 - name: Generate coverage report - uses: actions-rs/cargo@v1 - with: - command: tarpaulin - args: --all-features --timeout 600 --out Xml + run: cargo tarpaulin --engine llvm --all-features --release --timeout 600 --out xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{secrets.CODECOV_TOKEN}} + uses: codecov/codecov-action@v3.1.4 doc-links: name: Intra-doc links runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: cargo fetch - # Requires #![deny(intra_doc_link_resolution_failure)] in crates. + # Requires #![deny(rustdoc::broken_intra_doc_links)] in crates. - name: Check intra-doc links - run: cargo doc --document-private-items + run: cargo doc --all-features --document-private-items fmt: name: Rustfmt timeout-minutes: 30 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: cargo fmt -- --check diff --git a/.github/workflows/lints-beta.yml b/.github/workflows/lints-beta.yml index cb8bc66a9..fbc46d143 100644 --- a/.github/workflows/lints-beta.yml +++ b/.github/workflows/lints-beta.yml @@ -11,17 +11,16 @@ jobs: runs-on: ubuntu-latest continue-on-error: true steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@beta + id: toolchain with: - toolchain: beta components: clippy - override: true - - name: Run Clippy (beta) - uses: actions-rs/clippy-check@v1 + - run: rustup override set ${{steps.toolchain.outputs.name}} + - name: Run Clippy + uses: auguwu/clippy-action@1.3.0 continue-on-error: true with: - name: Clippy (beta) token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features --all-targets - + working-directory: ${{ inputs.target }} + warn: clippy::all diff --git a/.github/workflows/lints-stable.yml b/.github/workflows/lints-stable.yml index ca42fcca9..328c4fc9d 100644 --- a/.github/workflows/lints-stable.yml +++ b/.github/workflows/lints-stable.yml @@ -9,10 +9,10 @@ jobs: timeout-minutes: 30 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run Clippy - uses: actions-rs/clippy-check@v1 + uses: auguwu/clippy-action@1.3.0 with: - name: Clippy (MSRV) token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features --all-targets -- -D warnings + working-directory: ${{ inputs.target }} + deny: warnings