Skip to content

Commit 35470b6

Browse files
authored
Cache Conda in CI (#74)
* Cache Conda in actions * Cache hit check * Make cache path a config
1 parent 8752273 commit 35470b6

File tree

2 files changed

+36
-664
lines changed

2 files changed

+36
-664
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,25 @@ jobs:
3737
activate-environment: pdal-java
3838
channels: conda-forge
3939

40+
- name: Conda cache config
41+
id: cache-config
42+
run: |
43+
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
44+
echo "path=$CONDA/envs/pdal-java" >> $GITHUB_OUTPUT
45+
shell: bash
46+
47+
- name: Cache Conda env
48+
uses: actions/cache@v3
49+
with:
50+
path: ${{ steps.cache-config.outputs.path }}
51+
key:
52+
conda-pdal-java-${{ runner.os }}--${{ runner.arch }}--${{ steps.cache-config.outputs.today }}-${{ matrix.pdal }}-${{ env.CACHE_NUMBER }}
53+
env:
54+
CACHE_NUMBER: 0
55+
id: conda-cache
56+
4057
- name: Install PDAL
58+
if: steps.conda-cache.outputs.cache-hit != 'true'
4159
run: conda install pdal=${{ matrix.pdal }}
4260

4361
- name: Set LD_LIBRARY_PATH
@@ -87,7 +105,25 @@ jobs:
87105
activate-environment: pdal-java
88106
channels: conda-forge
89107

108+
- name: Conda cache config
109+
id: cache-config
110+
run: |
111+
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
112+
echo "path=$CONDA/envs/pdal-java" >> $GITHUB_OUTPUT
113+
shell: bash
114+
115+
- name: Cache Conda env
116+
uses: actions/cache@v3
117+
with:
118+
path: ${{ steps.cache-config.outputs.path }}
119+
key:
120+
conda-pdal-java-${{ runner.os }}--${{ runner.arch }}--${{ steps.cache-config.outputs.today }}-${{ matrix.pdal }}-${{ env.CACHE_NUMBER }}
121+
env:
122+
CACHE_NUMBER: 0
123+
id: conda-cache
124+
90125
- name: Install PDAL
126+
if: steps.conda-cache.outputs.cache-hit != 'true'
91127
run: conda install pdal=${{ matrix.pdal }}
92128

93129
- name: Set LD_LIBRARY_PATH

0 commit comments

Comments
 (0)