Test forecast #3
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: Seed-cache-and-test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| env: | |
| DATA_DIR: tests/data # lives inside the checkout | |
| URL_1: https://github.com/isaacaka/test_releases/releases/download/v1.test.data/DINO_1m_To_1y_grid_T.nc | |
| URL_2: https://github.com/isaacaka/test_releases/releases/download/v1.test.data/DINO_1y_grid_T.nc | |
| DATA_VER: v1 # bump when the files change | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # 1️ Try to restore a cache blob named ncdat-<DATA_VER> | |
| - name: Restore NetCDF cache | |
| id: cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ env.DATA_DIR }} | |
| key: ncdat-${{ env.DATA_VER }} | |
| # 2 Download only if the cache wasn't found | |
| - name: Download NetCDFs (if cache miss) | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p "$DATA_DIR" | |
| wget --quiet --continue -P "$DATA_DIR" "$URL_1" "$URL_2" | |
| # 3 Save the freshly downloaded files so later jobs reuse them | |
| - name: Save NetCDF cache | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ env.DATA_DIR }} | |
| key: ncdat-${{ env.DATA_VER }} | |
| - name: Run tests | |
| run: pytest |