Skip to content

Commit

Permalink
Import working CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
lucmos committed Jan 11, 2022
1 parent b59b085 commit efca870
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
include:
- os: ubuntu-20.04
label: linux-64
prefix: /usr/share/miniconda3/envs/$CONDA_ENV_NAME
prefix: /usr/share/miniconda3/envs/

# - os: macos-latest
# label: osx-64
Expand All @@ -31,6 +31,16 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Parametrize conda env name
run: echo "PY_CONDA_ENV_NAME=${{ env.CONDA_ENV_NAME }}-${{ matrix.python-version }}" >> $GITHUB_ENV
- name: echo conda env name
run: echo ${{ env.PY_CONDA_ENV_NAME }}

- name: Parametrize conda prefix
run: echo "PY_PREFIX=${{ matrix.prefix }}${{ env.PY_CONDA_ENV_NAME }}" >> $GITHUB_ENV
- name: echo conda prefix
run: echo ${{ env.PY_PREFIX }}

- uses: actions/checkout@v2

# Remove the python version pin from the env.yml which could be inconsistent
Expand All @@ -45,31 +55,31 @@ jobs:
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: ${{ env.CONDA_ENV_NAME }}
activate-environment: ${{ env.PY_CONDA_ENV_NAME }}
python-version: ${{ matrix.python-version }}
use-mamba: true

- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles(env.CONDA_ENV_FILE) }}-${{hashFiles('./setup.cfg') }}
path: ${{ env.PY_PREFIX }}
key: ${{ matrix.label }}-conda-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ env.PY_CONDA_ENV_NAME }}-${{ hashFiles(env.CONDA_ENV_FILE) }}-${{hashFiles('./setup.cfg') }}
id: conda_cache

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ matrix.label }}-pip-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ hashFiles(env.CONDA_ENV_FILE) }}-${{hashFiles('./setup.cfg') }}
key: ${{ matrix.label }}-pip-${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}-${{ env.PY_CONDA_ENV_NAME }}-${{ hashFiles(env.CONDA_ENV_FILE) }}-${{hashFiles('./setup.cfg') }}

# Ensure the hack for the python version worked
- name: Ensure we have the right Python
shell: bash -l {0}
run: |
echo "Installed Python: $(python --version)"
echo "Expected: ${{ matrix.PYTHON_VERSION }}"
echo "Expected: ${{ matrix.python-version }}"
python --version | grep "Python ${{ matrix.python-version }}"
- name: Update conda environment
run: mamba env update -n ${{ env.CONDA_ENV_NAME }} -f ${{ env.CONDA_ENV_FILE }}
run: mamba env update -n ${{ env.PY_CONDA_ENV_NAME }} -f ${{ env.CONDA_ENV_FILE }}
if: steps.conda_cache.outputs.cache-hit != 'true'

# Update pip env whether or not there was a conda cache hit
Expand All @@ -88,7 +98,7 @@ jobs:
shell: bash -l {0}
run: |
echo "Installed Python: $(python --version)"
echo "Expected: ${{ matrix.PYTHON_VERSION }}"
echo "Expected: ${{ matrix.python-version }}"
python --version | grep "Python ${{ matrix.python-version }}"
- name: Run pre-commits
Expand Down

0 comments on commit efca870

Please sign in to comment.