-
Notifications
You must be signed in to change notification settings - Fork 1
195 lines (180 loc) · 7.25 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: ci
on:
push:
branches: [ "*" ]
schedule:
# Every day at 2:02.
- cron: '2 2 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 20 # stop runaway job after 20 minutes
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, ubuntu-20.04, macos-13, macos-12, macos-11, windows-2022 ]
python-version: [ '3.9', '3.10', '3.11', '3.12-dev']
env:
SHELLOUS_DEBUG: 1
BUILD_NAME: build (${{ matrix.os }},${{ matrix.python-version }})
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Install dependencies
run: |
pip3 install -U setuptools wheel
pip3 install -r ./ci/requirements-dev.txt
- name: Lint
if: matrix.python-version != '3.12-dev'
run: |
ruff check --exit-zero .
pylint -v --fail-under 9.5 shellous
# Run pylint on tests directory with some checks disabled.
pylint --disable=C0116,C0103,R0903,W0212,C0302,C0415 --fail-under 9.1 tests
pyright || echo "Failed."
- name: Run Tests
run: |
if ! pytest -vv -s --durations=20 --log-cli-level=DEBUG | ./ci/annotate.awk -v step=Run_Tests; then
echo "::warning title=Run Tests Warning::Re-running failed tests in $BUILD_NAME"
pytest -vv -s --durations=20 --log-cli-level=DEBUG --last-failed
fi
- name: Run Code Coverage (Linux and MacOS)
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-12') && matrix.python-version != '3.12-dev'
run: |
# Run coverage.
coverage run --source shellous -m pytest
# Re-run with coverage for shellous/watcher.py
SHELLOUS_CHILDWATCHER_TYPE=default coverage run --source shellous -m pytest
# Re-run with coverage for shellous/watcher.py and ThreadStrategy.
SHELLOUS_CHILDWATCHER_TYPE=default SHELLOUS_THREADSTRATEGY=1 coverage run --source shellous -m pytest
env:
SHELLOUS_CODE_COVERAGE: 1
- name: Upload Code Coverage
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-12') && matrix.python-version != '3.12-dev'
uses: codecov/codecov-action@v3
with:
verbose: true
- name: Run Tests with uvloop (Linux and MacOS)
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-12') && matrix.python-version != '3.12-dev'
run: |
pip3 install uvloop
# Ignore ResourceWarning with uvloop for now (TODO).
if ! pytest -vv -s --log-cli-level=DEBUG -W ignore::ResourceWarning; then
echo "::warning title=uvloop Warning::Re-running failed tests in $BUILD_NAME"
pytest -vv -s --log-cli-level=DEBUG -W ignore::ResourceWarning --last-failed
fi
env:
SHELLOUS_LOOP_TYPE: "uvloop"
- name: Run Tests with eager task factory
if: matrix.python-version == '3.12-dev'
run: |
if ! pytest -vv -s --durations=20 --log-cli-level=DEBUG | ./ci/annotate.awk -v step=Run_Tests; then
echo "::warning title=Run Tests Warning::Re-running failed tests in $BUILD_NAME"
pytest -vv -s --durations=20 --log-cli-level=DEBUG --last-failed
fi
env:
SHELLOUS_LOOP_TYPE: "eager_task_factory"
- name: Run Tests with PidfdWatcher (Linux)
if: matrix.os == 'ubuntu-22.04'
run: |
if ! pytest -vv -s --log-cli-level=DEBUG; then
echo "::warning title=PidfdChildWatcher Warning::Re-running failed tests in $BUILD_NAME"
pytest -vv -s --log-cli-level=DEBUG --last-failed
fi
env:
SHELLOUS_CHILDWATCHER_TYPE: "pidfd"
- name: Run Tests with SafeChildWatcher (Linux and MacOS)
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-12') && matrix.python-version != '3.12-dev'
run: |
if ! pytest -vv -s --log-cli-level=DEBUG; then
echo "::warning title=SafeChildWatcher Warning::Re-running failed tests in $BUILD_NAME"
pytest -vv -s --log-cli-level=DEBUG --last-failed
fi
env:
SHELLOUS_CHILDWATCHER_TYPE: "safe"
- name: Run Tests with DefaultChildWatcher (Linux and MacOS)
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-12'
run: |
if ! pytest -vv -s --log-cli-level=DEBUG | ./ci/annotate.awk -v step=DefaultChildWatcher; then
echo "::warning title=DefaultChildWatcher Warning::Re-running failed tests in $BUILD_NAME"
pytest -vv -s --log-cli-level=DEBUG --last-failed
fi
env:
SHELLOUS_CHILDWATCHER_TYPE: "default"
- name: Verify Types
if: matrix.python-version != '3.12-dev'
run: |
PYTHONPATH=. pyright --verifytypes shellous || echo "::warning title=Pyright Warning::Verify types failed"
- name: Format Check
run: |
black --check .
isort --check .
build-alpine:
runs-on: ubuntu-latest
timeout-minutes: 20 # stop runaway job after 20 minutes
strategy:
fail-fast: false
matrix:
image-tag: ['python:3.10-alpine', 'python:3.11-alpine']
container:
image: ${{ matrix.image-tag }}
env:
SHELLOUS_DEBUG: 1
BUILD_NAME: build (${{ matrix.image-tag }})
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
apk add --update gcc musl-dev python3-dev
pip3 install -r ./ci/requirements-dev.txt
- name: Run Tests
run: |
ps ; echo "alpine" `cat /etc/alpine-release` ; env
if ! pytest -v -s --log-cli-level=DEBUG; then
echo "::warning title=Run Tests Warning::Re-running failed tests in $BUILD_NAME"
pytest -v -s --log-cli-level=DEBUG --last-failed
fi
- name: Run Tests with DefaultChildWatcher
run: |
if ! pytest -v -s --log-cli-level=DEBUG; then
echo "::warning title=DefaultChildWatcher Warning::Re-running failed tests in $BUILD_NAME"
pytest -v -s --log-cli-level=DEBUG --last-failed
fi
env:
SHELLOUS_CHILDWATCHER_TYPE: "default"
build-pypy:
runs-on: ubuntu-latest
timeout-minutes: 20 # stop runaway job after 20 minutes
strategy:
fail-fast: false
matrix:
pypy-version: [ 'pypy-3.9', 'pypy-3.10']
env:
SHELLOUS_DEBUG: 1
BUILD_NAME: build (${{ matrix.pypy-version }})
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pypy-version }}
- name: Install dependencies
run: |
pip3 install -U setuptools wheel
pip3 install -r ./ci/requirements-dev.txt
- name: Run Tests
run: |
pytest -vv -s --durations=20 --log-cli-level=DEBUG -W ignore::pytest.PytestUnraisableExceptionWarning
- name: Run Tests with DefaultChildWatcher
run: |
pytest -vv -s --log-cli-level=DEBUG -W ignore::pytest.PytestUnraisableExceptionWarning
env:
SHELLOUS_CHILDWATCHER_TYPE: "default"