Build & Test libflux with upcoming Rust release #16
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: Build & Test libflux with upcoming Rust release | |
| on: | |
| schedule: | |
| - cron: "0 3 * * 0" # Run at 03:00 every Sunday | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| permissions: | |
| issues: write | |
| runs-on: | |
| group: self-hosted | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| rust-version: "beta" | |
| - name: libflux build | |
| working-directory: ./libflux | |
| run: cargo +beta build --workspace --all-features --all-targets --verbose | |
| - name: libflux test | |
| working-directory: ./libflux | |
| run: cargo +beta test --workspace --all-features --all-targets --verbose | |
| - name: libflux lint | |
| working-directory: ./libflux | |
| run: cargo +beta clippy --workspace --all-features --all-targets --verbose -- -Dclippy::all -Dclippy::undocumented_unsafe_blocks | |
| - name: Create issue on failure | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const title = 'libflux build failed with Rust beta'; | |
| const body = `The scheduled build of libflux with Rust beta has failed. | |
| **Workflow run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId} | |
| Please investigate and fix any compatibility issues before the next stable Rust release.`; | |
| // Check for existing open issue with same title | |
| const issues = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| labels: 'rust-beta-failure' | |
| }); | |
| const existingIssue = issues.data.find(issue => issue.title === title); | |
| if (existingIssue) { | |
| // Add comment to existing issue | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: existingIssue.number, | |
| body: `Another failure occurred.\n\n**Workflow run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
| }); | |
| } else { | |
| // Create new issue | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| body: body, | |
| labels: ['rust-beta-failure'] | |
| }); | |
| } |