Skip to content

Commit

Permalink
Run in container
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-kaplan committed Apr 25, 2023
1 parent c914f22 commit 755b9f4
Showing 1 changed file with 8 additions and 42 deletions.
50 changes: 8 additions & 42 deletions .github/workflows/fbf-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,35 @@ on:
pull_request:
workflow_dispatch:
env:
CONDA_TYPE: Mambaforge
CONDA_VERSION: 23.1.0-1
CONDA_IMAGE: condaforge/mambaforge:23.1.0-1
CONDA_PATH: /opt/conda
CONDA_CACHEBUST: 1
FBF_ENV_CACHEBUST: 1
FBF_CACHEBUST: 1
jobs:
test:
name: fbf-test
runs-on: ubuntu-22.04
container:
image: ${{env.CONDA_IMAGE}}
steps:
- uses: actions/checkout@v3

- name: restore miniconda cache
id: restore-miniconda
uses: actions/cache/restore@v3
with:
path: ${{env.CONDA_PATH}}
key: miniconda-${{env.CONDA_TYPE}}-${{env.CONDA_VERSION}}-${{env.CONDA_CACHEBUST}}

# I tried and rejected the existing setup-miniconda action,
# because it wipes out a bunch of files like ~/.profile,
# ~/.bashrc, ~/.bash_profile in a way that (a) won't interact
# well with other actions that also need to modify the shell
# environment, and (b) doesn't play well with caching (you can't
# cache the deletion of a file). Also this way seems to take
# about half the time (though that might just be random
# variation).
- name: download miniconda
run: curl -L --no-progress-meter -o miniconda-installer.sh "https://github.com/conda-forge/miniforge/releases/download/${{env.CONDA_VERSION}}/${{env.CONDA_TYPE}}-${{env.CONDA_VERSION}}-Linux-x86_64.sh"
if: steps.restore-miniconda.outputs.cache-hit != 'true'

- name: run miniconda installer
run: bash miniconda-installer.sh -b -p ${{env.CONDA_PATH}}
if: steps.restore-miniconda.outputs.cache-hit != 'true'

- name: clean up miniconda to reduce cache size
run: rm miniconda-installer.sh && source ${{env.CONDA_PATH}}/etc/profile.d/conda.sh && conda clean -afy
if: steps.restore-miniconda.outputs.cache-hit != 'true'

- name: save miniconda cache
uses: actions/cache/save@v3
with:
path: ${{env.CONDA_PATH}}
key: miniconda-${{env.CONDA_TYPE}}-${{env.CONDA_VERSION}}-${{env.CONDA_CACHEBUST}}
if: steps.restore-miniconda.outputs.cache-hit != 'true'

- name: restore fbfmaproom conda environment cache
id: restore-fbfmaproom-env
uses: actions/cache/restore@v3
with:
path: ${{env.CONDA_PATH}}/envs/fbfmaproom
key: fbfmaproom-env-${{ hashFiles('fbfmaproom/conda-linux-64.lock') }}-${{env.CONDA_CACHEBUST}}-${{env.FBF_ENV_CACHEBUST}}
key: fbfmaproom-env-${{CONDA_IMAGE}}-${{ hashFiles('fbfmaproom/conda-linux-64.lock') }}-${{env.FBF_CACHEBUST}}

- name: install fbfmaproom dependencies
run: source ${{env.CONDA_PATH}}/etc/profile.d/conda.sh && mamba create -n fbfmaproom --file fbfmaproom/conda-linux-64.lock
run: mamba create -n fbfmaproom --file fbfmaproom/conda-linux-64.lock
if: steps.restore-fbfmaproom-env.outputs.cache-hit != 'true'

- name: save fbfmaproom conda environment cache
uses: actions/cache/save@v3
with:
path: ${{env.CONDA_PATH}}/envs/fbfmaproom
key: fbfmaproom-env-${{ hashFiles('fbfmaproom/conda-linux-64.lock') }}-${{env.CONDA_CACHEBUST}}-${{env.FBF_ENV_CACHEBUST}}
key: fbfmaproom-env-${{ hashFiles('fbfmaproom/conda-linux-64.lock') }}-${{env.FBF_CACHEBUST}}
if: steps.restore-fbfmaproom-env.outputs.cache-hit != 'true'

- name: run fbf tests
run: source ${{env.CONDA_PATH}}/etc/profile.d/conda.sh && conda activate fbfmaproom && cd fbfmaproom && CONFIG=fbfmaproom-sample.yaml python -m pytest tests/test_pingrid.py
run: conda activate fbfmaproom && cd fbfmaproom && CONFIG=fbfmaproom-sample.yaml python -m pytest tests/test_pingrid.py

0 comments on commit 755b9f4

Please sign in to comment.