-
Notifications
You must be signed in to change notification settings - Fork 133
CI improvements #417
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
Merged
Merged
CI improvements #417
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dbafb4e
CI: Refactor CI, drop `actions-rs/toolchain@v1`
mtjhrc bf6973a
CI/code-quality: Check if our Cargo.lock files are up-to-date
mtjhrc 68365f4
CI/formatting: Check tests and Rust examples
mtjhrc f4653df
CI/code-quality: Check gui_vm/gtk_display example
mtjhrc 0a691a2
Makefile: Split test target into test-prefix and test
mtjhrc 8b71d1f
CI/integration-tests: Add clippy checks for integration tests
mtjhrc 1936753
tests: Fix formatting (cargo fmt)
mtjhrc 709342b
tests: Fix clippy warning
mtjhrc 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: 'Setup Build Environment' | ||
| description: 'Common setup for Rust builds with all required packages (Linux & macOS)' | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Install Rust toolchain | ||
| shell: bash | ||
| run: | | ||
| rustup update stable | ||
| rustup default stable | ||
| rustup component add rustfmt clippy | ||
|
|
||
| - name: Cache Cargo dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Set up Homebrew (macOS) | ||
| if: runner.os == 'macOS' | ||
| uses: Homebrew/actions/setup-homebrew@master | ||
|
|
||
| - name: Install packages (macOS) | ||
| if: runner.os == 'macOS' | ||
| shell: bash | ||
| run: brew tap slp/krunkit && brew install virglrenderer clang-format llvm | ||
|
|
||
| - name: Install packages (Linux) | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| libvirglrenderer-dev \ | ||
| libepoxy-dev \ | ||
| libdrm-dev \ | ||
| libpipewire-0.3-dev \ | ||
| clang-format \ | ||
| libclang-dev |
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 |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| name: Code Quality | ||
| on: [pull_request] | ||
|
|
||
| jobs: | ||
| code-quality-linux-x86_64: | ||
| name: libkrun (Linux x86_64) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup build environment | ||
| uses: ./.github/actions/setup-build-env | ||
|
|
||
| - name: Create a fake init | ||
| run: touch init/init | ||
|
|
||
| - name: Clippy (default) | ||
| run: cargo clippy --locked -- -D warnings | ||
|
|
||
| - name: Clippy (amd-sev) | ||
| run: cargo clippy --locked --features amd-sev -- -D warnings | ||
|
|
||
| - name: Clippy (tdx) | ||
| run: cargo clippy --locked --features tdx -- -D warnings | ||
|
|
||
| - name: Clippy (net+blk+gpu+snd) | ||
| run: cargo clippy --locked --features net,blk,gpu,snd -- -D warnings | ||
|
|
||
| code-quality-linux-aarch64: | ||
| name: libkrun (Linux aarch64) | ||
| runs-on: ubuntu-24.04-arm | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup build environment | ||
| uses: ./.github/actions/setup-build-env | ||
|
|
||
| - name: Create a fake init | ||
| run: touch init/init | ||
|
|
||
| - name: Clippy (default) | ||
| run: cargo clippy --locked -- -D warnings | ||
|
|
||
| - name: Clippy (net+blk+gpu+snd) | ||
| run: cargo clippy --locked --features net,blk,gpu,snd -- -D warnings | ||
|
|
||
| code-quality-macos: | ||
| name: libkrun (macOS aarch64) | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup build environment | ||
| uses: ./.github/actions/setup-build-env | ||
|
|
||
| - name: Create a fake init | ||
| run: touch init/init | ||
|
|
||
| - name: Clippy (efi+gpu) | ||
| run: cargo clippy --locked --features efi,gpu -- -D warnings | ||
|
|
||
| code-quality-examples: | ||
| name: ${{ matrix.name }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - name: "Examples (Linux x86_64)" | ||
| runner: ubuntu-latest | ||
|
|
||
| - name: "Examples (Linux aarch64)" | ||
| runner: ubuntu-24.04-arm | ||
| runs-on: ${{ matrix.runner }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup build environment | ||
| uses: ./.github/actions/setup-build-env | ||
|
|
||
| - name: Cache GLib 2.82 + GTK 4.16 build | ||
| uses: actions/cache@v4 | ||
| id: gtk-cache | ||
| with: | ||
| path: ~/gtk-prefix | ||
| key: ${{ runner.os }}-${{ runner.arch }}-gtk-4.16.0 | ||
|
|
||
| - name: Install GTK system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -yqq --no-install-recommends \ | ||
| libffi-dev \ | ||
| libmount-dev \ | ||
| libpcre2-dev \ | ||
| zlib1g-dev \ | ||
| libcairo2-dev \ | ||
| libpango1.0-dev \ | ||
| libgdk-pixbuf-2.0-dev \ | ||
| libgraphene-1.0-dev \ | ||
| libepoxy-dev \ | ||
| libxkbcommon-dev \ | ||
| wayland-protocols \ | ||
| libwayland-dev | ||
|
|
||
| - name: Add GLib + GTK paths to environment | ||
| run: | | ||
| case "$(uname -m)" in | ||
| x86_64) | ||
| GTK_PKG_CONFIG_PATH="$HOME/gtk-prefix/lib/x86_64-linux-gnu/pkgconfig" | ||
| GTK_LIB_PATH="$HOME/gtk-prefix/lib/x86_64-linux-gnu" ;; | ||
| aarch64) | ||
| GTK_PKG_CONFIG_PATH="$HOME/gtk-prefix/lib/aarch64-linux-gnu/pkgconfig" | ||
| GTK_LIB_PATH="$HOME/gtk-prefix/lib/aarch64-linux-gnu" ;; | ||
| *) | ||
| echo "ERROR: Unsupported architecture: $(uname -m)" | ||
| exit 1 ;; | ||
| esac | ||
|
|
||
| echo "PKG_CONFIG_PATH=$GTK_PKG_CONFIG_PATH:$PKG_CONFIG_PATH" >> $GITHUB_ENV | ||
| echo "LD_LIBRARY_PATH=$GTK_LIB_PATH:$LD_LIBRARY_PATH" >> $GITHUB_ENV | ||
|
|
||
| - name: Build and install GTK 4.16 from source | ||
| if: steps.gtk-cache.outputs.cache-hit != 'true' | ||
| run: | | ||
| # Install build-only dependencies | ||
| sudo apt-get install -yqq --no-install-recommends \ | ||
| build-essential \ | ||
| meson \ | ||
| ninja-build | ||
|
|
||
|
|
||
| # Build GLib first | ||
| cd /tmp | ||
| curl -L -o glib-2.82.2.tar.xz https://download.gnome.org/sources/glib/2.82/glib-2.82.2.tar.xz | ||
| tar -xf glib-2.82.2.tar.xz | ||
| cd glib-2.82.2 | ||
| meson setup builddir --prefix=$HOME/gtk-prefix --buildtype=release | ||
| meson compile -C builddir | ||
| meson install -C builddir | ||
|
|
||
| # Build GTK | ||
| cd /tmp | ||
| curl -L -o gtk-4.16.0.tar.xz https://download.gnome.org/sources/gtk/4.16/gtk-4.16.0.tar.xz | ||
| tar -xf gtk-4.16.0.tar.xz | ||
| cd gtk-4.16.0 | ||
| meson setup builddir --prefix=$HOME/gtk-prefix --buildtype=release \ | ||
| -Dmedia-gstreamer=disabled \ | ||
| -Dintrospection=disabled \ | ||
| -Dx11-backend=false \ | ||
| -Dprint-cups=disabled \ | ||
| -Dcloudproviders=disabled \ | ||
| -Dtracker=disabled \ | ||
| -Dcolord=disabled \ | ||
| -Dsysprof=disabled \ | ||
| -Dvulkan=disabled | ||
| meson compile -C builddir | ||
| meson install -C builddir | ||
|
|
||
| - name: Build and install libkrun to local prefix | ||
| run: | | ||
| mkdir -p $HOME/libkrun-prefix | ||
| GPU=1 NET=1 INPUT=1 PREFIX=$HOME/libkrun-prefix make && PREFIX=$HOME/libkrun-prefix make install | ||
|
|
||
| - name: Clippy (examples workspace) | ||
| run: | | ||
| cd examples | ||
| PKG_CONFIG_PATH="$HOME/libkrun-prefix/lib64/pkgconfig:$PKG_CONFIG_PATH" LD_LIBRARY_PATH="$HOME/libkrun-prefix/lib64:$LD_LIBRARY_PATH" cargo clippy --locked -- -D warnings | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.
What is the motivation behind building GTK manually?
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.
Sorry, I just saw that in the commit message but wouldn't using a fedora container be enough?
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.
In any case, gtk would build glib automatically if the required version is not installed. So you can drop the glib build part
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
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.
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