diff --git a/.github/workflows/refresh-lockfiles.yml b/.github/workflows/refresh-lockfiles.yml index d191910b44..db9066ad54 100644 --- a/.github/workflows/refresh-lockfiles.yml +++ b/.github/workflows/refresh-lockfiles.yml @@ -23,19 +23,29 @@ on: jobs: + get_python_matrix: + # Determines which Python versions should be included in the matrix used in + # the gen_lockfiles job. + if: "github.repository == 'SciTools/iris'" + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.get_py.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - id: get_py + run: echo "::set-output name=matrix::$(ls -1 requirements/ci/py??.yml | xargs -n1 basename | sed 's/....$//' | jq -cnR '[inputs]')" + gen_lockfiles: # this is a matrix job: it splits to create new lockfiles for each # of the CI test python versions. - # this list below should be changed when covering more python versions - # TODO: generate this matrix automatically from the list of available py**.yml files - # ref: https://tomasvotruba.com/blog/2020/11/16/how-to-make-dynamic-matrix-in-github-actions/ if: "github.repository == 'SciTools/iris'" runs-on: ubuntu-latest + needs: get_python_matrix strategy: matrix: - python: ['38'] - + python: ${{ fromJSON(needs.get_python_matrix.outputs.matrix) }} + steps: - uses: actions/checkout@v3 - name: install conda-lock @@ -44,12 +54,12 @@ jobs: conda install -y -c conda-forge conda-lock - name: generate lockfile run: | - $CONDA/bin/conda-lock lock -k explicit -p linux-64 -f requirements/ci/py${{matrix.python}}.yml - mv conda-linux-64.lock py${{matrix.python}}-linux-64.lock + $CONDA/bin/conda-lock lock -k explicit -p linux-64 -f requirements/ci/${{matrix.python}}.yml + mv conda-linux-64.lock ${{matrix.python}}-linux-64.lock - name: output lockfile uses: actions/upload-artifact@v2 with: - path: py${{matrix.python}}-linux-64.lock + path: ${{matrix.python}}-linux-64.lock create_pr: # once the matrix job has completed all the lock files will have been uploaded as artifacts.