-
-
Notifications
You must be signed in to change notification settings - Fork 163
132 lines (123 loc) · 4.22 KB
/
ci.yaml
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
# The quick CI tests run on every push to a PR. They perform a quick check
# if the feature set and codebase are stable in general, but only for
# a representative selection of environments.
name: CI
on:
pull_request:
branches:
- main
- release/**
workflow_dispatch: {}
jobs:
linters:
name: Linting and static analysis
runs-on: ubuntu-22.04
timeout-minutes: 5 # usually 1-2, rarely 3 mins (because of installations)
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- run: pip install -r requirements.txt
- run: pre-commit run --all-files
- run: mypy kopf --strict
- run: |
# Mypying the examples
exit_codes=0
for d in $(find examples -maxdepth 1 -mindepth 1 -type d)
do
echo "Checking ${d}"
mypy $d
exit_codes=$[${exit_codes} + $?]
done
exit ${exit_codes}
unit-tests:
strategy:
fail-fast: false
matrix:
install-extras: [ "", "full-auth" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
include:
- install-extras: "uvloop"
python-version: "3.11"
name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }}
runs-on: ubuntu-22.04
timeout-minutes: 5 # usually 2-3 mins
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install -r requirements.txt
- run: pip install -e .[${{ matrix.install-extras }}]
if: ${{ matrix.install-extras }}
- run: pytest --color=yes --timeout=2 --cov=kopf --cov-branch
- name: Publish coverage to Coveralls.io
if: success()
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
continue-on-error: true
- name: Publish coverage to CodeCov.io
uses: codecov/codecov-action@v3
if: success()
env:
PYTHON: ${{ matrix.python-version }}
with:
flags: unit
env_vars: PYTHON
continue-on-error: true
# Only the core functionality is tested: no e2e or functional tests (for simplicity).
# No coverage: PyPy performs extremely poorly with tracing/coverage (13 mins vs. 3 mins).
# Extra time: 2-3 mins for building the dependencies (since no binary wheels are available).
# Extra time: PyPy is good with JIT for repetitive code; tests are too unique for JIT.
pypy-tests:
strategy:
fail-fast: false
matrix:
install-extras: [ "", "full-auth" ]
python-version: [ "pypy-3.8", "pypy-3.9", "pypy-3.10" ]
name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }}
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: sudo apt-get update && sudo apt-get install libxml2-dev libxslt-dev
- run: pip install wheel
- run: pip install -r requirements.txt
- run: pip install -e .[${{ matrix.install-extras }}]
if: ${{ matrix.install-extras }}
- run: pytest --color=yes --timeout=2 --no-cov
functional:
strategy:
fail-fast: false
matrix:
k3s: [latest, v1.27, v1.26, v1.25]
name: K3s ${{matrix.k3s}}
runs-on: ubuntu-22.04
timeout-minutes: 10 # usually 4-5 mins
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: nolar/setup-k3d-k3s@v1
with:
version: ${{ matrix.k3s }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: pip install -r requirements.txt -r examples/requirements.txt
- run: pytest --color=yes --timeout=30 --only-e2e
coveralls-finish:
name: Finalize coveralls.io
needs: [unit-tests, pypy-tests, functional]
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-python@v4
- run: pip install coveralls
- run: coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
continue-on-error: true