@@ -15,25 +15,33 @@ concurrency:
1515
1616jobs :
1717 build :
18- name : Build & Test
18+ name : Build & Test (Fedora ${{ matrix.fedora }}, ${{ matrix.compiler }})
1919 runs-on : ubuntu-latest
2020 strategy :
2121 fail-fast : false
2222 matrix :
2323 fedora : [41, 42]
24+ compiler : [gcc, clang]
2425 container :
2526 image : fedora:${{ matrix.fedora }}
2627
2728 steps :
2829 - name : Checkout repository
2930 uses : actions/checkout@v4
3031
32+ - name : Setup ccache
33+ uses : hendrikmuhs/ccache-action@v1.2
34+ with :
35+ key : ${{ runner.os }}-fedora${{ matrix.fedora }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt', 'src/**') }}
36+ max-size : 500M
37+
3138 - name : Install dependencies
3239 run : |
3340 dnf install -y \
3441 cmake \
3542 extra-cmake-modules \
3643 gcc-c++ \
44+ clang \
3745 ninja-build \
3846 qt6-qtbase-devel \
3947 qt6-qtdeclarative-devel \
@@ -44,19 +52,39 @@ jobs:
4452 clang-tools-extra \
4553 qt6-qtbase-private-devel \
4654 desktop-file-utils \
47- appstream
55+ appstream \
56+ ccache
57+
58+ - name : Setup compiler environment
59+ run : |
60+ if [ "${{ matrix.compiler }}" = "clang" ]; then
61+ echo "CC=clang" >> $GITHUB_ENV
62+ echo "CXX=clang++" >> $GITHUB_ENV
63+ else
64+ echo "CC=gcc" >> $GITHUB_ENV
65+ echo "CXX=g++" >> $GITHUB_ENV
66+ fi
67+ echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
68+ echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
4869
4970 - name : Configure (CMake)
5071 run : |
5172 cmake -B build \
5273 -GNinja \
5374 -DCMAKE_BUILD_TYPE=Release \
75+ -DCMAKE_C_COMPILER=${{ env.CC }} \
76+ -DCMAKE_CXX_COMPILER=${{ env.CXX }} \
77+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
78+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
5479 -DBUILD_TESTS=ON \
5580 -DREQUIRE_TRANSLATIONS=ON
5681
5782 - name : Build
5883 run : cmake --build build --parallel
5984
85+ - name : ccache statistics
86+ run : ccache -s
87+
6088 - name : Run tests
6189 run : ctest --test-dir build --output-on-failure
6290
@@ -65,11 +93,74 @@ jobs:
6593 desktop-file-validate data/icons/io.github.projectroasd.rocontrol.desktop
6694 appstreamcli validate --no-net data/icons/io.github.projectroasd.rocontrol.metainfo.xml
6795
96+ - name : Upload build artifacts
97+ uses : actions/upload-artifact@v4
98+ if : matrix.compiler == 'gcc' && matrix.fedora == 42
99+ with :
100+ name : ro-control-binary-fedora${{ matrix.fedora }}-${{ matrix.compiler }}
101+ path : |
102+ build/ro-control
103+ build/*.qm
104+ retention-days : 7
105+
106+ lint :
107+ name : Code Linting
108+ runs-on : ubuntu-latest
109+ container :
110+ image : fedora:42
111+
112+ steps :
113+ - name : Checkout repository
114+ uses : actions/checkout@v4
115+
116+ - name : Install dependencies
117+ run : |
118+ dnf install -y \
119+ clang-tools-extra \
120+ git
121+
68122 - name : Check formatting (clang-format)
69123 run : |
70124 find src \( -name "*.cpp" -o -name "*.h" \) -print0 | \
71125 xargs -0 clang-format --dry-run --Werror
72126
127+ security :
128+ name : Security Scanning
129+ runs-on : ubuntu-latest
130+ container :
131+ image : fedora:42
132+
133+ steps :
134+ - name : Checkout repository
135+ uses : actions/checkout@v4
136+
137+ - name : Install dependencies
138+ run : |
139+ dnf install -y \
140+ cmake \
141+ extra-cmake-modules \
142+ gcc-c++ \
143+ ninja-build \
144+ qt6-qtbase-devel \
145+ qt6-qtdeclarative-devel \
146+ qt6-qttools-devel \
147+ qt6-qtwayland-devel \
148+ kf6-qqc2-desktop-style \
149+ polkit-devel \
150+ clang-tools-extra
151+
152+ - name : Run clang-tidy
153+ run : |
154+ cmake -B build \
155+ -GNinja \
156+ -DCMAKE_BUILD_TYPE=Debug \
157+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
158+ -DBUILD_TESTS=OFF \
159+ -DREQUIRE_TRANSLATIONS=OFF
160+
161+ find src/backend -name "*.cpp" | xargs -I {} \
162+ clang-tidy {} -p build --warnings-as-errors="" || true
163+
73164 package-rpm :
74165 name : RPM Build Check
75166 runs-on : ubuntu-latest
@@ -80,6 +171,14 @@ jobs:
80171 - name : Checkout repository
81172 uses : actions/checkout@v4
82173
174+ - name : Cache DNF packages
175+ uses : actions/cache@v4
176+ with :
177+ path : /var/cache/dnf
178+ key : ${{ runner.os }}-dnf-rpm-${{ hashFiles('packaging/rpm/ro-control.spec') }}
179+ restore-keys : |
180+ ${{ runner.os }}-dnf-rpm-
181+
83182 - name : Install RPM tooling and dependencies
84183 run : |
85184 dnf install -y \
@@ -127,3 +226,12 @@ jobs:
127226 - name : Lint built RPMs
128227 run : |
129228 rpmlint ~/rpmbuild/RPMS/*/*.rpm || true
229+
230+ - name : Upload RPM artifacts
231+ uses : actions/upload-artifact@v4
232+ with :
233+ name : rpm-packages-ci
234+ path : |
235+ ~/rpmbuild/RPMS/*/*.rpm
236+ ~/rpmbuild/SRPMS/*.rpm
237+ retention-days : 7
0 commit comments