This repository has been archived by the owner on Sep 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (121 loc) · 3.53 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
133
134
135
136
137
138
139
140
141
142
143
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events.
push: {}
pull_request: {}
release:
types: [ published ]
# Run the pipeline daily so that we get continuous dogfooding and coverage of the latest Python
# and PyTest patch versions.
schedule:
# Run at 6pm UTC/10am Pacific
- cron: 0 18 * * *
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: { }
defaults:
run:
shell: bash -eo pipefail {0}
jobs:
check:
name: Typecheck, lint, and check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install tox
id: install
run: |
python -m pip install --upgrade pip
pip install tox==4.0.1
- name: Typecheck
run: tox -e mypy
- name: Lint
if: ${{ always() && steps.install.outcome == 'success' }}
run: tox -e flake8
- name: Check code style
if: ${{ always() && steps.install.outcome == 'success' }}
run: tox -e pycodestyle
- name: Build PyPI package
if: ${{ always() && steps.install.outcome == 'success' }}
run: |
pip install build==0.9.0 twine==4.0.2
python -m build
pytest_integration_tests:
name: "PyTest Integration Tests: py${{ matrix.python }}-${{ matrix.tox_env }}-${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs:
# Don't incur the cost of the test matrix if the basic build fails.
- check
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
tox_env:
- pytest62
- pytest62-xdist
- pytest70
- pytest70-xdist
- pytest71
- pytest71-xdist
- pytest72
- pytest72-xdist
- pytest73
- pytest73-xdist
- pytest74
- pytest74-xdist
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox==4.0.1
- name: Test
run: |
UNFLAKABLE_API_KEY=${{ secrets.UNFLAKABLE_API_KEY }} \
tox -e ${{ matrix.tox_env }} \
--override testenv.pass_env=UNFLAKABLE_API_KEY \
--override testenv.basepython=python${{ matrix.python }} \
-- \
--enable-unflakable \
--test-suite-id 2AT4xgduQdwkVKSaO0qJ2Dqm2JY \
-s \
-v
publish:
name: Publish to PyPI
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs:
- check
- pytest_integration_tests
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build==0.9.0 twine==4.0.2
- name: Build package
run: |
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}