Skip to content

Commit

Permalink
Update "pytest" CI workflow
Browse files Browse the repository at this point in the history
- Test against multiple versions of ixmp and message_ix.
- Bump versions for third party actions:

  actions/cache v2 → v3
  actions/checkout v2 → v3
  actions/setup-python v2 → v3
  codecov/codecov-action v2 → v3
  • Loading branch information
khaeru committed May 6, 2022
1 parent 093f475 commit 5aca151
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,45 @@ jobs:
pytest:
strategy:
matrix:
include:
# One job per OS; latest python version testable on GitHub actions.
# These should match the versions used in the "pytest" workflows of both
# ixmp and message_ix.
- os: macos-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.9"
version:
- { os: macos-latest, python: "3.10" }
- { os: ubuntu-latest, python: "3.10" }
- { os: windows-latest, python: "3.9" }
upstream-version:
- v3.2.0 # Minimum version given in setup.cfg
- v3.5.0 # Latest released version
- main # Development version

fail-fast: false

runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.version.os }}
name: ${{ matrix.version.os }}-py${{ matrix.version.python }}-upstream-${{ matrix.upstream-version }}

steps:
- name: Cancel previous runs that have not completed
uses: styfle/[email protected]

- name: Check out ixmp
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: iiasa/ixmp
ref: ${{ matrix.upstream-version }}
path: ixmp
fetch-depth: ${{ env.depth }}

- name: Check out message-ix
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: iiasa/message_ix
ref: ${{ matrix.upstream-version }}
path: message-ix
fetch-depth: ${{ env.depth }}

- name: Check out message-ix-models
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: message-ix-models
fetch-depth: ${{ env.depth }}
Expand All @@ -70,20 +73,21 @@ jobs:
(cd message-ix-models; git fetch --tags --depth=${{ env.depth }})
shell: bash

- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.version.python }}

- name: Locate pip cache directory
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"

- name: Cache Python packages and GAMS installer
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/Library/Caches/pip
~/appdata/local/pip/cache
key: ${{ matrix.os }}-py${{ matrix.python-version }}
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.version.os }}-py${{ matrix.version.python }}
restore-keys: |
${{ matrix.os }}-
${{ matrix.version.os }}
- uses: iiasa/actions/setup-gams@main
with:
Expand All @@ -104,12 +108,12 @@ jobs:
run: pytest message_ix_models -rA --verbose --color=yes --cov-report=xml --cov-report=term-missing

- name: Test documentation build using Sphinx
if: ${{ startsWith(matrix.os, 'ubuntu') }}
if: startsWith(matrix.os, 'ubuntu')
env:
RTD_TOKEN_MESSAGE_DATA: ${{ secrets.RTD_TOKEN_MESSAGE_DATA }}
run: make --directory=message-ix-models/doc html

- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
directory: message-ix-models

0 comments on commit 5aca151

Please sign in to comment.