Skip to content

Commit b6b23b7

Browse files
authored
Merge pull request #358 from abhinavagarwal07/ci-platform-coverage
ci: add platform build coverage
2 parents 25b58aa + 8711fa1 commit b6b23b7

1 file changed

Lines changed: 149 additions & 0 deletions

File tree

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: platform builds
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
linux-compat:
17+
name: ${{ matrix.name }}
18+
runs-on: ${{ matrix.runner }}
19+
timeout-minutes: 15
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- name: ubuntu-latest
25+
runner: ubuntu-latest
26+
run_tests: true
27+
- name: ubuntu-22.04
28+
runner: ubuntu-22.04
29+
run_tests: true
30+
- name: ubuntu-24.04-arm
31+
runner: ubuntu-24.04-arm
32+
run_tests: true
33+
- name: ubuntu-24.04-release
34+
runner: ubuntu-24.04
35+
buildtype: release
36+
- name: ubuntu-24.04-debug
37+
runner: ubuntu-24.04
38+
buildtype: debug
39+
- name: ubuntu-24.04-hardened
40+
runner: ubuntu-24.04
41+
extra_cflags: "-D_FORTIFY_SOURCE=3 -fstack-protector-strong"
42+
steps:
43+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
47+
with:
48+
python-version: '3.12'
49+
50+
- name: Install dependencies
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y gcc ninja-build pkg-config libglib2.0-dev libfuse3-dev ${{ matrix.run_tests && 'openssh-server openssh-client fuse3' || '' }}
54+
pip3 install meson ${{ matrix.run_tests && 'pytest pytest-timeout' || '' }}
55+
56+
- name: Build
57+
env:
58+
CFLAGS: ${{ matrix.extra_cflags || '' }}
59+
run: |
60+
meson setup build ${{ matrix.buildtype && format('--buildtype={0}', matrix.buildtype) || '' }}
61+
ninja -C build
62+
63+
- name: Setup SSH
64+
if: matrix.run_tests
65+
run: |
66+
chmod go-w ~
67+
mkdir -p ~/.ssh
68+
chmod 700 ~/.ssh
69+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N ""
70+
cat ~/.ssh/id_ed25519.pub > ~/.ssh/authorized_keys
71+
chmod 600 ~/.ssh/authorized_keys
72+
sudo sed -i 's/^#*PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
73+
sudo systemctl restart ssh || sudo service ssh restart
74+
ssh -o StrictHostKeyChecking=no -o BatchMode=yes localhost true
75+
76+
- name: Check FUSE availability
77+
if: matrix.run_tests
78+
run: |
79+
test -e /dev/fuse
80+
command -v fusermount3
81+
82+
- name: Run tests
83+
if: matrix.run_tests
84+
timeout-minutes: 20
85+
run: |
86+
cd build
87+
python3 -m pytest test/ --timeout=300 --maxfail=99 --junitxml=test-results.xml
88+
89+
- name: Upload test results
90+
if: matrix.run_tests && always()
91+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
92+
with:
93+
name: test-results-${{ matrix.name }}
94+
path: |
95+
build/test-results.xml
96+
build/meson-logs/
97+
98+
- name: Upload build logs
99+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
100+
if: failure()
101+
with:
102+
name: build-logs-${{ matrix.name }}
103+
path: build/meson-logs/
104+
105+
alpine-musl:
106+
name: alpine-musl
107+
runs-on: ubuntu-24.04
108+
timeout-minutes: 15
109+
steps:
110+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
111+
112+
- name: Build in Alpine container
113+
run: |
114+
docker run --rm -v "$PWD:/work" -w /work alpine:3.21@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d sh -euxc '
115+
apk add --no-cache gcc musl-dev meson ninja pkgconf glib-dev fuse3-dev
116+
meson setup build-alpine
117+
ninja -C build-alpine
118+
'
119+
120+
- name: Upload build logs
121+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
122+
if: failure()
123+
with:
124+
name: build-logs-alpine-musl
125+
path: build-alpine/meson-logs/
126+
127+
freebsd:
128+
name: freebsd-14
129+
runs-on: ubuntu-24.04
130+
timeout-minutes: 20
131+
steps:
132+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
133+
134+
- name: Build on FreeBSD
135+
uses: vmactions/freebsd-vm@d1e65811565151536c0c894fff74f06351ed26e6 # v1.4.5
136+
with:
137+
usesh: true
138+
prepare: |
139+
pkg install -y fusefs-libs3 glib meson ninja pkgconf
140+
run: |
141+
meson setup build-freebsd
142+
ninja -C build-freebsd
143+
144+
- name: Upload build logs
145+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
146+
if: failure()
147+
with:
148+
name: build-logs-freebsd
149+
path: build-freebsd/meson-logs/

0 commit comments

Comments
 (0)