|
| 1 | +name: nightly |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + pull-requests: read |
| 6 | + security-events: write |
| 7 | + |
| 8 | +on: |
| 9 | + schedule: |
| 10 | + - cron: '0 0 * * *' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +env: |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + |
| 16 | + # Rust toolchain versions |
| 17 | + RUST_LATEST: "1.91" # used for mutation testing |
| 18 | + |
| 19 | + # Tool versions |
| 20 | + CARGO_MUTANTS_VERSION: "25.3.1" |
| 21 | + SCCACHE_VERSION: "v0.12.0" |
| 22 | + |
| 23 | +jobs: |
| 24 | + nightly-gatekeeper: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + outputs: |
| 27 | + should_skip: ${{ steps.check.outputs.should_skip }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v6.0.0 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + - name: Check for changes in last 24 hours |
| 34 | + id: check |
| 35 | + run: | |
| 36 | + # Check logs for commits in the last 24 hours on the current branch |
| 37 | + if [[ -z $(git log --since="24 hours ago" --pretty=format:"%H") ]]; then |
| 38 | + echo "No commits in the last 24 hours. Skipping..." |
| 39 | + echo "should_skip=true" >> "$GITHUB_OUTPUT" |
| 40 | + else |
| 41 | + echo "New commits found. Proceeding..." |
| 42 | + echo "should_skip=false" >> "$GITHUB_OUTPUT" |
| 43 | + fi |
| 44 | +
|
| 45 | + mutation-testing: |
| 46 | + needs: nightly-gatekeeper |
| 47 | + if: ${{ needs.nightly-gatekeeper.outputs.should_skip != 'true' }} |
| 48 | + runs-on: ubuntu-latest |
| 49 | + env: |
| 50 | + SCCACHE_GHA_ENABLED: "true" |
| 51 | + RUSTC_WRAPPER: "sccache" |
| 52 | + steps: |
| 53 | + # prep |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v6.0.0 |
| 56 | + - name: Start sccache |
| 57 | + uses: mozilla-actions/sccache-action@v0.0.9 |
| 58 | + with: |
| 59 | + version: ${{ env.SCCACHE_VERSION }} |
| 60 | + - name: Install Rust |
| 61 | + uses: actions-rust-lang/setup-rust-toolchain@v1.15.2 |
| 62 | + with: |
| 63 | + toolchain: ${{ env.RUST_LATEST }} |
| 64 | + components: clippy, rustfmt |
| 65 | + - name: Install Cargo Tools |
| 66 | + uses: taiki-e/install-action@v2.62.53 |
| 67 | + with: |
| 68 | + tool: cargo-mutants@${{ env.CARGO_MUTANTS_VERSION }} |
| 69 | + |
| 70 | + # execute |
| 71 | + - name: Mutate All |
| 72 | + env: |
| 73 | + DISABLE_T_REX: 1 |
| 74 | + timeout-minutes: 90 |
| 75 | + run: cargo mutants --test-workspace=true --colors=never --jobs=1 --build-timeout=120 |
| 76 | + |
| 77 | + - name: Create Issue on Failure |
| 78 | + if: failure() |
| 79 | + env: |
| 80 | + GH_TOKEN: ${{ github.token }} |
| 81 | + run: | |
| 82 | + gh issue create \ |
| 83 | + --title "🚨 Nightly Build Failed: $(date +'%Y-%m-%d')" \ |
| 84 | + --body "The nightly scheduled build failed. Please check the logs here: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ |
| 85 | + --label "bug" |
0 commit comments