chore(cli): Refactor error handling in project
module
#42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
RUSTFLAGS: "-Dwarnings" | |
RUSTDOCFLAGS: "-Dwarnings" | |
jobs: | |
# This allows us to have one branch protection rule for the full test matrix. | |
# See: https://github.com/orgs/community/discussions/4324 | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
needs: [test-matrix] | |
if: always() | |
steps: | |
- name: Tests successful | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Tests failing | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
test-matrix: | |
name: Tests | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@1.79.0 | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --workspace --no-run | |
- run: cargo test --workspace --no-fail-fast | |
test-book: | |
name: Test Book | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install latest mdbook | |
run: | | |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | |
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | |
mkdir bin | |
curl -sSL $url | tar -xz --directory=bin | |
echo "$(pwd)/bin" >> $GITHUB_PATH | |
- name: Run tests | |
run: | | |
cd docs/book | |
mdbook test | |
check-msrv: | |
name: Check mininum supported Rust version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@1.79.0 | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo check --workspace | |
checks: | |
name: Check clippy, formatting, and documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@1.79.0 | |
with: | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --workspace --all-targets --all-features | |
- run: cargo fmt --check --all | |
- run: cargo doc --workspace --no-deps |