|
| 1 | +name: Check Safe Stage |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [$default-branch] |
| 5 | + paths: |
| 6 | + - "safe-stage/*" |
| 7 | + pull_request: |
| 8 | + branches: [$default-branch] |
| 9 | + paths: |
| 10 | + - "safe-stage/*" |
| 11 | + |
| 12 | +env: |
| 13 | + CARGO_TERM_COLOR: always |
| 14 | + |
| 15 | +jobs: |
| 16 | + safe-stage-build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + FEATURES: ["--all", "-F ffi"] |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - uses: actions/cache@v4 |
| 24 | + with: |
| 25 | + path: | |
| 26 | + ~/.cargo/bin/ |
| 27 | + ~/.cargo/registry/index/ |
| 28 | + ~/.cargo/registry/cache/ |
| 29 | + ~/.cargo/git/db/ |
| 30 | + ./safe-stage/target/ |
| 31 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 32 | + |
| 33 | + - name: Check Formatting |
| 34 | + run: cargo fmt --all --check |
| 35 | + working-directory: ./safe-stage |
| 36 | + |
| 37 | + - name: Build with Features "${{ matrix.FEATURES }}" |
| 38 | + run: cargo build --locked ${{ matrix.FEATURES }} |
| 39 | + working-directory: ./safe-stage |
| 40 | + |
| 41 | + - name: Run clippy with Features "${{ matrix.FEATURES }}" |
| 42 | + run: cargo clippy --locked ${{ matrix.FEATURES }} -- -D warnings |
| 43 | + working-directory: ./safe-stage |
| 44 | + |
| 45 | + safe-stage-test: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + permissions: |
| 48 | + checks: write |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + PROFILE_FEATURES: |
| 52 | + [ |
| 53 | + "ci-default;--all", |
| 54 | + "ci-features-serde;--all -F serde", |
| 55 | + "ci-features-linear;-p collisions --no-default-features -F rayon-bvh-linear", |
| 56 | + "ci-features-ffi;-F ffi", |
| 57 | + ] |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + - uses: actions/cache@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + ~/.cargo/bin/ |
| 64 | + ~/.cargo/registry/index/ |
| 65 | + ~/.cargo/registry/cache/ |
| 66 | + ~/.cargo/git/db/ |
| 67 | + ./safe-stage/target/ |
| 68 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 69 | + |
| 70 | + - name: Add nextest |
| 71 | + uses: taiki-e/install-action@nextest |
| 72 | + |
| 73 | + - name: Extract Profile and Features |
| 74 | + id: extraction |
| 75 | + run: | |
| 76 | + PROFILE_FEATURES="${{ matrix.PROFILE_FEATURES }}" |
| 77 | +
|
| 78 | + # Split the string at the semicolon |
| 79 | + IFS=';' read -r PROFILE FEATURES <<< "$PROFILE_FEATURES" |
| 80 | +
|
| 81 | + echo "PROFILE=$PROFILE" |
| 82 | + echo "FEATURES=$FEATURES" |
| 83 | +
|
| 84 | + # Set the outputs for use in subsequent steps |
| 85 | + echo "profile=$PROFILE" >> "$GITHUB_OUTPUT" |
| 86 | + echo "features=$FEATURES" >> "$GITHUB_OUTPUT" |
| 87 | +
|
| 88 | + - name: Run Documentation Tests with Profile "${{ steps.extraction.outputs.profile }}" |
| 89 | + run: cargo test --locked --doc ${{ steps.extraction.outputs.features }} |
| 90 | + working-directory: ./safe-stage |
| 91 | + |
| 92 | + - name: Run Tests with Profile "${{ steps.extraction.outputs.profile }}" |
| 93 | + run: cargo nextest run --locked --config-file .nextest.toml -P ${{ steps.extraction.outputs.profile }} ${{ steps.extraction.outputs.features }} |
| 94 | + working-directory: ./safe-stage |
| 95 | + |
| 96 | + - name: Finalize Test Report |
| 97 | + uses: dorny/test-reporter@v1 |
| 98 | + if: success() || failure() |
| 99 | + with: |
| 100 | + name: Results for ${{ steps.extraction.outputs.profile }} |
| 101 | + reporter: java-junit |
| 102 | + path: safe-stage/target/nextest/${{ steps.extraction.outputs.profile }}/junit-report.xml |
0 commit comments