-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (150 loc) · 5.56 KB
/
ci.yml
File metadata and controls
178 lines (150 loc) · 5.56 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
168
169
170
171
172
173
174
175
176
177
178
name: CI
"on":
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
container:
image: fedora:43
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies
run: |
dnf install -y \
cmake \
extra-cmake-modules \
gcc-c++ \
ninja-build \
qt6-qtbase-devel \
qt6-qtdeclarative-devel \
qt6-qttools-devel \
qt6-qtwayland-devel \
kf6-qqc2-desktop-style \
polkit-devel \
clang-tools-extra \
desktop-file-utils \
appstream
- name: Configure (CMake)
run: |
cmake -B build \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=ON \
-DREQUIRE_TRANSLATIONS=ON
- name: Build
run: cmake --build build --parallel
- name: Run tests
run: ctest --test-dir build --output-on-failure
- name: Validate desktop metadata
run: |
desktop-file-validate data/icons/io.github.projectroasd.rocontrol.desktop
appstreamcli validate --no-net data/icons/io.github.projectroasd.rocontrol.metainfo.xml
- name: Check formatting (clang-format)
run: |
find src \( -name "*.cpp" -o -name "*.h" \) -print0 | \
xargs -0 clang-format --dry-run --Werror
package-rpm:
name: RPM Build Check (Fedora 43)
runs-on: ubuntu-latest
container:
image: fedora:43
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install RPM tooling and dependencies
run: |
dnf install -y \
git \
rpm-build \
rpmlint \
cmake \
extra-cmake-modules \
gcc-c++ \
ninja-build \
qt6-qtbase-devel \
qt6-qtdeclarative-devel \
qt6-qttools-devel \
qt6-qtwayland-devel \
kf6-qqc2-desktop-style \
polkit-devel \
desktop-file-utils \
appstream
- name: Prepare source tarball
id: prep
run: |
VERSION="$(sed -n 's/^[[:space:]]*VERSION[[:space:]]\([0-9.][0-9.]*\)$/\1/p' CMakeLists.txt | head -n1)"
if [[ -z "${VERSION}" ]]; then
echo "Failed to read project version from CMakeLists.txt" >&2
exit 1
fi
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
ARCHIVE_BASENAME="ro-control-${VERSION}"
mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS
STAGE_DIR="$(mktemp -d)"
cp -a . "${STAGE_DIR}/${ARCHIVE_BASENAME}"
rm -rf "${STAGE_DIR}/${ARCHIVE_BASENAME}/.git" \
"${STAGE_DIR}/${ARCHIVE_BASENAME}/build" \
"${STAGE_DIR}/${ARCHIVE_BASENAME}/build-"*
tar -C "${STAGE_DIR}" -czf "${HOME}/rpmbuild/SOURCES/${ARCHIVE_BASENAME}.tar.gz" "${ARCHIVE_BASENAME}"
rm -rf "${STAGE_DIR}"
cp packaging/rpm/ro-control.spec "${HOME}/rpmbuild/SPECS/ro-control.spec"
- name: Build RPM
run: |
FEDORA_VERSION=43
rpmbuild -ba "${HOME}/rpmbuild/SPECS/ro-control.spec" \
--define "_topdir ${HOME}/rpmbuild" \
--define "upstream_version ${{ steps.prep.outputs.version }}" \
--define "dist .fc${FEDORA_VERSION}"
- name: Validate desktop metadata
run: |
desktop-file-validate data/icons/io.github.projectroasd.rocontrol.desktop
appstreamcli validate --no-net data/icons/io.github.projectroasd.rocontrol.metainfo.xml
- name: Verify Fedora 43 RPM compatibility
run: |
MAIN_RPM="$(find ~/rpmbuild/RPMS -maxdepth 2 -type f -name 'ro-control-*.x86_64.rpm' | head -n1)"
COMMON_RPM="$(find ~/rpmbuild/RPMS -maxdepth 2 -type f -name 'ro-control-common-*.noarch.rpm' | head -n1)"
if [[ -z "${MAIN_RPM}" ]]; then
echo "Failed to locate ro-control x86_64 RPM." >&2
exit 1
fi
if [[ -z "${COMMON_RPM}" ]]; then
echo "Failed to locate ro-control-common noarch RPM." >&2
exit 1
fi
rpm -qpR "${MAIN_RPM}" | tee /tmp/ro-control.requires
if grep -E 'Qt_6\.10|PRIVATE_API' /tmp/ro-control.requires; then
echo "Forbidden Qt private or Fedora 44-era Qt ABI dependency detected." >&2
exit 1
fi
rpm -qpl "${MAIN_RPM}" | grep -Fx '/usr/bin/ro-control'
if rpm -qpl "${COMMON_RPM}" | grep -Fx '/usr/bin/ro-control'; then
echo "/usr/bin/ro-control must not be shipped by ro-control-common." >&2
exit 1
fi
cp "${MAIN_RPM}" /tmp/ro-control-x86_64.rpm
cp "${COMMON_RPM}" /tmp/ro-control-common-noarch.rpm
- name: Install and smoke-test RPMs
run: |
MAIN_RPM=/tmp/ro-control-x86_64.rpm
COMMON_RPM=/tmp/ro-control-common-noarch.rpm
dnf clean all
dnf -y --refresh --setopt=install_weak_deps=False install "${MAIN_RPM}" "${COMMON_RPM}"
rpm -q ro-control
command -v ro-control
rpm -q --whatprovides /usr/bin/ro-control | grep -Fx 'ro-control'
ldd -r /usr/bin/ro-control
- name: Lint built RPMs
run: |
rpmlint ~/rpmbuild/RPMS/*/*.rpm || true