diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml index 3deccfa..9a1534a 100644 --- a/.github/workflows/test_suite.yml +++ b/.github/workflows/test_suite.yml @@ -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 @@ -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 @@ -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 @@ -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