Skip to content

Re-work test caching - #628

Merged
d-chambers merged 1 commit into
masterfrom
ci_cache_2
Mar 16, 2026
Merged

Re-work test caching#628
d-chambers merged 1 commit into
masterfrom
ci_cache_2

Conversation

@d-chambers

@d-chambers d-chambers commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR simplifies previous changes to test data caching (eg in #626). It is now part of the mamba env setup, and uses DASCore's exact caching machinery to avoid cache misses and un-configured envs, which was the issue before.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Summary by CodeRabbit

  • New Features

    • Integrated test data preparation directly into the installation workflow for streamlined caching and improved CI/CD efficiency.
  • Tests

    • Added test coverage for cache metadata validation and key generation.
  • Chores

    • Simplified GitHub Actions workflows by consolidating test data caching into the installation step across multiple pipeline configurations.

@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR refactors test data caching in CI workflows by consolidating functionality from a standalone GitHub Action into the mamba-install-dascore action. The dedicated cache-test-data action is removed and replaced with a new prepare-test-data input parameter. Supporting utilities for cache metadata management are added to the downloader module, and all affected workflows are updated to use the new approach.

Changes

Cohort / File(s) Summary
Removed Standalone Caching Action
.github/actions/cache-test-data/action.yml
Entire GitHub Actions workflow file for test data caching is removed, eliminating the separate cache action.
Enhanced Mamba Installation Action
.github/actions/mamba-install-dascore/action.yml
Adds new prepare-test-data input (defaults to false) and replaces single cache action step with conditional steps for exporting cache environment variables, restoring, priming, and saving cache based on the input flag.
Cache Management Scripts
.github/scripts/cache_test_data.py, .github/scripts/export_test_data_cache_env.py
Updates import path handling in cache_test_data.py; introduces new export_test_data_cache_env.py script that outputs cache metadata as KEY=VALUE pairs for GitHub Actions env files.
Test Data Cache Utilities
dascore/utils/downloader.py, tests/test_utils/test_downloader.py
Adds TestDataCacheInfo frozen dataclass with cache metadata fields and get_key() method, plus get_test_data_cache_info() function for retrieving cache information; includes corresponding unit tests.
Workflow Updates
.github/workflows/build_deploy_master_docs.yaml, build_deploy_stable_docs.yaml, get_coverage.yml, profile.yml, run_min_dep_tests.yml, runtests.yml, test_doc_build.yml
Replaces dedicated cache-test-data action steps with prepare-test-data: "true" input to mamba-install-dascore action across all workflows.

Possibly related PRs

Suggested labels

CI

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Re-work test caching' directly relates to the main objective of the PR, which is to simplify and restructure how test data caching works in the CI workflows.
Description check ✅ Passed The description addresses the problem being solved (simplifying test caching from PR #626) and explains the solution (integrating caching into mamba setup using DASCore's machinery), but most checklist items remain unchecked.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci_cache_2
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the CI continuous integration label Mar 16, 2026
@codecov

codecov Bot commented Mar 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.93%. Comparing base (6d927bc) to head (74028e2).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #628      +/-   ##
==========================================
+ Coverage   99.49%   99.93%   +0.44%     
==========================================
  Files         135      135              
  Lines       11570    11584      +14     
==========================================
+ Hits        11511    11576      +65     
+ Misses         59        8      -51     
Flag Coverage Δ
unittests 99.93% <100.00%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/actions/mamba-install-dascore/action.yml:
- Around line 77-84: The "export test data cache env" step always runs; gate it
behind the prepare-test-data input so it only runs when test data prep is
enabled: add an if conditional like if: ${{ inputs.prepare-test-data == 'true'
}} to the step (the one running python
.github/scripts/export_test_data_cache_env.py) so the step executes only when
the prepare-test-data input is true and is skipped otherwise.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52b523d8-f7c1-494a-8e7b-d13221a3394e

📥 Commits

Reviewing files that changed from the base of the PR and between 293a00f and 74028e2.

📒 Files selected for processing (13)
  • .github/actions/cache-test-data/action.yml
  • .github/actions/mamba-install-dascore/action.yml
  • .github/scripts/cache_test_data.py
  • .github/scripts/export_test_data_cache_env.py
  • .github/workflows/build_deploy_master_docs.yaml
  • .github/workflows/build_deploy_stable_docs.yaml
  • .github/workflows/get_coverage.yml
  • .github/workflows/profile.yml
  • .github/workflows/run_min_dep_tests.yml
  • .github/workflows/runtests.yml
  • .github/workflows/test_doc_build.yml
  • dascore/utils/downloader.py
  • tests/test_utils/test_downloader.py
💤 Files with no reviewable changes (1)
  • .github/actions/cache-test-data/action.yml

Comment on lines +77 to +84
- name: export test data cache env
shell: bash -el {0}
env:
INPUT_CACHE_NUMBER: ${{ inputs.cache-number }}
RUNNER_OS: ${{ runner.os }}
run: |
python .github/scripts/export_test_data_cache_env.py >> "$GITHUB_ENV"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Gate cache env export behind prepare-test-data.

The step at Line 77 always runs, even when prepare-test-data is "false". That makes the flag partially ineffective and can introduce avoidable failures/overhead in jobs that explicitly disable test-data prep.

Suggested fix
     - name: export test data cache env
+      if: "${{ inputs.prepare-test-data == 'true' }}"
       shell: bash -el {0}
       env:
         INPUT_CACHE_NUMBER: ${{ inputs.cache-number }}
         RUNNER_OS: ${{ runner.os }}
       run: |
         python .github/scripts/export_test_data_cache_env.py >> "$GITHUB_ENV"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: export test data cache env
shell: bash -el {0}
env:
INPUT_CACHE_NUMBER: ${{ inputs.cache-number }}
RUNNER_OS: ${{ runner.os }}
run: |
python .github/scripts/export_test_data_cache_env.py >> "$GITHUB_ENV"
- name: export test data cache env
if: "${{ inputs.prepare-test-data == 'true' }}"
shell: bash -el {0}
env:
INPUT_CACHE_NUMBER: ${{ inputs.cache-number }}
RUNNER_OS: ${{ runner.os }}
run: |
python .github/scripts/export_test_data_cache_env.py >> "$GITHUB_ENV"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/actions/mamba-install-dascore/action.yml around lines 77 - 84, The
"export test data cache env" step always runs; gate it behind the
prepare-test-data input so it only runs when test data prep is enabled: add an
if conditional like if: ${{ inputs.prepare-test-data == 'true' }} to the step
(the one running python .github/scripts/export_test_data_cache_env.py) so the
step executes only when the prepare-test-data input is true and is skipped
otherwise.

@d-chambers
d-chambers merged commit 392fd32 into master Mar 16, 2026
26 checks passed
@d-chambers
d-chambers deleted the ci_cache_2 branch March 16, 2026 09:58
@coderabbitai coderabbitai Bot mentioned this pull request Jul 27, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant