Skip to content

Commit f1e5513

Browse files
authored
ci: move to GitHub Actions (#41)
This uses Travis still for Python 3.4 (with https://github.com/blueyed/pytest/tree/my-4.6-maintenance).
1 parent 545a7d6 commit f1e5513

File tree

3 files changed

+124
-25
lines changed

3 files changed

+124
-25
lines changed

.github/workflows/ci.yml

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
PIP_DISABLE_PIP_VERSION_CHECK: true
12+
PYTEST_ADDOPTS: "-vv"
13+
# Set TERM to some commonly used default
14+
# (not provided/setup by GitHub Actions by default).
15+
TERM: xterm-256color
16+
17+
jobs:
18+
tests:
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
# Linux
26+
- tox_env: "py39-coverage"
27+
python: "3.9"
28+
os: ubuntu-20.04
29+
- tox_env: "py38-coverage"
30+
python: "3.8"
31+
os: ubuntu-20.04
32+
- tox_env: "py37-coverage"
33+
python: "3.7"
34+
os: ubuntu-20.04
35+
- tox_env: "py36-coverage"
36+
python: "3.6"
37+
os: ubuntu-20.04
38+
- tox_env: "py35-coverage"
39+
python: "3.5"
40+
os: ubuntu-20.04
41+
42+
- tox_env: "py27-coverage"
43+
python: "2.7"
44+
os: ubuntu-20.04
45+
46+
- tox_env: "pypy3-coverage"
47+
python: "pypy-3.7"
48+
os: ubuntu-20.04
49+
- tox_env: "pypy-coverage"
50+
python: "pypy-2.7"
51+
os: ubuntu-20.04
52+
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
fetch-depth: 0
57+
- name: Set up Python ${{ matrix.python }}
58+
uses: actions/setup-python@v2
59+
with:
60+
python-version: ${{ matrix.python }}
61+
62+
# Caching.
63+
- name: set PY_CACHE_KEY
64+
run: echo "PY_CACHE_KEY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
65+
- name: Cache .tox
66+
uses: actions/cache@v1
67+
with:
68+
path: ${{ github.workspace }}/.tox/${{ matrix.tox_env }}
69+
key: "tox|${{ matrix.os }}|${{ matrix.tox_env }}|${{ env.PY_CACHE_KEY }}|${{ hashFiles('tox.ini', 'setup.*') }}"
70+
71+
- name: (Initial) version information/pinning
72+
run: |
73+
set -x
74+
python -m site
75+
python -m pip --version
76+
python -m pip list
77+
if [[ "${{ matrix.python }}" == "3.4" ]]; then
78+
# Install latest available pip.
79+
# 7.1.2 (installed) is too old to not install too new packages,
80+
# including pip itself. 19.2 dropped support for Python 3.4.
81+
python -m pip install -U pip==19.1.1
82+
fi
83+
python -m pip install -U setuptools==42.0.2
84+
python -m pip install -U virtualenv==20.4.3
85+
86+
- name: Install tox
87+
run: python -m pip install git+https://github.com/blueyed/tox@master
88+
89+
- name: Version information
90+
run: python -m pip list
91+
92+
- name: Setup tox environment
93+
id: setup-tox
94+
run: python -m tox --notest -v --durations -e ${{ matrix.tox_env }}
95+
96+
- name: Test
97+
env:
98+
COLUMNS: "90" # better alignment (working around https://github.com/blueyed/pytest/issues/491).
99+
PY_COLORS: "1"
100+
# UTF-8 mode for Windows (https://docs.python.org/3/using/windows.html#utf-8-mode).
101+
PYTHONUTF8: "1"
102+
TOX_TESTENV_PASSENV: "PYTHONUTF8"
103+
run: python -m tox -v --durations -e ${{ matrix.tox_env }}
104+
105+
- name: Report coverage
106+
if: always() && (steps.setup-tox.outcome == 'success' && contains(matrix.tox_env, '-coverage'))
107+
uses: codecov/codecov-action@v1
108+
with:
109+
files: ./coverage.xml
110+
flags: ${{ runner.os }}
111+
name: ${{ matrix.tox_env }}
112+
fail_ci_if_error: true

.travis.yml

+5-22
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,20 @@ language: python
33

44
env:
55
global:
6-
- PYTEST_ADDOPTS="--cov --cov-report=xml"
6+
- PYTEST_ADDOPTS="-vv"
77

88
jobs:
99
include:
10-
- python: '2.7'
11-
env: TOXENV=py27-coverage
1210
- python: '3.4'
13-
env: TOXENV=py34-coverage
14-
- python: '3.5'
15-
env: TOXENV=py35-coverage
16-
- python: '3.6'
17-
env: TOXENV=py36-coverage
18-
- python: '3.7'
19-
env: TOXENV=py37-coverage
20-
- python: '3.8'
21-
env: TOXENV=py38-coverage
22-
- python: '3.9'
23-
env: TOXENV=py39-coverage
24-
- python: 'pypy'
25-
env: TOXENV=pypy-coverage
26-
- python: 'pypy3'
27-
env: TOXENV=pypy3-coverage
28-
# Fails currently badly.
29-
# - python: '3.7'
30-
# env: TOXENV=qa
11+
env:
12+
- TOXENV=py34-coverage
13+
- PYTEST="pytest @ git+https://github.com/blueyed/[email protected]"
3114

3215
install:
3316
- pip install tox
3417

3518
script:
36-
- tox
19+
- tox --force-dep="$PYTEST"
3720

3821
after_script:
3922
- |

tox.ini

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ envlist = py{27,34,35,36,37,38,39,py,py3}, flake8
55
deps =
66
pytest
77
pexpect
8-
coverage: pytest-cov
8+
coverage: coverage
99
commands =
10-
pytest {posargs}
10+
{env:_PYREPL_TOX_RUN_CMD:pytest} {posargs}
11+
coverage: coverage combine
12+
coverage: coverage report -m
13+
coverage: coverage xml
1114
passenv =
15+
PYTEST_ADDOPTS
1216
TERM
1317
setenv =
14-
coverage: PYTEST_ADDOPTS=--cov {env:PYTEST_ADDOPTS:}
18+
coverage: _PYREPL_TOX_RUN_CMD=coverage run -m pytest
1519

1620
[testenv:qa]
1721
deps =

0 commit comments

Comments
 (0)