Skip to content

Commit 5cbeb0c

Browse files
committed
Move CI to Github Actions
1 parent 723a7f7 commit 5cbeb0c

File tree

7 files changed

+238
-159
lines changed

7 files changed

+238
-159
lines changed

.appveyor.yml

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

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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 }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
12+
timeout-minutes: 20
13+
runs-on: 'windows-latest'
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python: ['3.6', '3.7', '3.8', '3.9']
18+
arch: ['x86', 'x64']
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Setup python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: '${{ matrix.python }}'
26+
architecture: '${{ matrix.arch }}'
27+
- name: Run tests
28+
run: ./ci.sh
29+
shell: bash
30+
env:
31+
# Should match 'name:' up above
32+
JOB_NAME: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
33+
34+
Ubuntu:
35+
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
36+
timeout-minutes: 10
37+
runs-on: 'ubuntu-latest'
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
python: ['pypy-3.6', 'pypy-3.7', '3.6', '3.7', '3.8', '3.9', '3.6-dev', '3.7-dev', '3.8-dev', '3.9-dev']
42+
check_formatting: ['0']
43+
check_docs: ['0']
44+
pypy_nightly_branch: ['']
45+
extra_name: ['']
46+
include:
47+
- python: '3.8'
48+
check_formatting: '1'
49+
extra_name: ', check formatting'
50+
- python: '3.8'
51+
check_docs: '1'
52+
extra_name: ', check docs'
53+
- python: '3.7' # <- not actually used
54+
pypy_nightly_branch: 'py3.7'
55+
extra_name: ', pypy 3.7 nightly'
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v2
59+
- name: Setup python
60+
uses: actions/setup-python@v2
61+
if: "!endsWith(matrix.python, '-dev')"
62+
with:
63+
python-version: '${{ matrix.python }}'
64+
- name: Setup python (dev)
65+
uses: deadsnakes/action@v2.0.2
66+
if: endsWith(matrix.python, '-dev')
67+
with:
68+
python-version: '${{ matrix.python }}'
69+
- name: Run tests
70+
run: ./ci.sh
71+
env:
72+
PYPY_NIGHTLY_BRANCH: '${{ matrix.pypy_nightly_branch }}'
73+
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
74+
CHECK_DOCS: '${{ matrix.check_docs }}'
75+
# Should match 'name:' up above
76+
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
77+
78+
macOS:
79+
name: 'macOS (${{ matrix.python }})'
80+
timeout-minutes: 10
81+
runs-on: 'macos-latest'
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
python: ['3.6', '3.7', '3.8', '3.9']
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v2
89+
- name: Setup python
90+
uses: actions/setup-python@v2
91+
with:
92+
python-version: '${{ matrix.python }}'
93+
- name: Run tests
94+
run: ./ci.sh
95+
env:
96+
# Should match 'name:' up above
97+
JOB_NAME: 'macOS (${{ matrix.python }})'

.travis.yml

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

