Skip to content

Allow to pass env var from Actions to tox #1064

Allow to pass env var from Actions to tox

Allow to pass env var from Actions to tox #1064

Workflow file for this run

name: Sourcecode tests
on: [push, pull_request, workflow_dispatch]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run styles check
run: tox -elint
- name: Run black
run: tox -eblack
tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up tox env
run: |
pver=${{ matrix.python-version }}
tox_env="-epy${pver/./}"
echo tox_env
echo TOX_ENV=$tox_env >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Test using tox envs
run: |
unset CI
tox ${{ env.TOX_ENV }}
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run coverage
run: |
unset CI
tox -ecoverage
json-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Validate JSON
run: tox -ejson