Skip to content

ENH: Cache the test data in CI - #134

Open
demianw wants to merge 1 commit into
masterfrom
ci-cache-test-data
Open

demianw wants to merge 1 commit into
masterfrom
ci-cache-test-data

Conversation

@demianw

@demianw demianw commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Every test job downloads the test dataset (~30 MB) from OSF (tract_querier/tests/datasets.py). With many PRs running CI at once, OSF starts refusing the downloads: the open PRs #123, #124 and #125 fail in 2–5 jobs each with urllib.error.HTTPError: HTTP Error 403: Forbidden in test_tract_math.py, unrelated to their changes. The same files download fine when requested individually.

Change

.github/workflows/test_package.yaml: add an actions/cache step for the download directory (tempfile.gettempdir()/tract_querier, i.e. /tmp/tract_querier on the Ubuntu runners), keyed on the hash of tract_querier/tests/datasets.py, so the key changes whenever the dataset URLs or checksums change. datasets.py already skips files whose MD5 matches, so a restored cache means no download at all.

Merge order

Merge this early. pull_request runs test the PR merged into the current master, so once this is on master (and a master run has saved the cache), re-running the failed jobs of the open PRs picks up the cache without rebasing them.

Testing

  • Workflow YAML parses and the step order is as intended (cache restored before the tests run).
  • The cache path matches the download directory used by datasets.py (tempfile.gettempdir(), /tmp on the runners).
  • The cache behaviour itself can only be observed in this PR's CI run.

🤖 Generated with Claude Code

Every test job downloads the test dataset (~30 MB) from OSF. With many
jobs running at once OSF starts refusing the downloads with HTTP 403,
which makes the test runs fail for reasons unrelated to the change being
tested. Keep the downloaded files (tempfile.gettempdir()/tract_querier,
i.e. /tmp/tract_querier on the runners) in the Actions cache, keyed on
the dataset definitions in tract_querier/tests/datasets.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant