-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (114 loc) · 3.78 KB
/
ci.yml
File metadata and controls
132 lines (114 loc) · 3.78 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
name: CI
"on":
push:
branches: [main, dev, feat/**, feature/**, fix/**, hotfix/**, chore/**]
pull_request:
branches: [main, dev]
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
strategy:
fail-fast: false
matrix:
fedora: [41, 42]
container:
image: fedora:${{ matrix.fedora }}
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 \
qt6-qtbase-private-devel \
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
runs-on: ubuntu-latest
container:
image: fedora:42
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-qtbase-private-devel \
qt6-qtdeclarative-devel \
qt6-qttools-devel \
qt6-qtwayland-devel \
kf6-qqc2-desktop-style \
polkit-devel
- 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: |
rpmbuild -ba "${HOME}/rpmbuild/SPECS/ro-control.spec" \
--define "_topdir ${HOME}/rpmbuild" \
--define "upstream_version ${{ steps.prep.outputs.version }}"
- name: Lint built RPMs
run: |
rpmlint ~/rpmbuild/RPMS/*/*.rpm || true