-
Notifications
You must be signed in to change notification settings - Fork 40
Fix codspeed #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix codspeed #620
Changes from all commits
3221bb9
b5e05fa
1020394
e7cfa27
8c4ac64
abef7ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| """Populate the pooch cache with every file in dascore's data registry.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from dascore.utils.downloader import fetch, get_registry_df | ||
|
|
||
|
|
||
| def main() -> None: | ||
| """Fetch every registered test-data file into the local pooch cache.""" | ||
| registry = get_registry_df() | ||
| total = len(registry) | ||
| print(f"Priming DASCore test-data cache with {total} files") # noqa | ||
| for index, name in enumerate(registry["name"], start=1): | ||
| path = Path(fetch(name)) | ||
| print(f"[{index}/{total}] {name} -> {path}") # noqa | ||
| print("Finished priming DASCore test-data cache") # noqa | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: PrimeTestDataCache | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: "0 4 * * 1" | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "dascore/data_registry.txt" | ||
| - ".github/actions/cache-test-data/action.yml" | ||
| - ".github/scripts/cache_test_data.py" | ||
| - ".github/workflows/prime_test_data_cache.yml" | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "dascore/data_registry.txt" | ||
| - ".github/actions/cache-test-data/action.yml" | ||
| - ".github/scripts/cache_test_data.py" | ||
| - ".github/workflows/prime_test_data_cache.yml" | ||
|
|
||
| jobs: | ||
| prime_test_data_cache: | ||
| name: Prime shared test data cache | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: ./.github/actions/load-shared-vars | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ env.PYTHON_DEFAULT }} | ||
|
|
||
| - name: Install dascore | ||
| shell: bash | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e . | ||
|
|
||
| # The cache key is shared across OSes. Each consuming job restores this | ||
| # archive into the platform-specific cache path that pooch uses locally. | ||
| - uses: ./.github/actions/cache-test-data | ||
| id: cache-test-data | ||
| with: | ||
| mode: restore | ||
|
|
||
| - name: Download all registered test data | ||
| if: steps.cache-test-data.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| run: python .github/scripts/cache_test_data.py | ||
|
|
||
| - name: Save primed test data cache | ||
| if: steps.cache-test-data.outputs.cache-hit != 'true' | ||
| uses: ./.github/actions/cache-test-data | ||
| with: | ||
| mode: save |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,15 +6,24 @@ on: | |
| branches: | ||
| - master | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
| - labeled | ||
| - unlabeled | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read # required for actions/checkout | ||
| id-token: write # required for OIDC authentication with CodSpeed | ||
|
|
||
| jobs: | ||
| benchmarks: | ||
| name: Run benchmarks | ||
| prime_test_data_cache: | ||
| name: Prime test data cache | ||
| if: > | ||
| github.event_name != 'pull_request' || | ||
| contains(github.event.pull_request.labels.*.name, 'benchmark') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
@@ -26,18 +35,57 @@ jobs: | |
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| # Defined in .github/actions/load-shared-vars/action.yml | ||
| python-version: ${{ env.PYTHON_DEFAULT }} | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install ".[profile]" | ||
| - name: Install dascore for cache priming | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e . | ||
|
|
||
| - uses: ./.github/actions/cache-test-data | ||
| id: cache-test-data | ||
| with: | ||
| mode: restore | ||
| cache-number: 1 | ||
|
|
||
| - name: Download all registered test data | ||
| if: steps.cache-test-data.outputs.cache-hit != 'true' | ||
| run: python .github/scripts/cache_test_data.py | ||
|
|
||
| - name: Save primed test data cache | ||
| if: steps.cache-test-data.outputs.cache-hit != 'true' | ||
| uses: ./.github/actions/cache-test-data | ||
| with: | ||
| mode: save | ||
| cache-number: 1 | ||
|
|
||
| benchmarks: | ||
| name: Run benchmarks | ||
| if: > | ||
| github.event_name != 'pull_request' || | ||
| contains(github.event.pull_request.labels.*.name, 'benchmark') | ||
| needs: prime_test_data_cache | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-tags: "true" | ||
| fetch-depth: '0' | ||
|
|
||
| - uses: ./.github/actions/load-shared-vars | ||
|
|
||
| - uses: ./.github/actions/mamba-install-dascore | ||
| with: | ||
| # Defined in .github/actions/load-shared-vars/action.yml | ||
| python-version: ${{ env.PYTHON_DEFAULT }} | ||
| install-group-str: "[profile]" | ||
| cache-number: 1 | ||
|
|
||
|
Comment on lines
+62
to
83
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing test data cache restore in benchmarks job. The Add a step to restore the test data cache before running benchmarks: 🔧 Proposed fix to add cache restore - uses: ./.github/actions/load-shared-vars
+ - uses: ./.github/actions/cache-test-data
+ with:
+ mode: restore
+ cache-number: 1
+
- uses: ./.github/actions/mamba-install-dascore
with:🧰 Tools🪛 actionlint (1.7.11)[error] 65-65: could not parse action metadata in "/home/jailuser/git/.github/actions/mamba-install-dascore": line 4: unexpected key "type" for definition of input "install-package" (action) 🤖 Prompt for AI Agents |
||
| - name: Run benchmarks | ||
| uses: CodSpeedHQ/action@v4 | ||
| with: | ||
| mode: instrumentation | ||
| run: ./.github/test_code.sh profile | ||
| mode: simulation | ||
| # CodSpeed does not inherit the shell activation done by the | ||
| # micromamba setup step, so run benchmarks explicitly inside the | ||
| # dascore environment to ensure pytest and pytest-codspeed resolve. | ||
| run: micromamba run -n dascore ./.github/test_code.sh profile | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ on: | |
| - 'pyproject.toml' | ||
| - '**.py' | ||
| - '.github/workflows/run_min_dep_tests.yml' | ||
| - '.github/actions/**/*.yml' | ||
|
|
||
| env: | ||
| # Ensure matplotlib doesn't try to show figures in CI | ||
|
|
@@ -35,8 +36,47 @@ jobs: | |
| id: load-vars | ||
|
|
||
| # Runs the tests on combinations of the supported python/os matrix. | ||
| test_code_min_deps: | ||
| prime_test_data_cache: | ||
| needs: setup | ||
|
Comment on lines
+39
to
40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Like the main test workflow, the added Useful? React with 👍 / 👎. |
||
| timeout-minutes: 20 | ||
| if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no_ci') | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: ./.github/actions/load-shared-vars | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ env.PYTHON_DEFAULT }} | ||
|
|
||
| - name: Install dascore for cache priming | ||
| shell: bash | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e . | ||
|
|
||
| - uses: ./.github/actions/cache-test-data | ||
| id: cache-test-data | ||
| with: | ||
| mode: restore | ||
| cache-number: 1 | ||
|
|
||
| - name: Download all registered test data | ||
| if: steps.cache-test-data.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| run: python .github/scripts/cache_test_data.py | ||
|
|
||
| - name: Save primed test data cache | ||
| if: steps.cache-test-data.outputs.cache-hit != 'true' | ||
| uses: ./.github/actions/cache-test-data | ||
| with: | ||
| mode: save | ||
| cache-number: 1 | ||
|
|
||
| test_code_min_deps: | ||
| needs: [setup, prime_test_data_cache] | ||
| timeout-minutes: 25 | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.