Skip to content

Commit c4e1fe3

Browse files
authored
Merge pull request #114 from pquentin/github-actions
2 parents 9ae58ea + 78c5362 commit c4e1fe3

File tree

6 files changed

+173
-129
lines changed

6 files changed

+173
-129
lines changed

.appveyor.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "dependabot/**"
7+
pull_request:
8+
9+
jobs:
10+
Windows:
11+
name: 'Windows (${{ matrix.python }})'
12+
runs-on: 'windows-latest'
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python: ['3.6', '3.7', '3.8', '3.9']
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
- name: Setup python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: '${{ matrix.python }}'
24+
- name: Run tests
25+
run: ./ci.sh
26+
shell: bash
27+
env:
28+
# Should match 'name:' up above
29+
JOB_NAME: 'Windows (${{ matrix.python }})'
30+
31+
Ubuntu:
32+
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
33+
timeout-minutes: 10
34+
runs-on: 'ubuntu-latest'
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
python: ['pypy-3.6', '3.6', '3.7', '3.8', '3.9', '3.6-dev', '3.7-dev', '3.8-dev', '3.9-dev']
39+
check_formatting: ['0']
40+
check_docs: ['0']
41+
extra_name: ['']
42+
include:
43+
- python: '3.9'
44+
check_formatting: '1'
45+
extra_name: ', check formatting'
46+
- python: '3.9'
47+
check_docs: '1'
48+
extra_name: ', check docs'
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v2
52+
- name: Setup python
53+
uses: actions/setup-python@v2
54+
if: "!endsWith(matrix.python, '-dev')"
55+
with:
56+
python-version: '${{ matrix.python }}'
57+
- name: Setup python (dev)
58+
uses: deadsnakes/[email protected]
59+
if: endsWith(matrix.python, '-dev')
60+
with:
61+
python-version: '${{ matrix.python }}'
62+
- name: Run tests
63+
run: ./ci.sh
64+
env:
65+
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
66+
CHECK_DOCS: '${{ matrix.check_docs }}'
67+
# Should match 'name:' up above
68+
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
69+
70+
macOS:
71+
name: 'macOS (${{ matrix.python }})'
72+
timeout-minutes: 10
73+
runs-on: 'macos-latest'
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
python: ['3.6', '3.7', '3.8', '3.9']
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v2
81+
- name: Setup python
82+
uses: actions/setup-python@v2
83+
with:
84+
python-version: '${{ matrix.python }}'
85+
- name: Run tests
86+
run: ./ci.sh
87+
env:
88+
# Should match 'name:' up above
89+
JOB_NAME: 'macOS (${{ matrix.python }})'

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

ci.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
set -ex -o pipefail
4+
5+
# Log some general info about the environment
6+
uname -a
7+
env | sort
8+
9+
# See https://github.com/python-trio/trio/issues/334
10+
YAPF_VERSION=0.22.0
11+
12+
# Curl's built-in retry system is not very robust; it gives up on lots of
13+
# network errors that we want to retry on. Wget might work better, but it's
14+
# not installed on azure pipelines's windows boxes. So... let's try some good
15+
# old-fashioned brute force. (This is also a convenient place to put options
16+
# we always want, like -f to tell curl to give an error if the server sends an
17+
# error response, and -L to follow redirects.)
18+
function curl-harder() {
19+
for BACKOFF in 0 1 2 4 8 15 15 15 15; do
20+
sleep $BACKOFF
21+
if curl -fL --connect-timeout 5 "$@"; then
22+
return 0
23+
fi
24+
done
25+
return 1
26+
}
27+
28+
29+
python -m pip install -U pip setuptools wheel
30+
python -m pip --version
31+
32+
python setup.py sdist --formats=zip
33+
python -m pip install dist/*.zip
34+
35+
if [ "$CHECK_FORMATTING" = "1" ]; then
36+
pip install yapf==${YAPF_VERSION}
37+
if ! yapf -rpd setup.py pytest_trio; then
38+
cat <<EOF
39+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41+
42+
Formatting problems were found (listed above). To fix them, run
43+
44+
pip install yapf==${YAPF_VERSION}
45+
yapf -rpi setup.py pytest_trio
46+
47+
in your local checkout.
48+
49+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
50+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51+
EOF
52+
exit 1
53+
fi
54+
elif [ "$CHECK_DOCS" = "1" ]; then
55+
pip install -Ur docs-requirements.txt
56+
cd docs
57+
# -n (nit-picky): warn on missing references
58+
# -W: turn warnings into errors
59+
sphinx-build -nW -b html source build
60+
else
61+
# Actual tests
62+
python -m pip install -r test-requirements.txt
63+
64+
# We run the tests from inside an empty directory, to make sure Python
65+
# doesn't pick up any .py files from our working dir. Might have been
66+
# pre-created by some of the code above.
67+
mkdir empty || true
68+
cd empty
69+
70+
# These environment variables ensure that the import of the pytest-trio plugin is covered
71+
# even if pytest-trio is loaded before pytest-cov. See https://pytest-cov.readthedocs.io/en/latest/plugins.html
72+
env COV_CORE_SOURCE=pytest_trio COV_CORE_CONFIG=.coveragerc COV_CORE_DATAFILE=.coverage pytest
73+
74+
# The codecov docs recommend something like 'bash <(curl ...)' to pipe the
75+
# script directly into bash as its being downloaded. But, the codecov
76+
# server is flaky, so we instead save to a temp file with retries, and
77+
# wait until we've successfully fetched the whole script before trying to
78+
# run it.
79+
curl-harder -o codecov.sh https://codecov.io/bash
80+
bash codecov.sh -n "${JOB_NAME}"
81+
fi

ci/travis.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.

test-requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pytest >= 6.0.0 # https://github.com/python-trio/pytest-trio/pull/98#issuecomment-678699693
2-
pytest-cov
3-
hypothesis>=3.64
1+
pytest==6.1.2
2+
pytest-cov==2.10.1
3+
hypothesis==5.47.0

0 commit comments

Comments
 (0)