From b7a4402aebb4c4d9958f8bdac600ecd204f8737c Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Tue, 22 Jun 2021 10:56:37 -0700 Subject: gitlab-ci: Add build configs. Define builds for gitlab's continuous integration runners so we some feedback on versions of the code hosted there, particularly https://gitlab.xiph.org/xiph/flac. Build with GNU Autotools, with CMake+ninja, and verify the Makefile.lite build. This uses the same Debian-based docker.io/library/gcc:9 container image we use for most of the codec projects. That container doesn't specify an unprivileged user so that we can install packages. However, some of flac's file-creation tests must be run as an unprivileged user who owns the source tree. We therefore create a user account and use `su` to run the tests. In the case of the autotools job, `make distcheck` unpacks the packaged source, so this takes care of ownership. In the case of the other jobs, we must `chown` the entire checkout and complete the build as the unprivileged user. Another way to address this would be to define a custom container image with the prerequisites installed before switching to an unprivileged user for the entire build. The current approach was simpler to get working. --- .gitlab-ci.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..119d3825 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,53 @@ +default: + tags: + - docker + # Image from https://hub.docker.com/_/gcc/ based on Debian + image: gcc:9 + +autotools: + stage: build + before_script: + - apt-get update && + apt-get install -y libogg-dev + libtool-bin gettext zip + doxygen graphviz + # Create an unpriviledged user, required for tests. + - adduser --disabled-password --gecos "Gitlab CI" flac + script: + - ./autogen.sh + - ./configure + - make + - su -c 'make distcheck' flac + +cmake: + stage: build + before_script: + - apt-get update && + apt-get install -y libogg-dev + cmake ninja-build + doxygen graphviz + # Create an unpriviledged user, required for tests. + - adduser --disabled-password --gecos "Gitlab CI" flac + script: + - mkdir _build + - cmake -S . -B _build -G "Ninja" -DCMAKE_BUILD_TYPE=Release + - chown -R flac . + - su -c 'cmake --build _build' flac + - su -c 'cd _build && ctest -V' flac + +makefile: + stage: build + before_script: + - apt-get update && + apt-get install -y libogg-dev + # Create an unpriviledged user, required for tests. + - adduser --disabled-password --gecos "Gitlab CI" flac + script: + # The makefile doesn't create the `objs` tree it expects to use. + - mkdir -p objs/release/lib + - mkdir -p objs/release/bin + - mkdir -p objs/debug/lib + - mkdir -p objs/debug/bin + - chown -R flac . + - su -c 'make -f Makefile.lite' flac + - su -c 'make -f Makefile.lite test' flac -- cgit v1.2.1