|
| 1 | +on: |
| 2 | + pull_request: |
| 3 | + workflow_dispatch: |
| 4 | +env: |
| 5 | + CONDA_TYPE: Mambaforge |
| 6 | + CONDA_VERSION: 23.1.0-1 |
| 7 | + CONDA_PATH: /opt/conda |
| 8 | + CONDA_CACHEBUST: 1 |
| 9 | + FBF_ENV_CACHEBUST: 1 |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + name: fbf-test |
| 13 | + runs-on: ubuntu-22.04 |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: restore miniconda cache |
| 18 | + id: restore-miniconda |
| 19 | + uses: actions/cache/restore@v3 |
| 20 | + with: |
| 21 | + path: ${{env.CONDA_PATH}} |
| 22 | + key: miniconda-${{env.CONDA_TYPE}}-${{env.CONDA_VERSION}}-${{env.CONDA_CACHEBUST}} |
| 23 | + |
| 24 | + # I tried and rejected the existing setup-miniconda action, |
| 25 | + # because it wipes out a bunch of files like ~/.profile, |
| 26 | + # ~/.bashrc, ~/.bash_profile in a way that (a) won't interact |
| 27 | + # well with other actions that also need to modify the shell |
| 28 | + # environment, and (b) doesn't play well with caching (you can't |
| 29 | + # cache the deletion of a file). Also this way seems to take |
| 30 | + # about half the time (though that might just be random |
| 31 | + # variation). |
| 32 | + - name: download miniconda |
| 33 | + 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" |
| 34 | + if: steps.restore-miniconda.outputs.cache-hit != 'true' |
| 35 | + |
| 36 | + - name: run miniconda installer |
| 37 | + run: bash miniconda-installer.sh -b -p ${{env.CONDA_PATH}} |
| 38 | + if: steps.restore-miniconda.outputs.cache-hit != 'true' |
| 39 | + |
| 40 | + - name: clean up miniconda to reduce cache size |
| 41 | + run: rm miniconda-installer.sh && source ${{env.CONDA_PATH}}/etc/profile.d/conda.sh && conda clean -afy |
| 42 | + if: steps.restore-miniconda.outputs.cache-hit != 'true' |
| 43 | + |
| 44 | + - name: save miniconda cache |
| 45 | + uses: actions/cache/save@v3 |
| 46 | + with: |
| 47 | + path: ${{env.CONDA_PATH}} |
| 48 | + key: miniconda-${{env.CONDA_TYPE}}-${{env.CONDA_VERSION}}-${{env.CONDA_CACHEBUST}} |
| 49 | + if: steps.restore-miniconda.outputs.cache-hit != 'true' |
| 50 | + |
| 51 | + - name: restore fbfmaproom conda environment cache |
| 52 | + id: restore-fbfmaproom-env |
| 53 | + uses: actions/cache/restore@v3 |
| 54 | + with: |
| 55 | + path: ${{env.CONDA_PATH}}/envs/fbfmaproom |
| 56 | + key: fbfmaproom-env-${{ hashFiles('fbfmaproom/conda-linux-64.lock') }}-${{env.CONDA_CACHEBUST}}-${{env.FBF_ENV_CACHEBUST}} |
| 57 | + |
| 58 | + - name: install fbfmaproom dependencies |
| 59 | + run: source ${{env.CONDA_PATH}}/etc/profile.d/conda.sh && mamba create -n fbfmaproom --file fbfmaproom/conda-linux-64.lock |
| 60 | + if: steps.restore-fbfmaproom-env.outputs.cache-hit != 'true' |
| 61 | + |
| 62 | + - name: save fbfmaproom conda environment cache |
| 63 | + uses: actions/cache/save@v3 |
| 64 | + with: |
| 65 | + path: ${{env.CONDA_PATH}}/envs/fbfmaproom |
| 66 | + key: fbfmaproom-env-${{ hashFiles('fbfmaproom/conda-linux-64.lock') }}-${{env.CONDA_CACHEBUST}}-${{env.FBF_ENV_CACHEBUST}} |
| 67 | + if: steps.restore-fbfmaproom-env.outputs.cache-hit != 'true' |
| 68 | + |
| 69 | + - name: run fbf tests |
| 70 | + 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 |
0 commit comments