Skip to content
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 CI overhaul #2209

Merged
merged 2 commits into from
Oct 31, 2024
Merged

Test CI overhaul #2209

merged 2 commits into from
Oct 31, 2024

Conversation

tbro
Copy link
Contributor

@tbro tbro commented Oct 24, 2024

This PR:

Speeds up tests in CI. Total duration is now < 20 min. Currently on main tests take about twice as long. You can see the successful workflow here.

  • instead of --release we set a lower optimization level
    • packages that require higher optimization are specified individually
  • application and test binaries are built in parallel
  • unit tests and integration/e2e tests are run in parallel

Switching from --release to test profile has the benefit of shorter build times as well as catching more errors. There is a fix included for builder using duplicated -m short options. This sort of error will cause some tests to fail now with these changes. And availability options were added to more process-compose services to catch more failures early. An additional improvement would be to run slow tests in parallel w/ unit tests. I'm not currently aware of a way to include slow tests in this workflow w/out making it required for merge.

How to test this PR:

If tests pass faster than what we see in earlier commits, its a winner.

@sveitser
Copy link
Collaborator

@tbro I noticed when working on #2232, that I need to set the opt-level to 1 for some tests to pass. Not sure that would be helpful here but in case you haven't tried.

@tbro tbro force-pushed the tb/test-tests branch 4 times, most recently from 65c64c4 to eb7dc07 Compare October 30, 2024 18:44
@tbro tbro changed the title Try adding specific test profile configuration. Test CI overhaul Oct 31, 2024
@tbro tbro enabled auto-merge (squash) October 31, 2024 05:19

- uses: actions/checkout@v4
with:
# By default actions/checkout checks out a merge commit. Check out the PR head instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to check out the PR head instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something but I thought we want to merge the PR into main and use that to run the CI so that we are confident things work after a future merge into main.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I guess I'm confused about what is happening there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- name: Enable Rust Caching
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good idea? Doesn't it mean that if we have a failure we only get a partial cache and if we afterwards get a successful build for the same cache key we don't save it and keep a partial cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why it would prevent the cache from being saved on a successful run. But I'll remove it isn't adding much any way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -41,25 +43,23 @@ jobs:
with:
submodules: recursive

- name: Configure Environment
run: PATH="$PWD/target/debug:$PATH"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made this change in test.yaml a while back. I think it works b/c we are running all the steps on the same host... so we don't need any additional persistence. Also we are not creating a new variable, we are simply appending to PATH and PATH is always exported on the host. For it not to work I think github would have to do some variable resetting between steps.

@@ -7,7 +7,7 @@ if [ -z "${IN_NIX_SHELL-}" ]; then
REPO_ROOT="$(dirname "$(dirname "$(readlink -fm "$0")")")"
# Default to CARGO_TARGET_DIR if set, otherwise use the default target directory.
TARGET_DIR="${CARGO_TARGET_DIR:-${REPO_ROOT}/target}"
export "PATH=${TARGET_DIR}/release:$PATH"
export "PATH=${TARGET_DIR}/debug:$PATH"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think this will confuse people who have been building with release. I think we should log something prominent to the terminal about this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speeds up tests in CI. Total duration is now < 20 min. Currently on
main tests take about twice as long. You can see the successful
workflow here.

  * instead of --release we set a lower optimization level
    * packages that require higher optimization are specified individually
  * application and test binaries are built in parallel
  * unit tests and integration/e2e tests are run in parallel

Switching from --release to test profile has the benefit of shorter
build times as well as catching more errors. There is a fix included
for builder using duplicated -m short options. This sort of error will
cause some tests to fail now with these changes. And availability
options were added to more process-compose services to catch more
failures early. An additional improvement would be to run slow tests
in parallel w/ unit tests. I'm not currently aware of a way to include
slow tests in this workflow w/out making it required for merge.
@tbro tbro requested a review from sveitser October 31, 2024 16:43
@tbro tbro merged commit eac777f into main Oct 31, 2024
17 of 19 checks passed
@tbro tbro deleted the tb/test-tests branch October 31, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants