Skip to content

Commit 0d63773

Browse files
ci: add gcc/clang matrix with -Werror
- Expand build job into gcc/clang matrix with fail-fast: false - Pass -Dwerror=true so compiler warnings fail the build - Pin all actions to Node 24-capable full SHAs (checkout v6.0.2, setup-python v6.2.0, upload-artifact v7.0.1) - Add least-privilege permissions, concurrency cancellation - Pin python-version to 3.12, pin runner to ubuntu-24.04 - Add explicit SSH setup with sshd start, hard-fail FUSE preflight - Add pytest --timeout=300, --maxfail=99, JUnit XML, test result artifacts per compiler
1 parent 88692b7 commit 0d63773

1 file changed

Lines changed: 86 additions & 25 deletions

File tree

.github/workflows/build-ubuntu.yml

Lines changed: 86 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@ concurrency:
1919

2020
jobs:
2121
build-and-test:
22-
name: Build and test
22+
name: ${{ matrix.compiler }} / ${{ matrix.buildtype }}
2323
runs-on: ubuntu-24.04
2424
timeout-minutes: 30
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
compiler: [gcc, clang]
29+
buildtype: [debugoptimized, release]
30+
include:
31+
- compiler: gcc
32+
cc: gcc
33+
- compiler: clang
34+
cc: clang
2535
steps:
2636
- name: Checkout code
2737
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -34,50 +44,101 @@ jobs:
3444
- name: Install build dependencies
3545
run: |
3646
sudo apt-get update
37-
sudo apt-get install -y valgrind gcc ninja-build libglib2.0-dev libfuse3-dev openssh-server openssh-client fuse3
38-
39-
- name: Check FUSE availability
40-
run: |
41-
test -e /dev/fuse
42-
command -v fusermount3
47+
sudo apt-get install -y gcc clang ninja-build libglib2.0-dev libfuse3-dev openssh-server openssh-client fuse3
4348
4449
- name: Install meson
4550
run: pip3 install meson pytest pytest-timeout
4651

47-
- name: build
52+
- name: Print tool versions
4853
run: |
49-
meson setup build
50-
ninja -C build
51-
52-
# cd does not persist across steps
53-
- name: upload build artifact
54-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
55-
with:
56-
name: sshfs
57-
path: build/sshfs
58-
if-no-files-found: ignore
54+
${{ matrix.cc }} --version
55+
meson --version
5956
6057
- name: Setup SSH
6158
run: |
6259
mkdir -p ~/.ssh
6360
chmod 700 ~/.ssh
64-
ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""
65-
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
61+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N ""
62+
cat ~/.ssh/id_ed25519.pub > ~/.ssh/authorized_keys
6663
chmod 600 ~/.ssh/authorized_keys
6764
sudo systemctl start ssh || sudo service ssh start
6865
ssh -o StrictHostKeyChecking=no -o BatchMode=yes localhost true
6966
70-
- name: run tests
67+
- name: Check FUSE availability
68+
run: |
69+
test -e /dev/fuse
70+
command -v fusermount3
71+
72+
- name: Build
73+
env:
74+
CC: ${{ matrix.cc }}
7175
run: |
72-
cd build
73-
python3 -m pytest test/ --timeout=300 --junitxml=test-results.xml --maxfail=99
76+
meson setup build --buildtype=${{ matrix.buildtype }} -Dwerror=true -Dwarning_level=3
77+
ninja -C build
78+
79+
- name: Upload build artifact
80+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
81+
with:
82+
name: sshfs-${{ matrix.compiler }}-${{ matrix.buildtype }}
83+
path: build/sshfs
84+
if-no-files-found: ignore
85+
86+
- name: Run tests
7487
timeout-minutes: 20
88+
run: |
89+
cd build
90+
python3 -m pytest --maxfail=99 --timeout=300 --junitxml=test-results.xml test/
7591
76-
- name: upload test results
92+
- name: Upload test results
7793
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
7894
if: always()
7995
with:
80-
name: test-results
96+
name: test-results-${{ matrix.compiler }}-${{ matrix.buildtype }}
8197
path: |
8298
build/test-results.xml
8399
build/meson-logs/
100+
101+
strict-warnings:
102+
name: ${{ matrix.compiler }} / strict warnings
103+
runs-on: ubuntu-24.04
104+
timeout-minutes: 20
105+
continue-on-error: true
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
include:
110+
- compiler: gcc
111+
cc: gcc
112+
extra_cflags: "-Wformat=2 -Wformat-security -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wnull-dereference"
113+
- compiler: clang
114+
cc: clang
115+
extra_cflags: "-Wformat=2 -Wformat-security -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wnull-dereference"
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
119+
120+
- name: Set up Python
121+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
122+
with:
123+
python-version: '3.12'
124+
125+
- name: Install build dependencies
126+
run: |
127+
sudo apt-get update
128+
sudo apt-get install -y gcc clang ninja-build libglib2.0-dev libfuse3-dev
129+
130+
- name: Install meson
131+
run: pip3 install meson
132+
133+
- name: Print tool versions
134+
run: |
135+
${{ matrix.cc }} --version
136+
meson --version
137+
138+
- name: Build with strict warnings
139+
env:
140+
CC: ${{ matrix.cc }}
141+
CFLAGS: ${{ matrix.extra_cflags }}
142+
run: |
143+
meson setup build -Dwerror=true -Dwarning_level=3
144+
ninja -C build

0 commit comments

Comments
 (0)