Skip to content

Commit 5d1a8b4

Browse files
authored
CI: Set environment cache key based on current week of year to avoid outdated cache in the "Setup Micromamba" step (#3234)
1 parent 4e364bb commit 5d1a8b4

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.github/workflows/ci_docs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ jobs:
7474
# fetch all history so that setuptools-scm works
7575
fetch-depth: 0
7676

77+
- name: Get current week number of year
78+
id: date
79+
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19
80+
7781
# Install Micromamba with conda-forge dependencies
7882
- name: Setup Micromamba
7983
uses: mamba-org/setup-micromamba@v1.8.1
@@ -85,6 +89,8 @@ jobs:
8589
- nodefaults
8690
cache-downloads: false
8791
cache-environment: true
92+
# environment cache is persistent for one week.
93+
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
8894
create-args: >-
8995
python=3.12
9096
gmt=6.5.0

.github/workflows/ci_tests.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ jobs:
9999
# fetch all history so that setuptools-scm works
100100
fetch-depth: 0
101101

102+
- name: Get current week number of year
103+
id: date
104+
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19
105+
102106
# Install Micromamba with conda-forge dependencies
103107
- name: Setup Micromamba
104108
uses: mamba-org/setup-micromamba@v1.8.1
@@ -110,6 +114,8 @@ jobs:
110114
- nodefaults
111115
cache-downloads: false
112116
cache-environment: true
117+
# environment cache is persistent for one week.
118+
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
113119
create-args: >-
114120
python=${{ matrix.python-version }}${{ matrix.optional-packages }}
115121
gmt=6.5.0

.github/workflows/ci_tests_dev.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ jobs:
5252
# fetch all history so that setuptools-scm works
5353
fetch-depth: 0
5454

55+
- name: Get current week number of year
56+
id: date
57+
run: echo "date=$(date +%Y-W%W)" >> $GITHUB_OUTPUT # e.g., 2024-W19
58+
5559
# Install Micromamba with conda-forge dependencies
5660
- name: Setup Micromamba
5761
uses: mamba-org/setup-micromamba@v1.8.1
@@ -63,6 +67,8 @@ jobs:
6367
- nodefaults
6468
cache-downloads: false
6569
cache-environment: true
70+
# environment cache is persistent for one week.
71+
cache-environment-key: micromamba-environment-${{ steps.date.outputs.date }}
6672
create-args: >-
6773
python=3.12
6874
cmake

.github/workflows/ci_tests_legacy.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ jobs:
5858
channels:
5959
- conda-forge
6060
- nodefaults
61-
cache-downloads: false
62-
cache-environment: true
6361
create-args: >-
6462
python=3.10
6563
gmt=${{ matrix.gmt_version }}

0 commit comments

Comments
 (0)