-
Notifications
You must be signed in to change notification settings - Fork 136
Speed up CI to complete within 15min (down from 25min) by switching off coverage except for the matrix entry that's uploaded #1861
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
Open
corneliusroemer
wants to merge
13
commits into
master
Choose a base branch
from
speed-up-ci
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0959454
Only test coverage for one matrix combination to reduce runtime
corneliusroemer 5cde03f
try more
corneliusroemer 8e4776c
try explicilty running without pytest_cov
corneliusroemer aa3878e
try --no-cov
corneliusroemer b2389bb
Set sysmon env variable
corneliusroemer 7f18e3c
Only use sysmon for Python > 3.12
corneliusroemer 01372c8
f
corneliusroemer 112d66b
Move when coverage variables are set
corneliusroemer 0d64e61
f
corneliusroemer f3d8b38
f
corneliusroemer b21ef1b
Update run_tests.sh
corneliusroemer 84afce0
Apply suggestions from code review
corneliusroemer 81ed5bc
Merge branch 'master' into speed-up-ci
corneliusroemer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,50 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Default to running all tests. | ||
| # Default to running all tests without coverage. | ||
| partial_test=0 | ||
| run_coverage=0 | ||
|
|
||
| # Check if user explicitly requests coverage | ||
| case "$@" in | ||
| *--cov*) run_coverage=1 ;; | ||
| esac | ||
|
|
||
| # If user requests a subset of tests for pytest, note this preference to avoid | ||
| # running other tests. | ||
| case "$@" in | ||
| *-k*) partial_test=1 ;; | ||
| esac | ||
|
|
||
| if [ "$partial_test" = 1 ]; then | ||
| # skip test coverage when running a subset of the test suite | ||
| coverage_arg='--no-cov' | ||
| if [ "$run_coverage" = 1 ]; then | ||
| # Remove --cov from args since pytest will handle coverage via --cov=augur | ||
| echo "Running tests with coverage enabled, remove --cov to disable" | ||
| filtered_args=$(echo "$*" | sed 's/--cov//g') | ||
| coverage_arg='--cov=augur' | ||
|
|
||
| # Set env variable COVERAGE_CORE to sysmon for coverage | ||
| # This reduces overhead of coverage collection | ||
| # But only if Python version >3.14 | ||
| if python3 -c 'import sys; print(sys.version_info >= (3, 14))' | grep -q True; then | ||
| echo "Using sysmon for coverage to reduce overhead" | ||
| export COVERAGE_CORE=sysmon | ||
| else | ||
| echo "Using default coverage collection method" | ||
| fi | ||
| else | ||
| coverage_arg='' | ||
| # Default to no coverage | ||
| echo "Running tests without coverage, use --cov to enable" | ||
| filtered_args="$*" | ||
| coverage_arg='--no-cov' | ||
| fi | ||
|
|
||
| echo "Running unit tests and doctests with pytest" | ||
| python3 -m pytest $coverage_arg "$@" | ||
| python3 -m pytest $coverage_arg $filtered_args | ||
|
|
||
| # Only run functional tests if we are not running a subset of tests for pytest. | ||
| if [ "$partial_test" = 0 ]; then | ||
| echo "Running functional tests with cram" | ||
| cram tests/ | ||
| else | ||
| echo "Skipping functional tests when running a subset of unit tests" | ||
| echo "Skipping functional (cram) tests when running a subset of unit tests" | ||
| fi | ||
|
|
||
| exit $? |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I should rebase this and resolve merge conflicts