|
| 1 | +name: Nightly Dependency Update |
| 2 | + |
| 3 | +# Rebuilds the crate against the latest compatible versions of its dependencies |
| 4 | +# (`cargo update`) every night. Because several dependencies are intentionally |
| 5 | +# unbounded (e.g. `windows = ">=0.61"`, `libc = ">=0.2.123"`), a newly published |
| 6 | +# version may break compilation; this job surfaces that early by opening an issue. |
| 7 | + |
| 8 | +on: |
| 9 | + schedule: |
| 10 | + # One hour after the regular nightly build so they don't run at once. |
| 11 | + - cron: '0 3 * * *' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + issues: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + test: |
| 20 | + name: Test (updated deps) |
| 21 | + runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| 22 | + |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + name: |
| 27 | + - stable |
| 28 | + - beta |
| 29 | + - nightly |
| 30 | + - macOS |
| 31 | + - Windows |
| 32 | + |
| 33 | + include: |
| 34 | + - name: beta |
| 35 | + toolchain: beta |
| 36 | + - name: nightly |
| 37 | + toolchain: nightly |
| 38 | + - name: macOS |
| 39 | + os: macOS-latest |
| 40 | + - name: Windows |
| 41 | + os: windows-latest |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout sources |
| 45 | + uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Install toolchain |
| 48 | + id: tc |
| 49 | + uses: actions-rs/toolchain@v1 |
| 50 | + with: |
| 51 | + toolchain: ${{ matrix.toolchain || 'stable' }} |
| 52 | + profile: minimal |
| 53 | + override: true |
| 54 | + |
| 55 | + # No build cache here on purpose: freshness is the whole point, a cached |
| 56 | + # target/ keyed on Cargo.toml could otherwise mask a newly published version. |
| 57 | + - name: Update dependencies to latest |
| 58 | + run: cargo update --verbose |
| 59 | + |
| 60 | + - name: Build all features |
| 61 | + if: matrix.features == '' |
| 62 | + run: cargo build --all-features |
| 63 | + |
| 64 | + - name: Test all features (other) |
| 65 | + if: matrix.features == '' && runner.os != 'Linux' |
| 66 | + run: cargo test --all-features -- --skip set_deadline_policy |
| 67 | + |
| 68 | + - name: Test all features (Linux) |
| 69 | + if: matrix.features == '' && runner.os == 'Linux' |
| 70 | + run: sudo -E /home/runner/.cargo/bin/cargo test --all-features |
| 71 | + |
| 72 | + report: |
| 73 | + name: Report failure |
| 74 | + needs: test |
| 75 | + if: failure() |
| 76 | + runs-on: ubuntu-latest |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Open or update tracking issue |
| 80 | + env: |
| 81 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 83 | + run: | |
| 84 | + set -euo pipefail |
| 85 | + label="nightly-deps" |
| 86 | +
|
| 87 | + # Make sure the label exists (no-op if it already does). |
| 88 | + gh label create "$label" --color B60205 \ |
| 89 | + --description "Nightly dependency-update build failures" || true |
| 90 | +
|
| 91 | + body="The nightly job that runs \`cargo update\` and rebuilds against the latest compatible dependency versions has **failed**. |
| 92 | +
|
| 93 | + This usually means a newly published version of an unbounded dependency (e.g. \`windows = \">=0.61\"\`, \`libc = \">=0.2.123\"\`) no longer compiles or passes the tests. Consider pinning an upper bound until it is resolved. |
| 94 | +
|
| 95 | + Failed run: $RUN_URL" |
| 96 | +
|
| 97 | + existing=$(gh issue list --state open --label "$label" --json number --jq '.[0].number // empty') |
| 98 | +
|
| 99 | + if [ -n "$existing" ]; then |
| 100 | + gh issue comment "$existing" --body "Nightly dependency update failed again: $RUN_URL" |
| 101 | + else |
| 102 | + gh issue create \ |
| 103 | + --title "Nightly dependency update broke the build" \ |
| 104 | + --label "$label" \ |
| 105 | + --body "$body" |
| 106 | + fi |
0 commit comments