nightly #69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: nightly | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| nightly-gatekeeper: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_skip: ${{ steps.check.outputs.should_skip }} | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for changes in last 24 hours | |
| run: | | |
| # Check logs for commits in the last 24 hours on the current branch | |
| if [[ -z $(git log --since="24 hours ago" --pretty=format:"%H") ]]; then | |
| echo "No commits in the last 24 hours. Skipping..." | |
| echo "should_skip=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "New commits found. Proceeding..." | |
| echo "should_skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| mutation-testing: | |
| needs: [nightly-gatekeeper] | |
| if: ${{ needs.nightly-gatekeeper.outputs.should_skip != 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| # prep | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.1 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| with: | |
| enable-sccache: true | |
| enable-wild-linker: true | |
| rust-toolchain: RUST_NIGHTLY | |
| cargo-tools: CARGO_MUTANTS_VERSION | |
| # execute | |
| - name: Mutate All | |
| run: cargo +${{ env.RUST_NIGHTLY }} -Zscript scripts/mutants.rs | |
| - name: Create or Update Issue on Failure | |
| if: failure() | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| ISSUE_TITLE="🚨 Nightly Build Failed" | |
| ISSUE_DATE="$(date +'%Y-%m-%d')" | |
| ISSUE_FULL_TITLE="$ISSUE_TITLE: $ISSUE_DATE" | |
| ISSUE_BODY="The nightly scheduled build failed. Please check the logs here: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | |
| # Search for open issues with the same base title and label | |
| EXISTING_ISSUE=$(gh issue list --label "bug" --state open --search "$ISSUE_TITLE" --json number,title | jq -r '.[] | select(.title | startswith("'"$ISSUE_TITLE"'")) | .number' | head -n 1) | |
| if [[ -n "$EXISTING_ISSUE" ]]; then | |
| # Add a comment to the existing issue | |
| gh issue comment "$EXISTING_ISSUE" --body "$ISSUE_BODY" | |
| else | |
| # Create a new issue | |
| gh issue create \ | |
| --title "$ISSUE_FULL_TITLE" \ | |
| --body "$ISSUE_BODY" \ | |
| --label "bug" | |
| fi |