Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to GitHub Actions CI/CD workflow #6953

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
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: >-
${{ matrix.python-version }}
/
${{ matrix.os }}
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
tox-addargs:
- -m unit
- -m integration -n auto --duration=5 -k "not test_install"
- -m integration -n auto --duration=5 -k "test_install"
exclude:
- python-version: pypy3
- os: macOS-latest
python-version: pypy2
- os: windows-latest
- os: windows-2016

env:
TOX_PARALLEL_NO_SPINNER: 1
TOXENV: python
USE_VENV_ARG: --use-venv

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: Pip cache
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: Pre-configure global Git settings
run: |
git config --global user.email "[email protected]"
git config --global user.name "pip"
- name: Update setuptools
run: >-
python -m pip install --upgrade setuptools
- name: Install tox
run: >-
python -m pip install --upgrade tox tox-venv
- name: Set up certify on Windows
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade certifi
echo "::set-env name=GIT_SSL_CAINFO::$(python -m certifi)"
- name: Log the list of packages
run: >-
python -m pip freeze --all
- name: Adjust TOXENV for PyPy
if: startsWith(matrix.python-version, 'pypy')
run: >-
echo "::set-env name=TOXENV::${{ matrix.python-version }}"
- name: >-
Empty USE_VENV_ARG unconditionally
# FIXME: was "... unless Python is 3.6 or 2.7"
# FIXME: if: >-
# FIXME: runner.os == 'Windows'
# FIXME: && matrix.python-version != 3.6
# FIXME: && matrix.python-version != 2.7
run: >-
echo "::set-env name=USE_VENV_ARG::"
- name: 'Initialize tox envs: ${{ matrix.env.TOXENV }}'
run: >-
python -m
tox
--parallel auto
--notest
--skip-missing-interpreters false
- name: Set NETWORK_REQUIRED
run: >-
echo "::set-env name=NETWORK_REQUIRED::1"
- name: Log special env vars
shell: python
run: |
import os
print(
'USE_VENV_ARG={}\n'
'NETWORK_REQUIRED={}\n'
'GIT_SSL_CAINFO={}\n'.
format(
os.getenv('USE_VENV_ARG'),
os.getenv('NETWORK_REQUIRED'),
os.getenv('GIT_SSL_CAINFO'),
)
)
- name: Test with tox
run: >-
python -m
tox
--parallel auto
--
${{ env.USE_VENV_ARG }} ${{ matrix.tox-addargs }}
1 change: 1 addition & 0 deletions news/6953-gh-actions--tests.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a GitHub Actions workflow running all tests.