|
| 1 | +name: Testing |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +env: |
| 8 | + CARGO_TERM_COLOR: always |
| 9 | + |
| 10 | +jobs: |
| 11 | + format: |
| 12 | + name: Formatting |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - id: checkout |
| 17 | + name: Checkout Repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - id: setup |
| 21 | + name: Setup Toolchain |
| 22 | + uses: dtolnay/rust-toolchain@stable |
| 23 | + with: |
| 24 | + toolchain: nightly |
| 25 | + components: rustfmt |
| 26 | + |
| 27 | + - id: cache |
| 28 | + name: Enable Workflow Cache |
| 29 | + uses: Swatinem/rust-cache@v2 |
| 30 | + |
| 31 | + - id: format |
| 32 | + name: Run Formatting-Checks |
| 33 | + run: cargo fmt --check |
| 34 | + |
| 35 | + check: |
| 36 | + name: Static Analysis |
| 37 | + runs-on: ubuntu-latest |
| 38 | + needs: format |
| 39 | + |
| 40 | + strategy: |
| 41 | + matrix: |
| 42 | + toolchain: [stable, nightly] |
| 43 | + |
| 44 | + steps: |
| 45 | + - id: checkout |
| 46 | + name: Checkout Repository |
| 47 | + uses: actions/checkout@v3 |
| 48 | + |
| 49 | + - id: setup |
| 50 | + name: Setup Toolchain |
| 51 | + uses: dtolnay/rust-toolchain@stable |
| 52 | + with: |
| 53 | + toolchain: nightly |
| 54 | + components: clippy |
| 55 | + |
| 56 | + - id: cache |
| 57 | + name: Enable Workflow Cache |
| 58 | + uses: Swatinem/rust-cache@v2 |
| 59 | + |
| 60 | + - id: check |
| 61 | + name: Run Build Checks |
| 62 | + run: cargo check --workspace --all-targets --all-features |
| 63 | + |
| 64 | + - id: lint |
| 65 | + name: Run Lint Checks |
| 66 | + run: cargo clippy --workspace --all-targets --all-features -- -D clippy::correctness -D clippy::suspicious -D clippy::complexity -D clippy::perf -D clippy::style -D clippy::pedantic |
| 67 | + |
| 68 | + - id: doc |
| 69 | + name: Run Documentation Checks |
| 70 | + run: cargo test --doc |
| 71 | + |
| 72 | + unit: |
| 73 | + name: Units |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: check |
| 76 | + |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + toolchain: [stable, nightly] |
| 80 | + |
| 81 | + steps: |
| 82 | + - id: checkout |
| 83 | + name: Checkout Repository |
| 84 | + uses: actions/checkout@v3 |
| 85 | + |
| 86 | + - id: setup |
| 87 | + name: Setup Toolchain |
| 88 | + uses: dtolnay/rust-toolchain@stable |
| 89 | + with: |
| 90 | + toolchain: ${{ matrix.toolchain }} |
| 91 | + components: llvm-tools-preview |
| 92 | + |
| 93 | + - id: cache |
| 94 | + name: Enable Job Cache |
| 95 | + uses: Swatinem/rust-cache@v2 |
| 96 | + |
| 97 | + - id: tools |
| 98 | + name: Install Tools |
| 99 | + uses: taiki-e/install-action@v2 |
| 100 | + with: |
| 101 | + tool: cargo-llvm-cov, cargo-nextest |
| 102 | + |
| 103 | + - id: imdl |
| 104 | + name: Install Intermodal |
| 105 | + run: cargo install imdl |
| 106 | + |
| 107 | + - id: test |
| 108 | + name: Run Unit Tests |
| 109 | + run: cargo test --workspace --all-targets --all-features |
| 110 | + |
| 111 | + - id: coverage |
| 112 | + name: Generate Coverage Report |
| 113 | + run: cargo llvm-cov nextest --workspace --all-targets --all-features |
0 commit comments