Skip to content

Conversation

@mtjhrc
Copy link
Collaborator

@mtjhrc mtjhrc commented Sep 24, 2025

This refactors the CI code, removes the usage of the no longer maintained actions-rs GitHub action, and adds more checks:

  • check if we have up-to-date Cargo.lock files committed
  • check (cargo fmt and clippy) the examples workspace
  • check (cargo-fmt and clippy) the tests workspace

This also resolves the small issues (rustfmt + clippy) uncovered by the new checks

@mtjhrc mtjhrc changed the title CI improvments CI improvements Sep 24, 2025
@mtjhrc mtjhrc force-pushed the ci-improvments branch 23 times, most recently from 6cd9153 to 8251bdd Compare September 29, 2025 15:02
Drop the usage of 'actions-rs/toolchain@v1` which doesn't seem to be maintained
anymore (the repository is archived). Instead let's follow the official guide by
GitHub on building Rust projects[1].

In order to not duplicate the code, introduce a custom GitHub Action to set up our
build env, including native libraries and rust toolchain.

Split the github workflows into 4 files:
 - formatting.yml -        Linux only - rustfmt nor clang-format shall be be effected
                           by target platform, they don't process conditional
                           compilation (previously was checked on multiple
                           platforms)
 - intergation-tests.yml - runs integration tests (Linux x86_64 only, because of
                           GitHub limitations)
 - unit-tests.yml        - still x86_64 Linux only for now
 - code-quality.yml - runs `cargo clippy` on Linux (x86_64, aarch64) and macOS
                      with respective supported features

[1]: https://docs.github.com/en/actions/tutorials/build-and-test-code/rust

Signed-off-by: Matej Hrica <mhrica@redhat.com>
By using the `cargo clippy --locked` flag, we can assert that the commited lock
files match the commited Cargo.toml.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
@mtjhrc mtjhrc force-pushed the ci-improvments branch 2 times, most recently from 8a41fd1 to e35c855 Compare September 29, 2025 16:33
@mtjhrc mtjhrc marked this pull request as ready for review September 30, 2025 07:47
@mtjhrc mtjhrc force-pushed the ci-improvments branch 2 times, most recently from 57c1177 to e35c855 Compare September 30, 2025 12:19
- name: Setup build environment
uses: ./.github/actions/setup-build-env

- name: Cache GLib 2.82 + GTK 4.16 build

Choose a reason for hiding this comment

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

What is the motivation behind building GTK manually?

Choose a reason for hiding this comment

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

Sorry, I just saw that in the commit message but wouldn't using a fedora container be enough?

Choose a reason for hiding this comment

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

In any case, gtk would build glib automatically if the required version is not installed. So you can drop the glib build part

Copy link
Collaborator Author

@mtjhrc mtjhrc Sep 30, 2025

Choose a reason for hiding this comment

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

Yeah I realized maybe I should have done that. But then we would have to maintain both list of build libraries for Fedora and for Ubuntu in the CI (not sure if we can get KVM in a container). Anyways I'm hoping we can just drop this once Ubuntu 26.04 LTS is released.

Choose a reason for hiding this comment

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

In any case, gtk would build glib automatically if the required version is not installed. So you can drop the glib build part

This would only work if you pull from git though but i guess what you have is good enough. When it comes to build deps, installing libgtk4-dev should pull all the needed deps i guess

Verify that the the executable gui_vm (and its dependency gtk_display) examples can
compile without warnings using `cargo clippy`.

This requires a newer version of GTK than we have in the CI, to solve build the
required GTK version from source and cache the built GTK libraries in Github cache.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Add test-prefix target for building and installing libkrun to the test prefix prefix
without actually running the tests.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Run cargo clippy on tests workspace to ensure there aren't any warnings.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
@slp
Copy link
Collaborator

slp commented Sep 30, 2025

This one looks great, nice work here @mtjhrc

@slp slp merged commit 357ec63 into containers:main Sep 30, 2025
13 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.

3 participants