Skip to content

Commit

Permalink
workflows: Add some CI checks
Browse files Browse the repository at this point in the history
Based on the workflows I contributed to bubblewrap, which in turn were
loosely based on the ones in Flatpak.

Signed-off-by: Simon McVittie <smcv@collabora.com>
  • Loading branch information
smcv authored and cgwalters committed Nov 11, 2022
1 parent d96d2a0 commit 92c332d
Show file tree
Hide file tree
Showing 2 changed files with 210 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI checks

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check:
name: Build with Autotools and gcc, and test
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v1
- name: Install build-dependencies
run: sudo ./packaging/builddeps.sh
- name: Create logs dir
run: mkdir test-logs
- name: autogen.sh
run: NOCONFIGURE=1 ./autogen.sh
- name: configure
run: |
mkdir _build
pushd _build
../configure \
--enable-installed-tests \
--enable-man \
${NULL+}
popd
env:
CFLAGS: >-
-O2
-Wp,-D_FORTIFY_SOURCE=2
-fsanitize=address
-fsanitize=undefined
- name: make
run: |
make -C _build -j $(getconf _NPROCESSORS_ONLN) V=1
- name: check
run: |
make -C _build -j $(getconf _NPROCESSORS_ONLN) check VERBOSE=1
env:
ASAN_OPTIONS: detect_leaks=0
- name: install
run: |
make -C _build install DESTDIR="$(pwd)/DESTDIR"
( cd DESTDIR && find -ls )
sudo make -C _build install
- name: installed-tests
run: |
ginsttest-runner -L test-logs --tap git-evtag
env:
ASAN_OPTIONS: detect_leaks=0
- name: distcheck
run: |
make -C _build -j $(getconf _NPROCESSORS_ONLN) distcheck VERBOSE=1
env:
ASAN_OPTIONS: detect_leaks=0
- name: Collect test logs on failure
if: failure() || cancelled()
run: |
mv _build/test-suite/*.log test-logs/ || true
mv _build/tests/*.log test-logs/ || true
- name: Upload test logs
uses: actions/upload-artifact@v1
if: failure() || cancelled()
with:
name: test logs
path: test-logs

clang:
name: Build with clang
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Install build-dependencies
run: sudo ./packaging/builddeps.sh --clang
- name: autogen.sh
run: NOCONFIGURE=1 ./autogen.sh
# Do this one as an in-tree build to prove we can
- name: configure
run: |
./configure \
--enable-installed-tests \
--enable-man \
${NULL+}
env:
CC: clang
CFLAGS: >-
-O2
-Werror=unused-variable
- name: make
run: make -j $(getconf _NPROCESSORS_ONLN) V=1
113 changes: 113 additions & 0 deletions packaging/builddeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env bash
# Copyright 2021 Simon McVittie
# SPDX-License-Identifier: LGPL-2.0-or-later

set -eux
set -o pipefail

usage() {
if [ "${1-2}" -ne 0 ]; then
exec >&2
fi
cat <<EOF
Usage: see source code
EOF
exit "${1-2}"
}

opt_clang=

getopt_temp="help"
getopt_temp="$getopt_temp,clang"

getopt_temp="$(getopt -o '' --long "${getopt_temp}" -n "$0" -- "$@")"
eval set -- "$getopt_temp"
unset getopt_temp

while true; do
case "$1" in
(--clang)
clang=yes
shift
;;

(--help)
usage 0
# not reached
;;

(--)
shift
break
;;

(*)
echo 'Error parsing options' >&2
usage 2
;;
esac
done

# No more arguments please
for arg in "$@"; do
usage 2
done

if dpkg-vendor --derives-from Debian; then
apt-get -y update
apt-get -q -y install \
autoconf \
automake \
build-essential \
docbook-xml \
docbook-xsl \
git \
gnome-desktop-testing \
gnupg \
libgit2-glib-1.0-dev \
libtool \
meson \
pkg-config \
python3 \
xsltproc \
${NULL+}

if [ -n "${opt_clang}" ]; then
apt-get -y install clang
fi

exit 0
fi

if command -v yum; then
yum -y install \
autoconf \
automake \
docbook-style-xsl \
gcc \
git \
gnome-desktop-testing \
gnupg2 \
libasan \
libtool \
libtsan \
libubsan \
libxslt \
make \
meson \
pkgconfig(libgit2-glib-1.0) \
redhat-rpm-config \
rsync \
${NULL+}

if [ -n "${opt_clang}" ]; then
yum -y install clang
fi

exit 0
fi

echo "Unknown distribution" >&2
exit 1

# vim:set sw=4 sts=4 et:

0 comments on commit 92c332d

Please sign in to comment.