Skip to content

Commit 98e7d3a

Browse files
committed
Add GitHub action to test the rest of environments/os
1 parent e5a5643 commit 98e7d3a

File tree

5 files changed

+231
-2
lines changed

5 files changed

+231
-2
lines changed

.github/workflows/main.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# evaluating GitHub actions for CI, disregard failures when evaluating PRs
2+
#
3+
# this is still missing:
4+
# - deploy
5+
# - upload github notes
6+
#
7+
name: main
8+
9+
on:
10+
push:
11+
branches:
12+
- 4.6.x
13+
tags:
14+
- "*"
15+
16+
pull_request:
17+
branches:
18+
- 4.6.x
19+
20+
jobs:
21+
build:
22+
runs-on: ${{ matrix.os }}
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
name: [
28+
"windows-py27",
29+
"windows-py35",
30+
"windows-py36",
31+
"windows-py37",
32+
"windows-py37-pluggy",
33+
"windows-py38",
34+
35+
"ubuntu-py37",
36+
"ubuntu-py37-pluggy",
37+
"ubuntu-py37-pexpect",
38+
"ubuntu-py37-freeze",
39+
"ubuntu-pypy",
40+
"ubuntu-pypy3",
41+
42+
"macos-py27",
43+
"macos-py38",
44+
45+
]
46+
47+
include:
48+
# Windows jobs
49+
- name: "windows-py27"
50+
python: "2.7"
51+
os: windows-latest
52+
tox_env: "py27-xdist"
53+
use_coverage: true
54+
arch: "x64"
55+
- name: "windows-py35"
56+
python: "3.5"
57+
os: windows-latest
58+
tox_env: "py35-xdist"
59+
arch: "x64"
60+
- name: "windows-py36"
61+
python: "3.6"
62+
os: windows-latest
63+
tox_env: "py36-xdist"
64+
arch: "x64"
65+
- name: "windows-py37"
66+
python: "3.7"
67+
os: windows-latest
68+
tox_env: "py37-twisted-numpy"
69+
arch: "x64"
70+
- name: "windows-py37-pluggy"
71+
python: "3.7"
72+
os: windows-latest
73+
tox_env: "py37-pluggymaster-xdist"
74+
arch: "x64"
75+
- name: "windows-py38"
76+
python: "3.8"
77+
os: windows-latest
78+
tox_env: "py38"
79+
use_coverage: true
80+
arch: "x64"
81+
82+
# Ubuntu jobs – find the rest of them in .travis.yml
83+
- name: "ubuntu-py37"
84+
python: "3.7"
85+
os: ubuntu-latest
86+
tox_env: "py37-lsof-numpy-xdist"
87+
use_coverage: true
88+
arch: "x64"
89+
- name: "ubuntu-py37-pluggy"
90+
python: "3.7"
91+
os: ubuntu-latest
92+
tox_env: "py37-pluggymaster-xdist"
93+
arch: "x64"
94+
- name: "ubuntu-py37-pexpect"
95+
python: "3.7"
96+
os: ubuntu-latest
97+
tox_env: "py37-pexpect"
98+
use_coverage: true
99+
arch: "x64"
100+
- name: "ubuntu-py37-freeze"
101+
python: "3.7"
102+
os: ubuntu-latest
103+
tox_env: "py37-freeze"
104+
arch: "x64"
105+
- name: "ubuntu-pypy"
106+
python: "pypy2"
107+
os: ubuntu-latest
108+
tox_env: "pypy-xdist"
109+
arch: "x64"
110+
- name: "ubuntu-pypy3"
111+
python: "pypy3"
112+
os: ubuntu-latest
113+
tox_env: "pypy3-xdist"
114+
arch: "x64"
115+
116+
# MacOS jobs
117+
- name: "macos-py27"
118+
python: "2.7"
119+
os: macos-latest
120+
tox_env: "py27-xdist"
121+
use_coverage: true
122+
arch: "x64"
123+
- name: "macos-py38"
124+
python: "3.8"
125+
os: macos-latest
126+
tox_env: "py38-xdist"
127+
use_coverage: true
128+
arch: "x64"
129+
130+
steps:
131+
- uses: actions/checkout@v1
132+
- name: Set up Python ${{ matrix.python }} on ${{ matrix.os }}
133+
uses: actions/setup-python@v1
134+
with:
135+
python-version: ${{ matrix.python }}
136+
architecture: ${{ matrix.arch }}
137+
- name: Install dependencies
138+
run: |
139+
python -m pip install --upgrade pip
140+
pip install tox coverage
141+
- name: Test without coverage
142+
if: "! matrix.use_coverage"
143+
run: "tox -e ${{ matrix.tox_env }}"
144+
145+
- name: Test with coverage
146+
if: "matrix.use_coverage"
147+
env:
148+
_PYTEST_TOX_COVERAGE_RUN: "coverage run -m"
149+
COVERAGE_PROCESS_START: ".coveragerc"
150+
_PYTEST_TOX_EXTRA_DEP: "coverage-enable-subprocess"
151+
run: "tox -e ${{ matrix.tox_env }}"
152+
153+
- name: Prepare coverage token
154+
if: (matrix.use_coverage && ( github.repository == 'pytest-dev/pytest' || github.event_name == 'pull_request' ))
155+
run: |
156+
python scripts/append_codecov_token.py
157+
- name: Report coverage
158+
if: (matrix.use_coverage)
159+
env:
160+
CODECOV_NAME: ${{ matrix.name }}
161+
run: bash scripts/report-coverage.sh -F GHA,${{ runner.os }}
162+
163+
deploy:
164+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'
165+
166+
runs-on: ubuntu-latest
167+
168+
needs: [build]
169+
170+
steps:
171+
- uses: actions/checkout@v1
172+
- name: Set up Python
173+
uses: actions/setup-python@v1
174+
with:
175+
python-version: "3.7"
176+
- name: Install dependencies
177+
run: |
178+
python -m pip install --upgrade pip
179+
pip install --upgrade wheel setuptools tox
180+
- name: Build package
181+
run: |
182+
python setup.py sdist bdist_wheel
183+
- name: Publish package to PyPI
184+
uses: pypa/gh-action-pypi-publish@master
185+
with:
186+
user: __token__
187+
password: ${{ secrets.pypi_token }}
188+
- name: Publish GitHub release notes
189+
env:
190+
GH_RELEASE_NOTES_TOKEN: ${{ secrets.release_notes }}
191+
run: |
192+
sudo apt-get install pandoc
193+
tox -e publish-gh-release-notes

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ script: env COLUMNS=120 python -m tox
6262
after_success:
6363
- |
6464
if [[ "$PYTEST_COVERAGE" = 1 ]]; then
65-
CODECOV_NAME="$TOXENV-$TRAVIS_OS_NAME" scripts/report-coverage.sh
65+
env CODECOV_NAME="$TOXENV-$TRAVIS_OS_NAME" scripts/report-coverage.sh
6666
fi
6767
branches:
6868
only:

