| 1 | --- |
| 2 | name: Test |
| 3 | |
| 4 | on: |
| 5 | workflow_call: |
| 6 | pull_request: |
| 7 | branches: |
| 8 | - '*' |
| 9 | |
| 10 | jobs: |
| 11 | format: |
| 12 | name: Format |
| 13 | runs-on: ubuntu-latest |
| 14 | steps: |
| 15 | - uses: actions/checkout@v6 |
| 16 | - uses: dtolnay/rust-toolchain@stable |
| 17 | |
| 18 | - name: Format |
| 19 | run: cargo fmt --all -- --check |
| 20 | |
| 21 | lint: |
| 22 | name: Clippy |
| 23 | runs-on: ubuntu-latest |
| 24 | steps: |
| 25 | - uses: actions/checkout@v6 |
| 26 | - uses: dtolnay/rust-toolchain@stable |
| 27 | |
| 28 | - name: Clippy |
| 29 | run: cargo clippy --all-targets --all-features |
| 30 | |
| 31 | check: |
| 32 | name: Check |
| 33 | runs-on: ubuntu-latest |
| 34 | steps: |
| 35 | - uses: actions/checkout@v6 |
| 36 | - uses: dtolnay/rust-toolchain@stable |
| 37 | |
| 38 | - name: Check |
| 39 | run: cargo check |
| 40 | |
| 41 | test: |
| 42 | name: Test |
| 43 | strategy: |
| 44 | matrix: |
| 45 | os: |
| 46 | - ubuntu-latest |
| 47 | - macOS-latest |
| 48 | rust: |
| 49 | - stable |
| 50 | runs-on: ${{ matrix.os }} |
| 51 | needs: |
| 52 | - format |
| 53 | - lint |
| 54 | - check |
| 55 | steps: |
| 56 | - uses: actions/checkout@v6 |
| 57 | - uses: dtolnay/rust-toolchain@stable |
| 58 | |
| 59 | - name: test |
| 60 | run: RUST_TEST_THREADS=1 cargo test |
| 61 | |
| 62 | - name: Cleanup orphaned test processes |
| 63 | if: always() |
| 64 | run: | |
| 65 | # Kill any remaining test processes |
| 66 | pkill -9 -f "fork.*debug/deps" || true |
| 67 | # Clean up test directories |
| 68 | rm -rf /tmp/fork_test* || true |
| 69 | |
| 70 | coverage: |
| 71 | name: Coverage |
| 72 | runs-on: ubuntu-latest |
| 73 | needs: |
| 74 | - format |
| 75 | - lint |
| 76 | - check |
| 77 | steps: |
| 78 | - uses: actions/checkout@v6 |
| 79 | - uses: dtolnay/rust-toolchain@stable |
| 80 | with: |
| 81 | components: llvm-tools-preview |
| 82 | |
| 83 | - name: Install cargo-llvm-cov |
| 84 | uses: taiki-e/install-action@v2 |
| 85 | with: |
| 86 | tool: cargo-llvm-cov |
| 87 | |
| 88 | - name: Generate coverage (lcov) |
| 89 | run: | |
| 90 | RUST_TEST_THREADS=1 cargo llvm-cov --all-features --workspace --lcov --output-path coverage.lcov |
| 91 | |
| 92 | - name: Upload to codecov.io |
| 93 | uses: codecov/codecov-action@v5 |
| 94 | env: |
| 95 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 96 | with: |
| 97 | files: coverage.lcov |
| 98 | flags: rust |
| 99 | |
| 100 | - name: Coveralls GitHub Action |
| 101 | uses: coverallsapp/github-action@v2 |