Skip to content

Commit

Permalink
Add tests to GitHub Actions CI/CD workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Jan 17, 2020
1 parent c19c53c commit 331ef38
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test suite

on:
push:
pull_request:
schedule:
# Run daily at 0:01 UTC
# https://crontab.guru/#1_0_*_*_*
- cron: 1 0 * * *

jobs:
tests:
name: 👷
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# max-parallel: 5
matrix:
python-version:
- 3.8
- 2.7
- pypy3
- 3.7
- 3.6
- 3.5
- pypy2
os:
- ubuntu-latest
- ubuntu-16.04
- macOS-latest
- windows-latest
- windows-2016
env:
- TOXENV: python
tox-addargs:
- --use-venv -m unit
- --use-venv -m integration -n auto --duration=5 -k "not test_install"
- --use-venv -m integration -n auto --duration=5 -k "test_install"

env:
TOX_PARALLEL_NO_SPINNER: 1

steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Log Python version
run: >-
python --version
- name: Log Python location
run: >-
which python
- name: Log Python env
run: >-
python -m sysconfig
- name: Cache pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('tools/requirements/tests.txt') }}-${{ hashFiles('tools/requirements/docs.txt') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install tox
run: >-
python -m pip install --upgrade tox
- name: 'Initialize tox envs: ${{ matrix.env.TOXENV }}'
run: |
${{ startsWith(matrix.os, 'windows-') && 'setx TOXENV ' || 'export TOXENV=' }}${{ (startsWith(matrix.python-version, 'pypy') && matrix.python-version) || (startsWith(matrix.os, 'windows-') && '$TOXENV' || '%TOXENV%') }}
${{ startsWith(matrix.os, 'macOS-') && 'pypy3' == matrix.python-version && 'export TOXENV=pypy3' || '' }}
echo TOXENV="$TOXENV"
python -m tox --parallel auto --notest --skip-missing-interpreters false
env: ${{ matrix.env }}
- name: Test with tox
run: |
${{ startsWith(matrix.os, 'windows-') && 'setx NETWORK_REQUIRED ' || 'export NETWORK_REQUIRED=' }}1
${{ startsWith(matrix.os, 'windows-') && 'setx TOXENV ' || 'export TOXENV=' }}${{ (startsWith(matrix.python-version, 'pypy') && matrix.python-version) || (startsWith(matrix.os, 'windows-') && '$TOXENV' || '%TOXENV%') }}
${{ startsWith(matrix.os, 'macOS-') && 'pypy3' == matrix.python-version && 'export TOXENV=pypy3' || '' }}
echo TOXENV="$TOXENV"
python -m tox --parallel auto -- ${{ matrix.tox-addargs }}
env: ${{ matrix.env }}

0 comments on commit 331ef38

Please sign in to comment.