From: Colin Walters Date: Tue, 9 May 2017 15:52:20 +0000 (-0400) Subject: ci: Move travis scripts from tests/ → ci/ X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~37^2~26 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bf1a994d85679a6b6690778a851866de13fafd3f;p=ostree.git ci: Move travis scripts from tests/ → ci/ I think tests/ should be just that, ci/ is separate. Also rename the files to include "travis" since that's what we use them for right now. Closes: #843 Approved by: jlebon --- diff --git a/.travis.yml b/.travis.yml index a021592c..140e7ada 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ env: - ci_docker=ubuntu:xenial ci_distro=ubuntu ci_suite=xenial script: - - tests/ci-install.sh - - ci_parallel=2 ci_sudo=yes tests/ci-build.sh + - ci/travis-install.sh + - ci_parallel=2 ci_sudo=yes ci/travis-build.sh notifications: email: false diff --git a/ci/travis-Dockerfile.in b/ci/travis-Dockerfile.in new file mode 100644 index 00000000..df999e78 --- /dev/null +++ b/ci/travis-Dockerfile.in @@ -0,0 +1,10 @@ +FROM @ci_docker@ +ENV container docker + +ADD ci/travis-install.sh /travis-install.sh +RUN ci_suite="@ci_suite@" ci_distro="@ci_distro@" ci_in_docker=yes /travis-install.sh + +ADD . /home/user/ostree +RUN chown -R user:user /home/user/ostree +WORKDIR /home/user/ostree +USER user diff --git a/ci/travis-build.sh b/ci/travis-build.sh new file mode 100755 index 00000000..885e3ce2 --- /dev/null +++ b/ci/travis-build.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +# Copyright © 2015-2016 Collabora Ltd. +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set -euo pipefail +set -x + +NULL= + +# ci_docker: +# If non-empty, this is the name of a Docker image. travis-install.sh will +# fetch it with "docker pull" and use it as a base for a new Docker image +# named "ci-image" in which we will do our testing. +# +# If empty, we test on "bare metal". +# Typical values: ubuntu:xenial, debian:jessie-slim +: "${ci_docker:=}" + +# ci_parallel: +# A number of parallel jobs, passed to make -j +: "${ci_parallel:=1}" + +# ci_sudo: +# If yes, assume we can get root using sudo; if no, only use current user +: "${ci_sudo:=no}" + +# ci_test: +# If yes, run tests; if no, just build +: "${ci_test:=yes}" + +# ci_test_fatal: +# If yes, test failures break the build; if no, they are reported but ignored +: "${ci_test_fatal:=yes}" + +# ci_configopts: +# Additional args for configure +: "${ci_configopts:=}" + +if [ -n "$ci_docker" ]; then + exec docker run \ + --env=ci_docker="" \ + --env=ci_parallel="${ci_parallel}" \ + --env=ci_sudo=yes \ + --env=ci_test="${ci_test}" \ + --env=ci_test_fatal="${ci_test_fatal}" \ + --env=ci_configopts="${ci_configopts}" \ + --privileged \ + ci-image \ + ci/travis-build.sh +fi + +maybe_fail_tests () { + if [ "$ci_test_fatal" = yes ]; then + exit 1 + fi +} + +NOCONFIGURE=1 ./autogen.sh + +srcdir="$(pwd)" +mkdir ci-build +cd ci-build + +make="make -j${ci_parallel} V=1 VERBOSE=1" + +../configure \ + --enable-always-build-tests \ + ${ci_configopts} + "$@" + +${make} +[ "$ci_test" = no ] || ${make} check || maybe_fail_tests +cat test/test-suite.log || : +[ "$ci_test" = no ] || ${make} distcheck || maybe_fail_tests +cat test/test-suite.log || : + +${make} install DESTDIR=$(pwd)/DESTDIR +( cd DESTDIR && find . ) + +if [ "$ci_sudo" = yes ] && [ "$ci_test" = yes ]; then + sudo ${make} install + env \ + LD_LIBRARY_PATH=/usr/local/lib \ + GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0 \ + ${make} installcheck || \ + maybe_fail_tests + cat test/test-suite.log || : +fi + +# vim:set sw=4 sts=4 et: diff --git a/ci/travis-install.sh b/ci/travis-install.sh new file mode 100755 index 00000000..5d3d5a91 --- /dev/null +++ b/ci/travis-install.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +# Copyright © 2015-2016 Collabora Ltd. +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set -euo pipefail +set -x + +NULL= + +# ci_distro: +# OS distribution in which we are testing +# Typical values: ubuntu, debian; maybe fedora in future +: "${ci_distro:=debian}" + +# ci_docker: +# If non-empty, this is the name of a Docker image. travis-install.sh will +# fetch it with "docker pull" and use it as a base for a new Docker image +# named "ci-image" in which we will do our testing. +: "${ci_docker:=}" + +# ci_in_docker: +# Used internally by travis-install.sh. If yes, we are inside the Docker image +# (ci_docker is empty in this case). +: "${ci_in_docker:=no}" + +# ci_suite: +# OS suite (release, branch) in which we are testing. +# Typical values for ci_distro=ubuntu: xenial, trusty +# Typical values for ci_distro=debian: sid, jessie +# Typical values for ci_distro=fedora might be 25, rawhide +: "${ci_suite:=jessie}" + +# ci_configopts: Additional arguments for configure +: "${ci_configopts:=}" + +if [ $(id -u) = 0 ]; then + sudo= +else + sudo=sudo +fi + +if [ -n "$ci_docker" ]; then + sed \ + -e "s/@ci_distro@/${ci_distro}/" \ + -e "s/@ci_docker@/${ci_docker}/" \ + -e "s/@ci_suite@/${ci_suite}/" \ + < ci/travis-Dockerfile.in > Dockerfile + exec docker build -t ci-image . +fi + +case "$ci_distro" in + (debian) + # Docker images use httpredir.debian.org but it seems to be + # unreliable; use a CDN instead + sed -i -e 's/httpredir\.debian\.org/deb.debian.org/g' /etc/apt/sources.list + ;; +esac + +case "$ci_distro" in + (debian|ubuntu) + # TODO: fetch this list from the Debian packaging git repository? + $sudo apt-get -y update + $sudo apt-get -y install \ + attr \ + bison \ + cpio \ + debhelper \ + dh-autoreconf \ + dh-systemd \ + docbook-xml \ + docbook-xsl \ + e2fslibs-dev \ + elfutils \ + fuse \ + gjs \ + gnome-desktop-testing \ + gobject-introspection \ + gtk-doc-tools \ + libarchive-dev \ + libattr1-dev \ + libcap-dev \ + libfuse-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + libgpgme11-dev \ + liblzma-dev \ + libmount-dev \ + libselinux1-dev \ + libsoup2.4-dev \ + libcurl4-openssl-dev \ + procps \ + zlib1g-dev \ + python-yaml \ + ${NULL} + + if [ "$ci_in_docker" = yes ]; then + # Add the user that we will use to do the build inside the + # Docker container, and let them use sudo + adduser --disabled-password user /etc/sudoers.d/nopasswd + chmod 0440 /etc/sudoers.d/nopasswd + fi + ;; + + (*) + echo "Don't know how to set up ${ci_distro}" >&2 + exit 1 + ;; +esac + +# vim:set sw=4 sts=4 et: diff --git a/tests/ci-Dockerfile.in b/tests/ci-Dockerfile.in deleted file mode 100644 index 0b56b431..00000000 --- a/tests/ci-Dockerfile.in +++ /dev/null @@ -1,10 +0,0 @@ -FROM @ci_docker@ -ENV container docker - -ADD tests/ci-install.sh /ci-install.sh -RUN ci_suite="@ci_suite@" ci_distro="@ci_distro@" ci_in_docker=yes /ci-install.sh - -ADD . /home/user/ostree -RUN chown -R user:user /home/user/ostree -WORKDIR /home/user/ostree -USER user diff --git a/tests/ci-build.sh b/tests/ci-build.sh deleted file mode 100755 index e310ed0f..00000000 --- a/tests/ci-build.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash - -# Copyright © 2015-2016 Collabora Ltd. -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -set -euo pipefail -set -x - -NULL= - -# ci_docker: -# If non-empty, this is the name of a Docker image. ci-install.sh will -# fetch it with "docker pull" and use it as a base for a new Docker image -# named "ci-image" in which we will do our testing. -# -# If empty, we test on "bare metal". -# Typical values: ubuntu:xenial, debian:jessie-slim -: "${ci_docker:=}" - -# ci_parallel: -# A number of parallel jobs, passed to make -j -: "${ci_parallel:=1}" - -# ci_sudo: -# If yes, assume we can get root using sudo; if no, only use current user -: "${ci_sudo:=no}" - -# ci_test: -# If yes, run tests; if no, just build -: "${ci_test:=yes}" - -# ci_test_fatal: -# If yes, test failures break the build; if no, they are reported but ignored -: "${ci_test_fatal:=yes}" - -# ci_configopts: -# Additional args for configure -: "${ci_configopts:=}" - -if [ -n "$ci_docker" ]; then - exec docker run \ - --env=ci_docker="" \ - --env=ci_parallel="${ci_parallel}" \ - --env=ci_sudo=yes \ - --env=ci_test="${ci_test}" \ - --env=ci_test_fatal="${ci_test_fatal}" \ - --env=ci_configopts="${ci_configopts}" \ - --privileged \ - ci-image \ - tests/ci-build.sh -fi - -maybe_fail_tests () { - if [ "$ci_test_fatal" = yes ]; then - exit 1 - fi -} - -NOCONFIGURE=1 ./autogen.sh - -srcdir="$(pwd)" -mkdir ci-build -cd ci-build - -make="make -j${ci_parallel} V=1 VERBOSE=1" - -../configure \ - --enable-always-build-tests \ - ${ci_configopts} - "$@" - -${make} -[ "$ci_test" = no ] || ${make} check || maybe_fail_tests -cat test/test-suite.log || : -[ "$ci_test" = no ] || ${make} distcheck || maybe_fail_tests -cat test/test-suite.log || : - -${make} install DESTDIR=$(pwd)/DESTDIR -( cd DESTDIR && find . ) - -if [ "$ci_sudo" = yes ] && [ "$ci_test" = yes ]; then - sudo ${make} install - env \ - LD_LIBRARY_PATH=/usr/local/lib \ - GI_TYPELIB_PATH=/usr/local/lib/girepository-1.0 \ - ${make} installcheck || \ - maybe_fail_tests - cat test/test-suite.log || : -fi - -# vim:set sw=4 sts=4 et: diff --git a/tests/ci-install.sh b/tests/ci-install.sh deleted file mode 100755 index d927d962..00000000 --- a/tests/ci-install.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -# Copyright © 2015-2016 Collabora Ltd. -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -set -euo pipefail -set -x - -NULL= - -# ci_distro: -# OS distribution in which we are testing -# Typical values: ubuntu, debian; maybe fedora in future -: "${ci_distro:=debian}" - -# ci_docker: -# If non-empty, this is the name of a Docker image. ci-install.sh will -# fetch it with "docker pull" and use it as a base for a new Docker image -# named "ci-image" in which we will do our testing. -: "${ci_docker:=}" - -# ci_in_docker: -# Used internally by ci-install.sh. If yes, we are inside the Docker image -# (ci_docker is empty in this case). -: "${ci_in_docker:=no}" - -# ci_suite: -# OS suite (release, branch) in which we are testing. -# Typical values for ci_distro=ubuntu: xenial, trusty -# Typical values for ci_distro=debian: sid, jessie -# Typical values for ci_distro=fedora might be 25, rawhide -: "${ci_suite:=jessie}" - -# ci_configopts: Additional arguments for configure -: "${ci_configopts:=}" - -if [ $(id -u) = 0 ]; then - sudo= -else - sudo=sudo -fi - -if [ -n "$ci_docker" ]; then - sed \ - -e "s/@ci_distro@/${ci_distro}/" \ - -e "s/@ci_docker@/${ci_docker}/" \ - -e "s/@ci_suite@/${ci_suite}/" \ - < tests/ci-Dockerfile.in > Dockerfile - exec docker build -t ci-image . -fi - -case "$ci_distro" in - (debian) - # Docker images use httpredir.debian.org but it seems to be - # unreliable; use a CDN instead - sed -i -e 's/httpredir\.debian\.org/deb.debian.org/g' /etc/apt/sources.list - ;; -esac - -case "$ci_distro" in - (debian|ubuntu) - # TODO: fetch this list from the Debian packaging git repository? - $sudo apt-get -y update - $sudo apt-get -y install \ - attr \ - bison \ - cpio \ - debhelper \ - dh-autoreconf \ - dh-systemd \ - docbook-xml \ - docbook-xsl \ - e2fslibs-dev \ - elfutils \ - fuse \ - gjs \ - gnome-desktop-testing \ - gobject-introspection \ - gtk-doc-tools \ - libarchive-dev \ - libattr1-dev \ - libcap-dev \ - libfuse-dev \ - libgirepository1.0-dev \ - libglib2.0-dev \ - libgpgme11-dev \ - liblzma-dev \ - libmount-dev \ - libselinux1-dev \ - libsoup2.4-dev \ - libcurl4-openssl-dev \ - procps \ - zlib1g-dev \ - python-yaml \ - ${NULL} - - if [ "$ci_in_docker" = yes ]; then - # Add the user that we will use to do the build inside the - # Docker container, and let them use sudo - adduser --disabled-password user /etc/sudoers.d/nopasswd - chmod 0440 /etc/sudoers.d/nopasswd - fi - ;; - - (*) - echo "Don't know how to set up ${ci_distro}" >&2 - exit 1 - ;; -esac - -# vim:set sw=4 sts=4 et: