Refresh online fixtures #15
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: Refresh online fixtures | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 6 * * 1" # weekly Monday 06:00 UTC | |
| permissions: | |
| contents: read | |
| jobs: | |
| fetch: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -e ".[dev,ml]" | |
| - name: Refresh fixtures | |
| # Downloads retry transient network errors. A couple of upstream hosts | |
| # (UCI in particular) may still be unreachable in a given week; parse, | |
| # empty, hash and permanent HTTP failures always fail the job. | |
| run: python scripts/fetch_online_fixtures.py --refresh --update-manifest --max-failures 2 | |
| - name: Verify tests (offline cache) | |
| if: always() | |
| # Live-fetch tests are marked `online`; the refresh step above already | |
| # exercised the network, so this step only checks the cached slices. | |
| run: pytest tests/test_online_datasets.py -m "not online" -q --no-cov | |
| - name: Open/refresh alert issue on failure | |
| if: failure() && github.event_name == 'schedule' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const title = "weekly online fixture refresh failing"; | |
| const body = `The scheduled online fixture refresh failed.\n\n` + | |
| `Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` + | |
| `/actions/runs/${context.runId}`; | |
| const open = await github.rest.issues.listForRepo({ | |
| ...context.repo, state: "open", labels: "nightly-failure", | |
| }); | |
| const existing = open.data.find(i => i.title === title); | |
| if (existing) { | |
| await github.rest.issues.createComment({ | |
| ...context.repo, issue_number: existing.number, body, | |
| }); | |
| } else { | |
| await github.rest.issues.create({ | |
| ...context.repo, title, body, labels: ["nightly-failure"], | |
| }); | |
| } |