-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
ci: conditionally skip python and frontend tests #12583
Conversation
e44de25
to
ad10911
Compare
Codecov Report
@@ Coverage Diff @@
## master #12583 +/- ##
==========================================
- Coverage 66.75% 66.67% -0.08%
==========================================
Files 1015 1015
Lines 49634 49634
Branches 4839 4970 +131
==========================================
- Hits 33131 33094 -37
- Misses 16380 16417 +37
Partials 123 123
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
8d3f9bf
to
5e39697
Compare
5e39697
to
5262a77
Compare
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.
Wow this will reduce CI waiting time dramatically.
Thank you for that!
@ktmud could you help review and stamp it? |
You probably wouldn't want to ignore I'm also wondering what's the difference between this solution and using Github Action's built-in We can probably get away with something like this: name: E2E
on:
push:
branches-ignore:
- "dependabot/**/docs/**"
paths-ignore:
- "docs/**"
- *.md
- docker/**
- helm/**
pull_request:
paths-ignore:
- "docs/**"
- *.md
- docker/**
- helm/** # Python MySQL unit tests
name: Python MySQL
on:
push:
branches-ignore:
- "dependabot/npm_and_yarn/**"
paths:
- superset/**
- tests/**
- requirements/**
- scripts/**
- setup.py
pull_request:
paths:
- superset/**
- tests/**
- requirements/**
- scripts/**
- setup.py |
@ktmud using the github syntax causes the action to forever remain in a "pending" state which block PR merges for actions that are marked |
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.
LGTM. The python checks only took ~20s!
Right. Totally forgot about this... We've talked about this before, lol. |
Anyway, I still don't think you can skip |
.github/workflows/test-presto.yml
Outdated
continue-on-error: true | ||
run: | | ||
./scripts/ci_check_python_changes.sh | ||
./scripts/ci_check_python_test_changes.sh |
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.
Can we maybe parameterize this script to avoid creating two largely identical files?
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.
Anyway, I still don't think you can skip
test/*.py
for E2E tests.are we? I'm not seeing any changes to
superset-e2e.yml
I wanted to keep the scope of this PR as small as possible, hence didn't het add the E2E changes. Once this is merged I'll add similar logic to frontend and E2E tests.
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.
Another benefit of parameterizing this is to allow more advanced skipping in the future---for example, we may split/skip E2E tests based on product areas.
are we? I'm not seeing any changes to |
It was stated in the PR description as the reason for having two |
BTW, we should probably also skip |
Ah, I didn't read the PR description fully. I agree, since e2e is supposed to be out final catch-all check it should probably always run. Also there is code in |
Yes, I'll do this in a follow-up PR. |
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.
LGTM, just a non blocking comment, agree that E2E should run also on python changes
scripts/ci_check_python_changes.sh
Outdated
EOF | ||
|
||
if [[ "${FILES}" =~ (superset\/.+\.py|setup\.py|requirements\/.+\.txt) ]]; then | ||
echo "Detected changes in python files... Exiting with FAILURE code" |
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.
nit: seems logically odd that a script named check_python_changes
returns "False" if there were changes, assuming it's easier to detect if: steps.check.outcome == 'failure'
maybe rename the script to a negative
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.
That's a good point also. I'll rename the files to be in line with what's being asserted.
5262a77
to
6e488cc
Compare
The |
8bc148a
to
f10c40c
Compare
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.
This is great @villebro, one step forward to a faster CI
scripts/ci_check_no_file_changes.sh
Outdated
# To check for python and frontend changes, run with CHECKS="python frontend" | ||
|
||
URL="https://api.github.com/repos/${GITHUB_REPO}/pulls/${PR_NUMBER}/files" | ||
FILES=$(curl -s -X GET -G $URL | jq -r '.[] | .filename') |
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.
nit: SC2086: Double quote to prevent globbing and word splitting.
SUMMARY
This PR changes Python CI workflows to skip unit test execution for PRs that don't have changes that are relevant for those workflows. Here we're leveraging
continue-on-error
to check if files relevant to unit tests have changed, namelyPython changes:
tests/*
superset/*
requirements/*.txt
setup.py
Frontend changes:
superset_frontend/*
This is done to ensure that skipped workflows return a successful status for required checks despite not executing the expensive test steps. If any of the aforementioned file have changed, a failure exit code is triggered, which subsequent steps listen in on; if the check step returned a failure, the tests run, otherwise they are skipped.
To check changes, run
check_no_file_changes.sh
with the following arguments (theGITHUB_REPO
andPR_NUMBER
env variables need to be set):./check_no_file_changes.sh python
./check_no_file_changes.sh frontend
./check_no_file_changes.sh python frontend
(order doesn't matter)E2E tests have not been included in this PR, as some steps there depend in
failure()
which might need tweaking to run properly with this script.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Example of skipped frontend changes:
This shows the results for a PR with python changes:
When checking for both python and frontend changes on a PR with frontend changes, the following happens:
TEST PLAN
Tested to correctly detect frontend and python changes locally, as well as skip tests when they are not needed to run
ADDITIONAL INFORMATION