-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEST] skipping GA checks with labels #1498
base: main
Are you sure you want to change the base?
Changes from all commits
b7b4bc3
9df781f
9737660
027d356
861b272
982f6af
49dc541
2e78675
cad80e1
29910ce
22df54b
a26b6fb
1ed7ed2
d632e7d
b794529
cc6dfb3
bad66ce
d41bd4d
0b6dae7
a59a8de
ac0e8e2
ecb3c29
2555c9c
7702528
8f47fa3
1b6550f
a96d66d
62ff1d7
1203042
d2a2d26
394af81
17091fd
8bddbe6
257f661
e29d317
9a5c987
edb1845
fd404f8
3e18a3d
750ff34
a08cf6f
5bc851a
3415a92
a54fb82
f6d3a59
481d223
46f49f3
c48aa7a
b6c8713
4a5a0de
45b5351
a673b43
e394acd
3007865
5de928d
9fba6b3
1e45265
b640871
b0ee3cd
35aba22
bb03564
1b02fbc
6e84fd4
eaa0494
61254ac
6a1e1e5
29ed517
ae446f3
6304e6d
c1e5a9e
f7d729d
a02ad93
6e83c02
42d5d70
17c5569
a2bbb92
466afc2
8cbabd0
c925366
6d5006c
eabafec
da99f18
7b5ce0b
4c9460b
7a5dfa8
232debb
30b9c2f
3b5f800
439f366
23a6e44
a0fe0e8
488b347
fdc7340
14aa200
d4e9046
067dd88
5951a0c
9f1984d
9f27e9f
0ee36a1
eb2ebff
e912c5b
e4d3a35
050d3ec
6dbd14a
7f52a9d
ed4308b
a8ec2d4
0e641a8
dcc9b94
1f2bfa2
9dabe81
a28abb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,9 +9,82 @@ on: | |||||
tags: | ||||||
- v* | ||||||
pull_request: | ||||||
types: | ||||||
- opened | ||||||
- reopened | ||||||
- synchronize | ||||||
- labeled | ||||||
- unlabeled | ||||||
workflow_dispatch: | ||||||
|
||||||
jobs: | ||||||
skips-allowed: | ||||||
name: Determine CI Skipping | ||||||
runs-on: ubuntu-latest | ||||||
|
||||||
env: | ||||||
IS_PR: ${{ github.event_name == 'pull_request' }} | ||||||
SKIP_DOCUMENTATION_LABEL: 'GA Skip Documentation' | ||||||
SKIP_COMPREHENSIVE_LABEL: 'GA Skip Comprehensive Tests' | ||||||
SKIPS_ALLOWED_LABEL: 'GA Skip Merge Allowed' | ||||||
|
||||||
SKIP_DOCUMENTATION: false | ||||||
SKIP_COMPREHENSIVE: false | ||||||
SKIPS_ALLOWED: false | ||||||
|
||||||
SKIPS_DONE: false | ||||||
|
||||||
outputs: | ||||||
SKIP_DOCUMENTATION: ${{ env.SKIP_DOCUMENTATION }} | ||||||
SKIP_COMPREHENSIVE: ${{ env.SKIP_COMPREHENSIVE }} | ||||||
SKIPS_ALLOWED: ${{ env.SKIPS_ALLOWED }} | ||||||
SKIPS_DONE: ${{ env.SKIPS_DONE }} | ||||||
|
||||||
steps: | ||||||
- name: Determine Skips | ||||||
id: step1 | ||||||
if: ${{ env.IS_PR }} | ||||||
StanczakDominik marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
run: | | ||||||
SKIP=${{ contains(github.event.pull_request.labels.*.name, env.SKIP_DOCUMENTATION_LABEL) }} | ||||||
echo "SKIP_DOCUMENTATION=${SKIP}" >> $GITHUB_ENV | ||||||
|
||||||
SKIP=${{ contains(github.event.pull_request.labels.*.name, env.SKIP_COMPREHENSIVE_LABEL) }} | ||||||
echo "SKIP_COMPREHENSIVE=${SKIP}" >> $GITHUB_ENV | ||||||
|
||||||
SKIP=${{ contains(github.event.pull_request.labels.*.name, env.SKIPS_ALLOWED_LABEL) }} | ||||||
echo "SKIPS_ALLOWED=${SKIP}" >> $GITHUB_ENV | ||||||
|
||||||
- name: Skip Documentation? ${{ env.SKIP_DOCUMENTATION }} | ||||||
run: | | ||||||
echo "Documentation can be skipped: ${{ env.SKIP_DOCUMENTATION }}" | ||||||
if ${{ env.SKIP_DOCUMENTATION }}; then | ||||||
echo "SKIPS_DONE=true" >> $GITHUB_ENV | ||||||
fi | ||||||
- name: Skip Comprehensive Tests? ${{ env.SKIP_COMPREHENSIVE }} | ||||||
run: | | ||||||
echo "Comprehensive tests can be skipped: ${{ env.SKIP_COMPREHENSIVE }}" | ||||||
if ${{ env.SKIP_COMPREHENSIVE }}; then | ||||||
echo "SKIPS_DONE=true" >> $GITHUB_ENV | ||||||
fi | ||||||
|
||||||
mergeble-with-skips: | ||||||
name: Skipping and Merge Allowed? | ||||||
runs-on: ubuntu-latest | ||||||
needs: skips-allowed | ||||||
|
||||||
env: | ||||||
SKIPS_ALLOWED: ${{ needs.skips-allowed.outputs.SKIPS_ALLOWED }} | ||||||
SKIPS_DONE: ${{ needs.skips-allowed.outputs.SKIPS_DONE }} | ||||||
|
||||||
steps: | ||||||
- name: Skip Tests Allowed? ${{ env.SKIPS_ALLOWED }} | ||||||
run: | | ||||||
echo "Is skipping tests allowed: ${{ env.SKIPS_ALLOWED }}" | ||||||
if [[ "$SKIPS_ALLOWED" == "false" && "$SKIPS_DONE" == "true" ]]; then | ||||||
echo "Some tests are skipped, but skipping needs to be removed before merging!!" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd love to make this message more actionable by doing something like this:
Suggested change
but I expect it won't work because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this would work. I originally didn't write something like this because I only wanted us to know about the "skips allows" functionality. Only we should be adding that label and not the common contributor. |
||||||
exit 1 | ||||||
fi | ||||||
|
||||||
initial-tests: | ||||||
name: ${{ matrix.name }} | ||||||
runs-on: ${{ matrix.os }} | ||||||
|
@@ -46,7 +119,10 @@ jobs: | |||||
comprehensive-tests: | ||||||
name: ${{ matrix.name }} | ||||||
runs-on: ${{ matrix.os }} | ||||||
needs: initial-tests | ||||||
|
||||||
if: ${{ needs.skips-allowed.outputs.SKIP_COMPREHENSIVE == 'false' }} | ||||||
needs: [initial-tests, skips-allowed] | ||||||
Comment on lines
+123
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct |
||||||
|
||||||
strategy: | ||||||
fail-fast: false | ||||||
matrix: | ||||||
|
@@ -78,7 +154,6 @@ jobs: | |||||
python: 3.9 | ||||||
toxenv: py39 | ||||||
|
||||||
|
||||||
steps: | ||||||
- name: Checkout code | ||||||
uses: actions/checkout@v3 | ||||||
|
@@ -101,6 +176,8 @@ jobs: | |||||
with: | ||||||
file: ./coverage.xml | ||||||
documentation: | ||||||
if: ${{ needs.skips-allowed.outputs.SKIP_DOCUMENTATION == 'false' }} | ||||||
needs: skips-allowed | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I don't understand is... does this only run if you're enabling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Since the |
||||||
name: Documentation | ||||||
runs-on: ubuntu-latest | ||||||
strategy: | ||||||
|
@@ -120,6 +197,7 @@ jobs: | |||||
run: sudo apt-get install graphviz pandoc | ||||||
- name: Run tests | ||||||
run: tox -e build_docs -- -q | ||||||
|
||||||
build-n-publish: | ||||||
name: Packaging | ||||||
runs-on: ubuntu-18.04 | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if I understand it correctly, this
skips-allowed
job does the logic, puts the result into env vars, and thisoutputs
field, which I'm seeing for the first time, lets you pass those env vars to the next stage. That's reasonable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I originally tries this by defining
env
on the workflow level, but it turns out the workflow levelenv
just acts as an initialization for the job levelenv
. So, if I modify an environment variable injob1
then that doesn't carry over tojob2
. The only way I've found that I can pass this information between jobs is usingoutputs
for the job.