name: 'Code Quality'
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: 'Lint'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 with:
cache-workspaces: . -> target
- name: Install additional problem matchers
run: echo "::add-matcher::.github/problem-matchers.json"
- name: Check formatting
id: fmt
run: cargo fmt --all -- --check
continue-on-error: true
- name: Check (core-only)
id: check-core
run: cargo check -p suzunari-error --no-default-features
continue-on-error: true
- name: Check (alloc)
id: check-alloc
run: cargo check -p suzunari-error --no-default-features --features alloc
continue-on-error: true
- name: Check (std)
id: check-std
run: cargo check -p suzunari-error --all-features
continue-on-error: true
- name: Clippy (core-only)
id: clippy-core
run: cargo clippy -p suzunari-error --no-default-features -- -D warnings
continue-on-error: true
- name: Clippy (alloc)
id: clippy-alloc
run: cargo clippy -p suzunari-error --no-default-features --features alloc -- -D warnings
continue-on-error: true
- name: Clippy (std)
id: clippy-std
run: cargo clippy -p suzunari-error --all-features -- -D warnings
continue-on-error: true
- name: Test (std)
id: test-std
run: cargo test -p suzunari-error --all-features
continue-on-error: true
- name: Check macro-impl (no alloc)
id: check-macro-no-alloc
run: cargo check -p suzunari-error-macro-impl --no-default-features
continue-on-error: true
- name: Check macro-impl (alloc)
id: check-macro-alloc
run: cargo check -p suzunari-error-macro-impl --features alloc
continue-on-error: true
- name: Check feature tests (core-only)
id: check-feature-core
run: cargo check -p suzunari-error-feature-tests --no-default-features --features test-core-only
continue-on-error: true
- name: Check feature tests (alloc)
id: check-feature-alloc
run: cargo check -p suzunari-error-feature-tests --no-default-features --features test-alloc
continue-on-error: true
- name: Check feature tests (std)
id: check-feature-std
run: cargo check -p suzunari-error-feature-tests --features test-std
continue-on-error: true
- name: Test feature tests (core-only)
id: test-feature-core
run: cargo test -p suzunari-error-feature-tests --no-default-features --features test-core-only
continue-on-error: true
- name: Test feature tests (alloc)
id: test-feature-alloc
run: cargo test -p suzunari-error-feature-tests --no-default-features --features test-alloc
continue-on-error: true
- name: Test feature tests (std)
id: test-feature-std
run: cargo test -p suzunari-error-feature-tests --features test-std
continue-on-error: true
- name: Report results
if: always()
shell: bash
env:
RESULTS: |
fmt=${{ steps.fmt.outcome }}
check-core=${{ steps.check-core.outcome }}
check-alloc=${{ steps.check-alloc.outcome }}
check-std=${{ steps.check-std.outcome }}
clippy-core=${{ steps.clippy-core.outcome }}
clippy-alloc=${{ steps.clippy-alloc.outcome }}
clippy-std=${{ steps.clippy-std.outcome }}
test-std=${{ steps.test-std.outcome }}
check-macro-no-alloc=${{ steps.check-macro-no-alloc.outcome }}
check-macro-alloc=${{ steps.check-macro-alloc.outcome }}
check-feature-core=${{ steps.check-feature-core.outcome }}
check-feature-alloc=${{ steps.check-feature-alloc.outcome }}
check-feature-std=${{ steps.check-feature-std.outcome }}
test-feature-core=${{ steps.test-feature-core.outcome }}
test-feature-alloc=${{ steps.test-feature-alloc.outcome }}
test-feature-std=${{ steps.test-feature-std.outcome }}
run: |
failed=0
while IFS='=' read -r name outcome; do
[ -z "$name" ] && continue
if [ "$outcome" = "failure" ]; then
echo "::error::$name failed"
failed=1
fi
done <<< "$RESULTS"
if [ "$failed" -eq 1 ]; then
exit 1
fi
echo "All steps succeeded."