Skip to content

Commit a1612ea

Browse files
committed
ci: Add github actions script for test builds
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
1 parent 850c5db commit a1612ea

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
branches: [ "master", "stable-*" ]
6+
7+
jobs:
8+
build-ubuntu-focal:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Build
14+
run: |
15+
CFLAGS="-O3" ./autogen.sh --with-openssl --prefix=/usr --with-tpm2
16+
set +e
17+
make -j$((2 * $(nproc))) distcheck
18+
if [ $? -ne 0 ]; then
19+
for f in tests/*.log; do echo ">>>>>>> $f <<<<<<<"; tail -n 50 $f; done
20+
exit 1
21+
fi
22+
exit 0
23+
24+
build-coveralls-1:
25+
runs-on: ubuntu-22.04
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Build for coveralls.io
30+
run: |
31+
./autogen.sh --with-openssl --prefix=/usr --with-tpm2 --enable-test-coverage
32+
make -j$((2 * $(nproc)))
33+
make -j$((2 * $(nproc))) check
34+
sudo make install
35+
git clone https://github.com/stefanberger/swtpm.git
36+
pushd swtpm
37+
sudo apt -y install devscripts equivs python3-twisted expect \
38+
libtasn1-dev socat findutils gnutls-dev gnutls-bin tss2 \
39+
libjson-glib-dev libseccomp-dev
40+
./autogen.sh --with-gnutls --prefix=/usr
41+
set +e
42+
SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_IBMTSS2=1 make -j$((2 * $(nproc))) check
43+
rc=$?
44+
popd
45+
if [ $rc -eq 0 ]; then
46+
uidgid="$(id -nu):$(id -ng)"
47+
sudo chown -R ${uidgid} ./
48+
pip install setuptools==59.6.0 # Default Jammy version
49+
pip install cpp-coveralls
50+
cpp-coveralls -b src -e tests -e swtpm --gcov-options '\-lp'
51+
else
52+
for f in swtpm/tests/*.log; do echo ">>>>>>> $f <<<<<<<"; tail -n 50 $f; done
53+
exit 1
54+
fi
55+
exit 0
56+
env:
57+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
58+
59+
build-coveralls-2:
60+
runs-on: ubuntu-22.04
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Build for coveralls.io
65+
run: |
66+
./autogen.sh --with-openssl --prefix=/usr --with-tpm2 --enable-test-coverage --disable-use-openssl-functions
67+
make -j$((2 * $(nproc)))
68+
make -j$((2 * $(nproc))) check
69+
sudo make install
70+
git clone https://github.com/stefanberger/swtpm.git
71+
pushd swtpm
72+
sudo apt -y install devscripts equivs python3-twisted expect \
73+
libtasn1-dev socat findutils gnutls-dev gnutls-bin tss2 \
74+
libjson-glib-dev libseccomp-dev
75+
./autogen.sh --with-gnutls --prefix=/usr
76+
set +e
77+
SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_IBMTSS2=1 make -j$((2 * $(nproc))) check
78+
rc=$?
79+
popd
80+
if [ $rc -eq 0 ]; then
81+
uidgid="$(id -nu):$(id -ng)"
82+
sudo chown -R ${uidgid} ./
83+
pip install setuptools==59.6.0 # Default Jammy version
84+
pip install cpp-coveralls
85+
cpp-coveralls -b src -e tests -e swtpm --gcov-options '\-lp'
86+
else
87+
for f in swtpm/tests/*.log; do echo ">>>>>>> $f <<<<<<<"; tail -n 50 $f; done
88+
exit 1
89+
fi
90+
exit 0
91+
env:
92+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

0 commit comments

Comments
 (0)