-
Notifications
You must be signed in to change notification settings - Fork 451
190 lines (172 loc) · 6.29 KB
/
!PR.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
name: PR
on:
pull_request_target:
types:
- opened
- synchronize
- ready_for_review
- labeled
jobs:
env: # setup shared env
runs-on: ubuntu-latest
permissions: { }
outputs:
python-version: '3.9'
source-ref: refs/pull/${{github.event.pull_request.number}}/merge
upload-binaries: >-
${{ contains(github.event.pull_request.labels.*.name, 'PR: upload binaries') }}
steps:
- run: echo done
changes: # detect changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
src: ${{ steps.filter.outputs.src }}
scripts: ${{ steps.filter.outputs.scripts }}
doc: ${{ steps.filter.outputs.doc }}
build: ${{ steps.filter.outputs.build }}
steps:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- '.github/workflows/pytest.yml'
- '.github/workflows/guitest.yml'
- '.github/workflows/coverage.yml'
- '.github/actions/**'
- 'src/**'
- 'requirements*'
scripts:
- '.github/workflows/scripttest.yml'
- '.github/actions/**'
- 'scripts/**'
- 'src/**'
- 'requirements*'
doc:
- '.github/workflows/documentation.yml'
- '.github/actions/**'
- 'doc/**'
- 'src/**'
- 'requirements*'
build:
- '.github/workflows/build*.yml'
- '.github/actions/**'
- 'build/**'
- 'src/**'
- 'requirements*'
gatekeeper: # check user's permissions
runs-on: ubuntu-latest
permissions: read-all
steps:
- name: Check if PR has label
id: label_check
uses: docker://agilepathway/pull-request-label-checker:v1.2.9
with:
one_of: 'PR: safe to check'
repo_token: ${{ secrets.GITHUB_TOKEN }}
allow_failure: true
- name: Check if user has write access
if: steps.label_check.outputs.label_check == 'failure'
uses: lannonbr/repo-permission-check-action@2bb8c89ba8bf115c4bfab344d6a6f442b24c9a1f
with:
permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ----------------------------------------------------------------------------
# PR stage: Draft
coverage_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/coverage.yml
secrets:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
with:
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}
guitest_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.src == 'true' }}
uses: ./.github/workflows/guitest.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["windows-latest"]}'
ref: ${{needs.env.outputs.source-ref}}
application_tester_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.scripts == 'true'}}
uses: ./.github/workflows/application_tester.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["ubuntu-latest"]}'
ref: ${{needs.env.outputs.source-ref}}
scripttest_draft:
needs: [ changes, gatekeeper, env ]
if: ${{ needs.changes.outputs.scripts == 'true' }}
uses: ./.github/workflows/scripttest.yml
with:
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}
# ----------------------------------------------------------------------------
# PR stage: Ready
pytest:
needs: [ changes, gatekeeper, env ]
if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/pytest.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["windows-latest", "macos-latest"]}'
ref: ${{needs.env.outputs.source-ref}}
guitest:
needs: [ changes, gatekeeper, env ]
if: ${{needs.changes.outputs.src == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/guitest.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["ubuntu-latest", "macos-latest"]}'
ref: ${{needs.env.outputs.source-ref}}
application_tester:
needs: [ changes, gatekeeper, env ]
if: ${{ (needs.changes.outputs.src == 'true' || needs.changes.outputs.scripts == 'true') && !github.event.pull_request.draft}}
uses: ./.github/workflows/application_tester.yml
with:
python-version: ${{needs.env.outputs.python-version}}
matrix: '{"os": ["windows-latest", "macos-latest"]}'
ref: ${{needs.env.outputs.source-ref}}
# build binaries
ubuntu:
needs: [ changes, env ]
if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/build_ubuntu.yml
with:
upload: ${{ needs.env.outputs.upload-binaries == 'true' }}
os: ubuntu-latest
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}
mac:
needs: [ changes, env ]
if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/build_mac.yml
with:
upload: ${{ needs.env.outputs.upload-binaries == 'true' }}
os: macos-latest
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}
windows:
needs: [ changes, env ]
if: ${{needs.changes.outputs.build == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/build_windows.yml
with:
upload: ${{ needs.env.outputs.upload-binaries == 'true' }}
os: windows-latest
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}
# check documentation build
documentation:
needs: [ changes, env ]
if: ${{needs.changes.outputs.doc == 'true' && !github.event.pull_request.draft}}
uses: ./.github/workflows/documentation.yml
with:
python-version: ${{needs.env.outputs.python-version}}
ref: ${{needs.env.outputs.source-ref}}