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

Add new GitHub Actions job to check that examples compile and are properly formatted #870

Merged
merged 7 commits into from
Feb 19, 2024

Conversation

simongoricar
Copy link
Contributor

This PR adds a new GitHub Actions job called test (examples) to the existing Utoipa build workflow. The job runs alongside the existing test (...) jobs, which means it will run on push or on a PR to master.

It validates all examples in the examples directory by checking that they are properly formatted (with cargo fmt --check) and that they can be compiled (with cargo clippy --all-features --all-targets --workspace --quiet).

I've modified the caching key for the new job so that it will be separate from other jobs, since this cache is likely to be quite large due to several full-fledged web frameworks being included, and I assume downloading it each time would slow down other tests that don't need it.

@simongoricar
Copy link
Contributor Author

simongoricar commented Feb 19, 2024

Oops, looks like one example requires nightly and the script fails if nightly isn't already installed (or rather, it doesn't like that the fmt component isn't installed).

This also installs the `clippy` and `rustfmt` components.
@simongoricar
Copy link
Contributor Author

Alright, the nightly problem is fixed. Fingers crossed that the caching works as well.

Copy link
Owner

@juhaku juhaku left a comment

Choose a reason for hiding this comment

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

🥇 🏆 Great addition, this really useful and been wanting to have but it has just been in the back burner.

@juhaku juhaku merged commit 8ab1e96 into juhaku:master Feb 19, 2024
6 checks passed
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