Skip to content

Commit

Permalink
CI: Modernise workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Nov 29, 2023
1 parent 866d5ca commit a12661c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
71 changes: 40 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
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/[email protected]

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
17 changes: 8 additions & 9 deletions .github/workflows/lints-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-[email protected]
continue-on-error: true
with:
name: Clippy (beta)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets

working-directory: ${{ inputs.target }}
warn: clippy::all
8 changes: 4 additions & 4 deletions .github/workflows/lints-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-[email protected]
with:
name: Clippy (MSRV)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
working-directory: ${{ inputs.target }}
deny: warnings

0 comments on commit a12661c

Please sign in to comment.