Cache dependencies #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preamble | |
name: Cache dependencies | |
on: | |
schedule: | |
- cron: '0 9 * * 1' # run every monday @ 9AM | |
# enable worflow to be run manually | |
workflow_dispatch: | |
env: | |
CACHE_NUMBER: 0 | |
jobs: | |
cache-build-dependencies: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
MPI: no | |
OMP: no | |
PHDF5: no | |
DAGMC: no | |
EVENT: no | |
VECTFIT: no | |
LIBMESH: no | |
steps: | |
- uses: actions/checkout@v3 | |
## TESTING CACHE ## | |
# Setup conda | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge # mamba is faster than base conda | |
miniforge-version: latest | |
activate-environment: saltproc-env | |
use-mamba: true | |
use-only-tar-bz2: true | |
- run: | | |
conda config --env --set pip_interop_enabled True | |
# check for existing cache | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
id: dependencies-cache | |
with: | |
path: | | |
/usr/share/miniconda3/envs/saltproc-env | |
~/openmc_src | |
~/endfb71_hdf5 | |
~/.cache/pip | |
key: depcache-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
# Install dependencies | |
- name: Update environment | |
run: mamba env update -n saltproc-env -f environment.yml | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
- name: Install OpenMC cross section library | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
run: $GITHUB_WORKSPACE/scripts/ci/openmc-xs.bash | |
- name: OpenMC dependencies | |
run: | | |
sudo apt -y update | |
sudo apt install -y libhdf5-dev | |
- name: Download OpenMC | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v3 | |
with: | |
repository: openmc-dev/openmc | |
path: openmc | |
submodules: recursive | |
- name: Build OpenMC from source if no cache if found | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
run: $GITHUB_WORKSPACE/tools/ci/build-openmc.sh | |
- name: Restore OpenMC source build from cache | |
if: steps.dependencies-cache.outputs.cache-hit == 'true' | |
run: $GITHUB_WORKSPACE/tools/ci/restore-openmc.sh | |
- name: Install SaltProc | |
run: pip install . | |
- name: Check packages | |
run: conda list | |
cache-doc-dependencies: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
## DOCUMENTATION CACHE ## | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge # mamba is faster than base conda | |
miniforge-version: latest | |
activate-environment: saltproc-doc-env | |
use-mamba: true | |
use-only-tar-bz2: true | |
- run: | | |
conda config --env --set pip_interop_enabled True | |
# check for existing cache | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
id: dependencies-cache | |
with: | |
path: | | |
/usr/share/miniconda3/envs/saltproc-doc-env | |
~/.cache/pip | |
key: depcache-${{ hashFiles('doc/doc-environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
# Install dependencies | |
- name: Update environment | |
run: mamba env update -n saltproc-doc-env -f doc/doc-environment.yml | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
- name: Download OpenMC | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
uses: actions/checkout@v3 | |
with: | |
repository: openmc-dev/openmc | |
path: openmc | |
- name: Build OpenMC API | |
if: steps.dependencies-cache.outputs.cache-hit != 'true' | |
run: | | |
cd openmc | |
pip install . | |
cd ../ | |
- name: Install SaltProc | |
run: pip install . | |
- name: Check packages | |
run: conda list |