Skip to content

Commit 271fc4a

Browse files
committed
[DEVOPS-584] pass cache number to shared actions
1 parent 7653b65 commit 271fc4a

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

.github/actions/reusable-python-setup_conda/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Setup conda env
22
description: Setup conda environment for Python
33
inputs:
4+
cache-number:
5+
description: 'Cache number to reset cache if pixi.lock has not changed'
6+
required: true
7+
type: number
48
python-version:
59
description: 'Python version to use'
610
required: true
@@ -32,6 +36,7 @@ runs:
3236
micromamba-version: ${{ env.micromamba_version }}
3337
init-shell: bash
3438
cache-downloads: true
39+
cache-downloads-key: micromamba-dl${{ inputs.cache-number }}
3540
environment-name: ""
3641
post-cleanup: none
3742
- name: Authenticate to Artifactory
@@ -47,6 +52,7 @@ runs:
4752
environment-name: test_env
4853
init-shell: bash
4954
cache-downloads: true
55+
cache-downloads-key: micromamba-dl${{ inputs.cache-number }}
5056
post-cleanup: none
5157
env:
5258
PYTHONUTF8: 1

.github/actions/reusable-python-setup_pixi/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ runs:
1616
- uses: prefix-dev/setup-pixi@v0.9.0
1717
with:
1818
pixi-version: v0.54.1
19-
cache-key: K{{ inputs.cache-number }}-
19+
cache-key: pixi-env{{ inputs.cache-number }}
2020
cache: true
2121
locked: true
2222
env:

.github/workflows/reusable-python-pytest.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ jobs:
8787
with:
8888
python-version: ${{ matrix.python-version }}
8989

90-
- uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-setup_conda@main
90+
- uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-setup_conda@DEVOPS-584
9191
name: Setup conda env
9292
if: ${{ inputs.package-manager == 'conda' }}
9393
with:
94+
cache-number: ${{ inputs.cache-number }}
9495
python-version: ${{ matrix.python-version }}
9596
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
9697
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
@@ -117,6 +118,7 @@ jobs:
117118
with:
118119
python-version: ${{ inputs.python-version }}
119120
runner-os: ${{ runner.os }}
121+
cache-number: ${{ inputs.cache-number }}
120122

121123
- name: Run Pytest
122124
run: |

.github/workflows/reusable-python-static_analysis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ jobs:
7373
with:
7474
python-version: ${{inputs.python-version}}
7575

76-
- uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-setup_conda@main
76+
- uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-setup_conda@DEVOPS-584
7777
name: Setup conda env
7878
if: ${{ inputs.package-manager == 'conda' }}
7979
with:
80+
cache-number: ${{ inputs.cache-number }}
8081
python-version: ${{ inputs.python-version }}
8182
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
8283
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
@@ -85,7 +86,7 @@ jobs:
8586
name: Setup poetry env
8687
if: ${{ inputs.package-manager == 'poetry' }}
8788
with:
88-
cache-number: 1
89+
cache-number: ${{ inputs.cache-number }}
8990
runner-os: ${{ runner.os }}
9091
install-extras: ${{ inputs.install-extras }}
9192
virtual-repo-names: ${{ inputs.virtual-repo-names }}
@@ -95,14 +96,15 @@ jobs:
9596
name: Setup hatch env
9697
if: ${{ inputs.package-manager == 'hatch' }}
9798
with:
98-
cache-number: 1
99+
cache-number: ${{ inputs.cache-number }}
99100
runner-os: ${{ runner.os }}
100101
- uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-setup_pixi@DEVOPS-584
101102
name: Setup pixi env
102103
if: ${{ inputs.package-manager == 'pixi' }}
103104
with:
104105
python-version: ${{ inputs.python-version }}
105106
runner-os: ${{ runner.os }}
107+
cache-number: ${{ inputs.cache-number }}
106108

107109
- name: Capture modified files
108110
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)