Skip to content

Nightly (live API)

Nightly (live API) #40

Workflow file for this run

name: Nightly (live API)
# Runs the live-API tests (those marked `@pytest.mark.live`) on a daily
# cron so real NOAA API drift is caught without making PR CI flaky.
#
# On failure, opens a GitHub issue so the maintainer sees it next time
# they check the repo; on subsequent failures the same issue is
# annotated rather than duplicated.
on:
schedule:
# 06:00 UTC daily — after NOAA's typical late-evening data drops.
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
live-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- run: uv sync --locked --all-extras --group dev
- name: Run live-only tests against NOAA
id: live
run: uv run pytest -m live -v
- name: Open/update issue on failure
if: failure()
uses: actions/github-script@v9
with:
script: |
const title = 'Nightly live-API tests failed';
const body = [
'The daily live-API canary detected a NOAA drift or outage.',
'',
`Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
'',
'Investigate by running `uv run pytest -m live` locally and',
're-recording cassettes with `--record-mode=rewrite` if the',
'drift is permanent.',
].join('\n');
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'nightly-canary',
});
const existing = issues.find(i => i.title === title);
if (existing) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existing.number,
body: `Another nightly failure: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
labels: ['nightly-canary'],
});
}