-
Notifications
You must be signed in to change notification settings - Fork 167
167 lines (138 loc) · 5.42 KB
/
code-quality.yml
File metadata and controls
167 lines (138 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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+input)
run: cargo clippy --locked --features net,blk,gpu,snd,input -- -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+input)
run: cargo clippy --locked --features net,blk,gpu,snd,input -- -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
env:
KRUN_INIT_BINARY_PATH: ${{ github.workspace }}/init/init
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