scripts/append_codecov_token.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Appends the codecov token to the 'codecov.yml' file at the root of the repository.
4+
This is done by CI during PRs and builds on the pytest-dev repository so we can upload coverage, at least
5+
until codecov grows some native integration like it has with Travis and AppVeyor.
6+
See discussion in https://github.com/pytest-dev/pytest/pull/6441 for more information.
7+
"""
8+
import os.path
9+
from textwrap import dedent
10+
11+
12+
def main():
13+
this_dir = os.path.dirname(__file__)
14+
cov_file = os.path.join(this_dir, "..", "codecov.yml")
15+
16+
assert os.path.isfile(cov_file), "{cov_file} does not exist".format(
17+
cov_file=cov_file
18+
)
19+
20+
with open(cov_file, "a") as f:
21+
# token from: https://codecov.io/gh/pytest-dev/pytest/settings
22+
# use same URL to regenerate it if needed
23+
text = dedent(
24+
"""
25+
codecov:
26+
token: "1eca3b1f-31a2-4fb8-a8c3-138b441b50a7"
27+
"""
28+
)
29+
f.write(text)
30+
31+
print("Token updated:", cov_file)
32+
33+
34+
if __name__ == "__main__":
35+
main()

scripts/report-coverage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ python -m coverage xml
1515
python -m coverage report -m
1616
# Set --connect-timeout to work around https://github.com/curl/curl/issues/4461
1717
curl -S -L --connect-timeout 5 --retry 6 -s https://codecov.io/bash -o codecov-upload.sh
18-
bash codecov-upload.sh -Z -X fix -f coverage.xml
18+
bash codecov-upload.sh -Z -X fix -f coverage.xml "$@"

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ changedir = testing/freeze
119119
# Disable PEP 517 with pip, which does not work with PyInstaller currently.
120120
deps =
121121
pyinstaller
122+
setuptools < 45.0.0
122123
commands =
123124
{envpython} create_executable.py
124125
{envpython} tox_run.py

0 commit comments

Comments
 (0)