Skip to content

Add E2E tests for bevy build#222

Merged
TimJentzsch merged 5 commits intomainfrom
221-test-build-commands
Jan 26, 2025
Merged

Add E2E tests for bevy build#222
TimJentzsch merged 5 commits intomainfrom
221-test-build-commands

Conversation

@TimJentzsch
Copy link
Collaborator

@TimJentzsch TimJentzsch commented Jan 12, 2025

Objective

Closes #221.

Improve our ability to catch errors in the Bevy CLI by using end-to-end tests, which install the CLI and execute it on a test repository.
This should help us prevent errors like #218 in the future.

Solution

Add a new test suite for bevy build in the integration tests folder.
It defines some utilities for the tests and then installs the CLI and executes bevy build commands on a test repository.

The test repository is currently a simple workspace with a singular Bevy application.
The Bevy app is just the minimal default setup.
In the future, we can expand this or add more packages to test more behavior.

The tests assert that the command exits successfully and that the expected binaries are created.
It tests dev and release profiles as well as the web equivalents.

The binaries are cleaned up before the tests to ensure that the checks work as intended, but other build artifacts are retained across runs to speed up the tests.
In the future, we might have to adjust our caching strategy for the integration tests, as the test repo uses a different target directory.

To avoid the tests conflicting with each other, I use serial_test to prevent them running in parallel.

We also now need to install the Bevy dependencies on Linux in CI, I adopted the strategy used by the Bevy repo.

Note

Keep in mind that running the tests will now overwrite your installed Bevy CLI version.

Future work

  • Improve CI caching of the E2E tests
  • Add tests for bevy build web --bundle
  • Find a way to test bevy run and bevy run web (they don't terminate, so are harder to test)
  • Find a better place to store the utility functions, so we can reuse them across tests

@TimJentzsch TimJentzsch added A-Build-System Related to CI and GitHub Actions C-Testing A change to the tests A-Build Related to the bevy build command D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Jan 12, 2025
@TimJentzsch TimJentzsch added the S-Needs-Review The PR needs to be reviewed before it can be merged label Jan 18, 2025
- Switch to`assert_cmd`
- rename the `dev` tests to `debug`
- rename `clean_target_binaries` to `clean_target_artifacts` and require
the path to be already set to the target instead of joining inside.
- Simplify `executable`
@TimJentzsch TimJentzsch enabled auto-merge (squash) January 26, 2025 21:31
@TimJentzsch TimJentzsch merged commit 9e8d455 into main Jan 26, 2025
8 checks passed
@TimJentzsch TimJentzsch deleted the 221-test-build-commands branch January 26, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Build Related to the bevy build command A-Build-System Related to CI and GitHub Actions C-Testing A change to the tests D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review The PR needs to be reviewed before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for build commands

3 participants

Comments