I've set up a Github workflow for my CI needs, and it seems to somehow reset values assigned to matrix variables to an empty string whenever I do a comparison using matrix values e.g
if: matrix.python-version == '3.8' && matrix.toxenv=='quality'
and I've specified runs-on: ${{ matrix.os }} it fails saying:
Error when evaluating 'runs-on' for job 'run_tests'. (Line: 12, Col: 14): Unexpected value ''
if I specify runs-on: ubuntu-20.04 it works just fine.
complete Github workflow: (I've setup TOXENV environment variables so it runs a new job for each tox environment in parallel, and to avoid unnecessary builds running with every job (e.g quality) and slowing down the jobs)
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
run_tests:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.5', '3.8', '3.9']
toxenv: ['django22', 'django30','django31']
include:
- python-version: "3.8"
toxenv: "quality"
exclude:
- python-version: "3.5"
toxenv: "django30"
- python-version: "3.5"
toxenv: "django31"
steps:
- uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install pip
run: pip install -r requirements/pip.txt
- name: Install Dependencies
run: pip install -r requirements/ci.txt
- name: Run Tests
env:
TOXENV: python${{ matrix.python-version }}-${{ matrix.toxenv }}
run: tox
# it'll run a separate job for quality checks with python 3.8
- name: Run Quality
if: matrix.python-version == '3.8' && matrix.toxenv=='quality'
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.toxenv=='django22'
uses: codecov/codecov-action@v1
with:
flags: unittests
fail_ci_if_error: true