Skip to content

Commit 8008cad

Browse files
authored
Merge pull request #11 from scientificcomputing/cache-conda
try enabling conda package caching
2 parents db267b1 + d7a3a23 commit 8008cad

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ inputs:
1010
runs:
1111
using: composite
1212
steps:
13+
# cache ref https://github.com/conda-incubator/setup-miniconda#caching-packages
14+
1315
- name: Setup conda-forge
1416
uses: conda-incubator/setup-miniconda@v2
1517
with:
@@ -18,23 +20,26 @@ runs:
1820
activate-environment: mpi-tutorial
1921
python-version: ${{ inputs.python-version }}
2022
use-mamba: true
21-
environment-file: environment.yml
23+
# uncomment to install env in one go (without caching)
24+
# environment-file: environment.yml
25+
# needed for caching
26+
use-only-tar-bz2: true
2227

23-
# - name: Prepare cache
24-
# shell: bash -el {0}
25-
# run: |
26-
# if [[ $CONDA != /opt/conda ]]; then
27-
# mkdir -p /opt/conda/
28-
# ln -s $CONDA/envs /opt/conda/envs
29-
# fi
30-
# echo CONDA=$CONDA
31-
# mamba env list
32-
33-
# - name: Environment cache
34-
# uses: actions/cache@v3
35-
# with:
36-
# path: /opt/conda/envs/mpi-tutorial
37-
# key: env-conda-mpi-tutorial-${{ inputs.python-version }}-${{ hashFiles('.github/actions/install-dependencies/*') }}
38-
# id: cache
28+
- name: Get Date
29+
id: get-date
30+
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> "$GITHUB_OUTPUT"
31+
shell: bash
3932

33+
- name: Cache conda env
34+
uses: actions/cache@v3
35+
id: cache-env
36+
with:
37+
path: ${{ env.CONDA }}/envs/mpi-tutorial
38+
key:
39+
conda-env-${{ steps.get-date.outputs.today }}-${{ inputs.python-version }}-${{ hashFiles('environment.yml') }}
4040

41+
- name: Update environment
42+
if: steps.cache-env.outputs.cache-hit != 'true'
43+
run:
44+
mamba env update -n mpi-tutorial -f environment.yml
45+
shell: bash -el {0}

.github/workflows/build_docs.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,35 @@ on:
99
env:
1010
DEB_PYTHON_INSTALL_LAYOUT: deb_system
1111

12+
defaults:
13+
run:
14+
shell: bash -el {0}
15+
1216
jobs:
1317
build-book:
1418
runs-on: ubuntu-latest
15-
19+
1620
steps:
1721

1822
- uses: actions/checkout@v3
19-
23+
2024
- name: Install common packages
2125
uses: ./.github/actions/install-dependencies
2226

2327
- name: Build the book
24-
run:
25-
conda run -n mpi-tutorial jupyter-book build . -W
28+
run:
29+
jupyter-book build . -W
30+
2631
- uses: actions/upload-artifact@v3
32+
# always upload artifact, which can include error messages
33+
if: always()
2734
with:
2835
name: documentation
2936
path: ./_build/html
3037
retention-days: 2
31-
if-no-files-found: error
38+
if-no-files-found: error
39+
40+
- name: Show error reports
41+
if: failure()
42+
run: |
43+
find _build/html/reports -type f -print -exec cat {} \;

0 commit comments

Comments
 (0)