ci.sh

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
if [ "$JOB_NAME" = "" ]; then
10+
JOB_NAME="${TRAVIS_OS_NAME}-${TRAVIS_PYTHON_VERSION:-unknown}"
11+
fi
12+
13+
# Curl's built-in retry system is not very robust; it gives up on lots of
14+
# network errors that we want to retry on. Wget might work better, but it's
15+
# not installed on azure pipelines's windows boxes. So... let's try some good
16+
# old-fashioned brute force. (This is also a convenient place to put options
17+
# we always want, like -f to tell curl to give an error if the server sends an
18+
# error response, and -L to follow redirects.)
19+
function curl-harder() {
20+
for BACKOFF in 0 1 2 4 8 15 15 15 15; do
21+
sleep $BACKOFF
22+
if curl -fL --connect-timeout 5 "$@"; then
23+
return 0
24+
fi
25+
done
26+
return 1
27+
}
28+
29+
################################################################
30+
# Bootstrap python environment, if necessary
31+
################################################################
32+
33+
### PyPy nightly (currently on Travis) ###
34+
35+
if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then
36+
JOB_NAME="pypy_nightly_${PYPY_NIGHTLY_BRANCH}"
37+
curl-harder -o pypy.tar.bz2 http://buildbot.pypy.org/nightly/${PYPY_NIGHTLY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2
38+
if [ ! -s pypy.tar.bz2 ]; then
39+
# We know:
40+
# - curl succeeded (200 response code)
41+
# - nonetheless, pypy.tar.bz2 does not exist, or contains no data
42+
# This isn't going to work, and the failure is not informative of
43+
# anything involving Trio.
44+
ls -l
45+
echo "PyPy3 nightly build failed to download – something is wrong on their end."
46+
echo "Skipping testing against the nightly build for right now."
47+
exit 0
48+
fi
49+
tar xaf pypy.tar.bz2
50+
# something like "pypy-c-jit-89963-748aa3022295-linux64"
51+
PYPY_DIR=$(echo pypy-c-jit-*)
52+
PYTHON_EXE=$PYPY_DIR/bin/pypy3
53+
54+
if ! ($PYTHON_EXE -m ensurepip \
55+
&& $PYTHON_EXE -m pip install virtualenv \
56+
&& $PYTHON_EXE -m virtualenv testenv); then
57+
echo "pypy nightly is broken; skipping tests"
58+
exit 0
59+
fi
60+
source testenv/bin/activate
61+
fi
62+
63+
################################################################
64+
# We have a Python environment!
65+
################################################################
66+
67+
python -c "import sys, struct, ssl; print('#' * 70); print('python:', sys.version); print('version_info:', sys.version_info); print('bits:', struct.calcsize('P') * 8); print('openssl:', ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO); print('#' * 70)"
68+
69+
python -m pip install -U pip setuptools wheel
70+
python -m pip --version
71+
72+
python setup.py sdist --formats=zip
73+
python -m pip install dist/*.zip
74+
75+
if python -c 'import sys; sys.exit(sys.version_info >= (3, 7))'; then
76+
# Python < 3.7, select last ipython with 3.6 support
77+
# macOS requires the suffix for --in-place or you get an undefined label error
78+
sed -i'.bak' 's/ipython==[^ ]*/ipython==7.16.1/' test-requirements.txt
79+
sed -i'.bak' 's/traitlets==[^ ]*/traitlets==4.3.3/' test-requirements.txt
80+
git diff test-requirements.txt
81+
fi
82+
83+
if [ "$CHECK_FORMATTING" = "1" ]; then
84+
pip install yapf==${YAPF_VERSION}
85+
if ! yapf -rpd setup.py trio_asyncio; then
86+
cat <<EOF
87+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
88+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
89+
90+
Formatting problems were found (listed above). To fix them, run
91+
92+
pip install yapf==${YAPF_VERSION}
93+
yapf -rpi setup.py trio_asyncio
94+
95+
in your local checkout.
96+
97+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
98+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
99+
EOF
100+
exit 1
101+
fi
102+
exit 0
103+
fi
104+
105+
if [ "$CHECK_DOCS" = "1" ]; then
106+
python -m pip install -r docs-requirements.txt
107+
cd docs
108+
# -n (nit-picky): warn on missing references
109+
# -W: turn warnings into errors
110+
sphinx-build -nW -b html source build
111+
else
112+
# Actual tests
113+
python -m pip install -r test-requirements.txt
114+
115+
# We run the tests from inside an empty directory, to make sure Python
116+
# doesn't pick up any .py files from our working dir. Might have been
117+
# pre-created by some of the code above.
118+
mkdir empty || true
119+
cd empty
120+
121+
# We have to copy .coveragerc into this directory, rather than passing
122+
# --cov-config=../.coveragerc to pytest, because codecov.sh will run
123+
# 'coverage xml' to generate the report that it uses, and that will only
124+
# apply the ignore patterns in the current directory's .coveragerc.
125+
cp ../.coveragerc .
126+
if pytest -ra --junitxml=../test-results.xml --cov=trio_asyncio --verbose ../tests; then
127+
PASSED=true
128+
else
129+
PASSED=false
130+
fi
131+
132+
# The codecov docs recommend something like 'bash <(curl ...)' to pipe the
133+
# script directly into bash as its being downloaded. But, the codecov
134+
# server is flaky, so we instead save to a temp file with retries, and
135+
# wait until we've successfully fetched the whole script before trying to
136+
# run it.
137+
curl-harder -o codecov.sh https://codecov.io/bash
138+
bash codecov.sh -n "${JOB_NAME}"
139+
140+
$PASSED
141+
fi

0 commit comments

Comments
 (0)