Skip to content

Commit

Permalink
CI: Set environment cache key based on current week of year to avoid …
Browse files Browse the repository at this point in the history
…outdated cache in the "Setup Micromamba" step (#3234)
  • Loading branch information
seisman committed May 12, 2024
1 parent 4e364bb commit 5d1a8b4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci_docs.yml
Expand Up @@ -74,6 +74,10 @@ jobs:
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1.8.1
Expand All @@ -85,6 +89,8 @@ jobs:
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
python=3.12
gmt=6.5.0
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci_tests.yaml
Expand Up @@ -99,6 +99,10 @@ jobs:
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1.8.1
Expand All @@ -110,6 +114,8 @@ jobs:
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
python=${{ matrix.python-version }}${{ matrix.optional-packages }}
gmt=6.5.0
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci_tests_dev.yaml
Expand Up @@ -52,6 +52,10 @@ jobs:
# fetch all history so that setuptools-scm works
fetch-depth: 0

- name: Get current week number of year
id: date
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19

# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1.8.1
Expand All @@ -63,6 +67,8 @@ jobs:
- nodefaults
cache-downloads: false
cache-environment: true
# environment cache is persistent for one week.
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
create-args: >-
python=3.12
cmake
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci_tests_legacy.yaml
Expand Up @@ -58,8 +58,6 @@ jobs:
channels:
- conda-forge
- nodefaults
cache-downloads: false
cache-environment: true
create-args: >-
python=3.10
gmt=${{ matrix.gmt_version }}
Expand Down

0 comments on commit 5d1a8b4

Please sign in to comment.