From 4bbea19a318ac4f2cfa1c6d20b67e9a6287a6ab6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 28 Apr 2017 12:29:25 -0400 Subject: [PATCH] ci: Delete dockerfile, move to common scripts, consolidate gcc/clang The Dockerfile is problematic since we can't update it atomically. I also really dislike reliance on the Hub. Further, I think rather than caching our build deps as built containers, we should be caching RPMs in CI. And we should be using rpm-ostree at some point to assemble filesystem trees faster. Also, consolidate the clang to be serial with gcc, since while we lose a tiny bit of parallelism, it's not really worth its own context right now. Closes: #759 Approved by: jlebon --- .redhat-ci.Dockerfile | 31 --------------------- .redhat-ci.yml | 65 ++++--------------------------------------- ci/build-check.sh | 18 ++++++++++++ ci/build.sh | 23 +++++++++++++++ ci/libbuild.sh | 28 +++++++++++++++++++ 5 files changed, 75 insertions(+), 90 deletions(-) delete mode 100644 .redhat-ci.Dockerfile create mode 100755 ci/build-check.sh create mode 100755 ci/build.sh create mode 100644 ci/libbuild.sh diff --git a/.redhat-ci.Dockerfile b/.redhat-ci.Dockerfile deleted file mode 100644 index 296cf5e6..00000000 --- a/.redhat-ci.Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM fedora:25 - -# We could use the upstream spec file here, but anyway for -# runtime reqs, we're at the mercy of whatever in the -# updates repo. Though we do explicitly use updates-testing -# so our CI coverage indirectly tests that. - -RUN dnf config-manager --set-enabled updates-testing && \ - dnf install -y @buildsys-build && \ - dnf install -y 'dnf-command(builddep)' && \ - dnf builddep -y rpm-ostree && \ - dnf install -y rpm-ostree && \ - rpm -e rpm-ostree - -# These are test-only reqs -RUN dnf install -y \ - ostree \ - createrepo_c \ - /usr/bin/jq \ - PyYAML \ - clang \ - libubsan \ - libasan \ - libtsan \ - elfutils \ - fuse \ - sudo \ - gnome-desktop-testing - -# create an unprivileged user for testing -RUN adduser testuser diff --git a/.redhat-ci.yml b/.redhat-ci.yml index a3aa291a..e36f82b9 100644 --- a/.redhat-ci.yml +++ b/.redhat-ci.yml @@ -3,65 +3,20 @@ branches: - auto - try -context: check +context: f25-build-check required: true container: - image: projectatomic/rpm-ostree-tester - -# ⚠ Pull latest ostree for https://github.com/ostreedev/ostree/issues/758 -# And we now depend on 2017.4 -# Also, there's a copy of this below in the compose context -# And also in tests/vmcheck/overlay.sh -packages: - - https://kojipkgs.fedoraproject.org//packages/ostree/2017.5/2.fc25/x86_64/ostree-2017.5-2.fc25.x86_64.rpm - - https://kojipkgs.fedoraproject.org//packages/ostree/2017.5/2.fc25/x86_64/ostree-devel-2017.5-2.fc25.x86_64.rpm - - https://kojipkgs.fedoraproject.org//packages/ostree/2017.5/2.fc25/x86_64/ostree-libs-2017.5-2.fc25.x86_64.rpm - -env: - CFLAGS: '-fsanitize=undefined' - -build: - config-opts: > - --prefix=/usr - --libdir=/usr/lib64 - --enable-installed-tests - --enable-gtk-doc + image: registry.fedoraproject.org/fedora:25 tests: - - make check - - gnome-desktop-testing-runner rpm-ostree - - sudo --user=testuser gnome-desktop-testing-runner rpm-ostree + - ci/build-check.sh timeout: 30m artifacts: - test-suite.log - - config.log - ---- - -inherit: true - -context: Clang - -required: true - -env: - CC: 'clang' - CFLAGS: '-Werror=unused-variable' - -build: - config-opts: > - --prefix=/usr - --libdir=/usr/lib64 - --enable-installed-tests - --enable-gtk-doc - --enable-new-name - -tests: -artifacts: --- @@ -80,9 +35,10 @@ cluster: - name: vmcheck3 distro: fedora/25/atomic container: - image: projectatomic/rpm-ostree-tester + image: registry.fedoraproject.org/fedora:25 tests: + - ./ci/build.sh - make vmcheck HOSTS="vmcheck1 vmcheck2 vmcheck3" artifacts: @@ -107,16 +63,7 @@ host: tests: - > docker run --privileged -v $(pwd):/srv/code --rm - projectatomic/rpm-ostree-tester /bin/sh -c " - yum -y install https://kojipkgs.fedoraproject.org//packages/ostree/2017.5/2.fc25/x86_64/ostree-{,libs-,devel-,grub2-}2017.5-2.fc25.x86_64.rpm && - cd /srv/code && - env NOCONFIGURE=1 ./autogen.sh && - ./configure --prefix=/usr --libdir=/usr/lib64 && - make && - make install && - dnf update -y bubblewrap && - ./tests/compose - " + registry.fedoraproject.org/fedora:25 /bin/sh -c "cd /srv/code && ./ci/build.sh && make install && ./tests/compose" artifacts: - compose.log diff --git a/ci/build-check.sh b/ci/build-check.sh new file mode 100755 index 00000000..d0add417 --- /dev/null +++ b/ci/build-check.sh @@ -0,0 +1,18 @@ +#!/usr/bin/bash +# Install build dependencies, run unit tests and installed tests. + +set -xeuo pipefail + +dn=$(dirname $0) +. ${dn}/libbuild.sh +${dn}/build.sh +make check +make install +gnome-desktop-testing-runner rpm-ostree +sudo --user=testuser gnome-desktop-testing-runner rpm-ostree +git clean -dfx + +# And now a clang build to find unused variables +export CC=clang +export CFLAGS='-Werror=unused-variable' +build_default diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 00000000..46841bdf --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,23 @@ +#!/usr/bin/bash +# Install build dependencies, run unit tests and installed tests. + +set -xeuo pipefail + +dn=$(dirname $0) +. ${dn}/libbuild.sh + +install_builddeps rpm-ostree + +# ⚠ Pull latest ostree for https://github.com/ostreedev/ostree/issues/758 +# And we now depend on 2017.4 +# Also, there's a copy of this below in the compose context +# And also in tests/vmcheck/overlay.sh +yum -y install https://kojipkgs.fedoraproject.org//packages/ostree/2017.5/2.fc25/x86_64/ostree-{,libs-,devel-,grub2-}2017.5-2.fc25.x86_64.rpm + +dnf install -y createrepo_c /usr/bin/jq PyYAML clang \ + libubsan libasan libtsan elfutils fuse sudo gnome-desktop-testing + +# create an unprivileged user for testing +adduser testuser + +build --enable-installed-tests --enable-gtk-doc diff --git a/ci/libbuild.sh b/ci/libbuild.sh new file mode 100644 index 00000000..f85b2d38 --- /dev/null +++ b/ci/libbuild.sh @@ -0,0 +1,28 @@ +#!/usr/bin/bash + +make() { + /usr/bin/make -j $(getconf _NPROCESSORS_ONLN) +} + +build() { + env NOCONFIGURE=1 ./autogen.sh + ./configure --prefix=/usr --libdir=/usr/lib64 "$@" + make +} + +build_default() { + export CFLAGS='-fsanitize=undefined' + build +} + +install_builddeps() { + pkg=$1 + dnf -y install dnf-plugins-core + dnf install -y @buildsys-build + dnf install -y 'dnf-command(builddep)' + + # builddeps+runtime deps + dnf builddep -y $pkg + dnf install -y $pkg + rpm -e $pkg +}