-
-
Notifications
You must be signed in to change notification settings - Fork 8k
235 lines (222 loc) · 8.11 KB
/
ci-python.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Configuration for Python CI
# To force the execution of this workflow, add [run python] to your commit message
name: 'CI - Python'
on:
workflow_dispatch:
schedule:
- cron: '05 9,21 * * *'
push:
pull_request:
jobs:
check_workflow:
permissions:
contents: none
uses: ./.github/workflows/should-workflow-run.yml
with:
bazel-target-prefix: '//py'
# tox_flake8:
# if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
# needs: check_workflow
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source tree
# uses: actions/checkout@v2
# - name: Set up Python 3.7
# uses: actions/setup-python@v2
# with:
# python-version: 3.7.10
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install tox==2.4.1
# - name: Test with tox
# run: tox -c py/tox.ini
# env:
# TOXENV: flake8
# tox_docs:
# if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
# needs: check_workflow
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source tree
# uses: actions/checkout@v2
# - name: Set up Python 3.7
# uses: actions/setup-python@v2
# with:
# python-version: 3.7.10
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install tox==2.4.1
# - name: Test with tox
# run: tox -c py/tox.ini
# env:
# TOXENV: docs
# tox_mypy:
# if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
# needs: check_workflow
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source tree
# uses: actions/checkout@v2
# - name: Set up Python 3.7
# uses: actions/setup-python@v2
# with:
# python-version: 3.7.9
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install tox==2.4.1
# - name: Test with tox
# run: |
# tox -c py/tox.ini -- --cobertura-xml-report ci || true
# bash <(curl -s https://codecov.io/bash) -f py/ci/cobertura.xml
# env:
# TOXENV: mypy
# unit_tests:
# if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
# needs: check_workflow
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source tree
# uses: actions/checkout@v2
# - name: Cache Bazel artifacts
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache/bazel-disk
# ~/.cache/bazel-repo
# key: ${{ runner.os }}-bazel-python-unit-tests-${{ hashFiles('**/BUILD.bazel') }}
# restore-keys: |
# ${{ runner.os }}-bazel-python-unit-tests-
# - name: Setup bazelisk
# uses: ./.github/actions/setup-bazelisk
# - name: Set up Python 3.7
# uses: actions/setup-python@v2
# with:
# python-version: 3.7.10
# - name: Setup Java
# uses: actions/setup-java@v1
# with:
# java-version: '11'
# - name: Run unit tests
# uses: ./.github/actions/bazel
# with:
# command: test //py:unit
# chrome_tests:
# if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
# needs: [ check_workflow, unit_tests ]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source tree
# uses: actions/checkout@v2
# - name: Cache Bazel artifacts
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache/bazel-disk
# ~/.cache/bazel-repo
# key: ${{ runner.os }}-bazel-chrome-tests-${{ hashFiles('**/BUILD.bazel') }}
# restore-keys: |
# ${{ runner.os }}-bazel-chrome-tests-
# ${{ runner.os }}-bazel-python-unit-tests-
# - name: Setup bazelisk
# uses: ./.github/actions/setup-bazelisk
# - name: Set up Python 3.7
# uses: actions/setup-python@v2
# with:
# python-version: 3.7.10
# - name: Setup Java
# uses: actions/setup-java@v1
# with:
# java-version: '11'
# - name: Setup Chrome and ChromeDriver
# uses: ./.github/actions/setup-chrome
# - name: Start XVFB
# run: Xvfb :99 &
# - name: Run browser tests in Chrome
# uses: ./.github/actions/bazel-test
# with:
# query: //py:test-chrome
# attempts: 3
# env:
# DISPLAY: :99
# firefox_tests_remote:
# if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
# needs: [ check_workflow, unit_tests ]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout source tree
# uses: actions/checkout@v2
# - name: Cache Bazel artifacts
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache/bazel-disk
# ~/.cache/bazel-repo
# key: ${{ runner.os }}-bazel-firefox-tests-${{ hashFiles('**/BUILD.bazel') }}
# restore-keys: |
# ${{ runner.os }}-bazel-firefox-tests-
# ${{ runner.os }}-bazel-python-unit-tests-
# - name: Setup bazelisk
# uses: ./.github/actions/setup-bazelisk
# - name: Set up Python 3.7
# uses: actions/setup-python@v2
# with:
# python-version: 3.7.10
# - name: Setup Java
# uses: actions/setup-java@v1
# with:
# java-version: '11'
# - name: Setup Firefox and GeckoDriver
# uses: ./.github/actions/setup-firefox
# - name: Start XVFB
# run: Xvfb :99 &
# - name: Run browser tests in Firefox (Remote)
# uses: ./.github/actions/bazel
# with:
# command: test --jobs 1 //py:test-remote
# env:
# DISPLAY: :99
firefox_tests:
if: ${{ needs.check_workflow.outputs.result == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(toJson(github.event.commits), '[run python]') == true }}
needs: [ check_workflow, unit_tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout source tree
uses: actions/checkout@v2
- name: Cache Bazel artifacts
uses: actions/cache@v2
with:
path: |
~/.cache/bazel-disk
~/.cache/bazel-repo
key: ${{ runner.os }}-bazel-firefox-tests-${{ hashFiles('**/BUILD.bazel') }}
restore-keys: |
${{ runner.os }}-bazel-firefox-tests-
${{ runner.os }}-bazel-python-unit-tests-
- name: Setup bazelisk
uses: ./.github/actions/setup-bazelisk
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7.10
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Setup Firefox and GeckoDriver
uses: ./.github/actions/setup-firefox
- name: Install Fluxbox
run: sudo apt-get -y install fluxbox
- name: Start Xvfb
run: Xvfb :99 &
- name: Start Fluxbox
run: fluxbox -display :99 &
- name: Run browser tests in Firefox
uses: ./.github/actions/bazel-test
with:
query: //py:test-firefox
attempts: 3
env:
DISPLAY: :99