Skip to content

Commit

Permalink
Add tests for CentOS 7
Browse files Browse the repository at this point in the history
Right now, this is just a basic compilation+unit tests test, but
it's a starting point for more thorough tests.

Signed-off-by: Stephen Gallagher <[email protected]>
  • Loading branch information
sgallagher committed Feb 5, 2019
1 parent 9422de2 commit 92fe409
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ jobs:
script: ./.travis/travis-fedora.sh
- name: "Fedora rawhide"
script: ./.travis/travis-fedora.sh
- name: "CentOS 7"
script: ./.travis/travis-centos.sh
36 changes: 36 additions & 0 deletions .travis/centos/Dockerfile.deps.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM @IMAGE@

MAINTAINER Stephen Gallagher <[email protected]>

ARG TARBALL

RUN yum -y install epel-release \
&& yum -y install \
clang \
createrepo_c \
curl \
elinks \
gcc \
gcc-c++ \
git-core \
glib2-devel \
gobject-introspection-devel \
gtk-doc \
libyaml-devel \
meson \
ninja-build \
openssl \
pkgconfig \
popt-devel \
python34-devel \
python34-gobject-base \
python3-rpm-macros \
redhat-rpm-config \
rpm-build \
rpmdevtools \
ruby \
"rubygem(json)" \
rubygems \
sudo \
wget \
&& yum -y clean all
9 changes: 9 additions & 0 deletions .travis/centos/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM fedora-modularity/libmodulemd-deps-@RELEASE@

MAINTAINER Stephen Gallagher <[email protected]>

ARG TARBALL

ADD $TARBALL /builddir/

ENTRYPOINT /builddir/.travis/centos/travis-tasks.sh
35 changes: 35 additions & 0 deletions .travis/centos/travis-tasks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

#Exit on failures
set -e

set -x

JOB_NAME=${TRAVIS_JOB_NAME:-CentOS 7}

arr=($JOB_NAME)
os_name=${arr[0]:-CentOS}
release=${arr[1]:-7}

# CentOS 7 doesn't have autopep8, so we'll drop the requirement for it
# This implementation will still allow it to occur if autopep8 still shows
# up later.
COMMON_MESON_ARGS="-Dtest_dirty_git=false -Ddeveloper_build=false -Dpython_name=python3.4"

pushd /builddir/

# Build the v1 and v2 code under GCC and run standard tests
meson --buildtype=debug \
-Dbuild_api_v1=true \
-Dbuild_api_v2=true \
$COMMON_MESON_ARGS \
travis

set +e
ninja-build -C travis test
if [ $? != 0 ]; then
cat travis_v1/meson-logs/testlog.txt
fi
set -e

popd #builddir
43 changes: 43 additions & 0 deletions .travis/travis-centos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPT_DIR

set -e
set -x

JOB_NAME=${TRAVIS_JOB_NAME:-CentOS 7}

arr=($JOB_NAME)
os_name=${arr[0]:-CentOS}
release=${arr[1]:-7}

# Create an archive of the current checkout
TARBALL_PATH=`mktemp -p $SCRIPT_DIR tarball-XXXXXX.tar.bz2`
TARBALL=`basename $TARBALL_PATH`

pushd $SCRIPT_DIR/..
git ls-files |xargs tar cfj $TARBALL_PATH .git
popd

repository="registry.centos.org"
os="centos"

sed -e "s/@IMAGE@/$repository\/$os:$release/" \
$SCRIPT_DIR/centos/Dockerfile.deps.tmpl > $SCRIPT_DIR/centos/Dockerfile.deps.$release
sed -e "s/@RELEASE@/$release/" $SCRIPT_DIR/centos/Dockerfile.tmpl > $SCRIPT_DIR/centos/Dockerfile-$release

sudo docker build -f $SCRIPT_DIR/centos/Dockerfile.deps.$release -t fedora-modularity/libmodulemd-deps-$release .
sudo docker build -f $SCRIPT_DIR/centos/Dockerfile-$release -t fedora-modularity/libmodulemd:$release --build-arg TARBALL=$TARBALL .

if [ $release != "rawhide" ]; then
# Only run Coverity scan on Rawhide since we have a limited number of scans per week.
unset COVERITY_SCAN_TOKEN
fi

rm -f $TARBALL_PATH $SCRIPT_DIR/centos/Dockerfile.deps.$release $SCRIPT_DIR/centos/Dockerfile-$release

docker run -e COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN -e TRAVIS=$TRAVIS -eTRAVIS_JOB_NAME="$TRAVIS_JOB_NAME" --rm fedora-modularity/libmodulemd:$release

popd
exit 0

0 comments on commit 92fe409

Please sign in to comment.