From 10187b3c885e0d88a23059a67b0eb48b119d1e59 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 13 Dec 2024 14:10:18 -0500 Subject: [PATCH] ci: Add github actions script for test builds Signed-off-by: Stefan Berger --- .github/workflows/ci.yml | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..69ebc2129 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: Check + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master", "stable-*" ] + +jobs: + build-ubuntu-focal: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + CFLAGS="-O3" ./autogen.sh --with-openssl --prefix=/usr --with-tpm2 + make -j$(nproc) distcheck + if [ $? -ne 0 ]; then + for f in tests/*.log; do echo ">>>>>>> $f <<<<<<<"; tail -n 50 $f; done + fi + + build-coveralls-1: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Build for coveralls.io + run: | + ./autogen.sh --with-openssl --prefix=/usr --with-tpm2 --enable-test-coverage + make -j$(nproc) + make -j$(nproc) check + sudo make install + git clone https://github.com/stefanberger/swtpm.git + pushd swtpm + sudo apt -y install devscripts equivs python3-twisted expect \ + libtasn1-dev socat findutils gnutls-dev gnutls-bin tss2 \ + libjson-glib-dev libseccomp-dev + ./autogen.sh --with-gnutls --prefix=/usr + set +e + SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_IBMTSS2=1 make -j$(nproc) check + if [ $? -eq 0 ]; then + uidgid="$(id -nu):$(id -ng)" + sudo chown -R ${uidgid} ./ + cpp-coveralls -b src -e tests -e swtpm --gcov-options '\-lp' + else + for f in tests/*.log; do echo ">>>>>>> $f <<<<<<<"; tail -n 50 $f; done + exit 1 + fi + popd + exit 0 + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + + build-coveralls-2: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + ./autogen.sh --with-openssl --prefix=/usr --with-tpm2 --enable-test-coverage --disable-use-openssl-functions + make -j$(nproc) + make -j$(nproc) check + sudo make install + git clone https://github.com/stefanberger/swtpm.git + pushd swtpm + sudo apt -y install devscripts equivs python3-twisted expect \ + libtasn1-dev socat findutils gnutls-dev gnutls-bin tss2 \ + libjson-glib-dev libseccomp-dev + ./autogen.sh --with-gnutls --prefix=/usr + SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_IBMTSS2=1 make -j$(nproc) check + if [ $? -eq 0 ]; then + uidgid="$(id -nu):$(id -ng)" + sudo chown -R ${uidgid} ./ + cpp-coveralls -b src -e tests -e swtpm --gcov-options '\-lp' + else + for f in tests/*.log; do echo ">>>>>>> $f <<<<<<<"; tail -n 50 $f; done + exit 1 + fi + popd + exit 0 + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}