Skip to content

Commit

Permalink
Overhaul Travis & Codecov setup
Browse files Browse the repository at this point in the history
For Codecov, actually enable status messages in pull requests (so far,
all were turned off, but for some reason codecov ignores this; still,
better to specify actual intent in the file).

For Travis, adapt scripts/build_pkg.sh to work with packages not using
autoconf, so that we can use the same script across many packages. Also
don't copy the tested package into GAP's pkg dir; instead, put it into
its own GAP root which we tell GAP to look at before its usual GAP root.

Modify scripts/gather-coverage.sh and scripts/run_tests.sh to use this
modified list of GAP root dirs

Simplify scripts/build_gap.sh significantly by using BuildPackages.sh.

For some packages, also temporarily disable builds against GAP's stable
branch. This is because its BuildPackages.sh does not support building
individual packages. This will be resolved with the stable-4.9 branch.
  • Loading branch information
fingolfin authored and alex-konovalov committed Jan 23, 2018
1 parent 09c1af1 commit da5280c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ coverage:

status:
project: no
patch: no
patch: yes
changes: no

comment:
Expand Down
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dist: trusty
language: c
env:
global:
Expand All @@ -16,7 +15,7 @@ addons:

matrix:
include:
- env: CFLAGS="-O2"
- env: CFLAGS="-O2" CC=clang CXX=clang++
compiler: clang
- env: CFLAGS="-O2"
compiler: gcc
Expand All @@ -27,10 +26,10 @@ branches:
- master

before_script:
- export GAPROOT="$HOME/gap"
- scripts/build_gap.sh
- scripts/build_pkg.sh
script:
- scripts/run_tests.sh
- scripts/build_pkg.sh && scripts/run_tests.sh
after_script:
- bash scripts/gather-coverage.sh
- bash <(curl -s https://codecov.io/bash)
48 changes: 21 additions & 27 deletions scripts/build_gap.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
#!/usr/bin/env bash
set -ex

# build GAP in a subdirectory
git clone --depth=2 https://github.com/gap-system/gap.git $GAPROOT
# clone GAP into a subdirectory
git clone --depth=2 -b ${GAPBRANCH:-master} https://github.com/gap-system/gap.git $GAPROOT
cd $GAPROOT
./autogen.sh
./configure
make -j4 V=1
make bootstrap-pkg-full

GAPROOT="$(cd .. && pwd)"

if [[ $ABI == 32 ]]
then
CONFIGFLAGS="CFLAGS=-m32 LDFLAGS=-m32 LOPTS=-m32 CXXFLAGS=-m32"
# for HPC-GAP, install ward, add suitable flags
if [[ $HPCGAP = yes ]]; then
git clone https://github.com/gap-system/ward
cd ward
CFLAGS= LDFLAGS= ./build.sh
cd ..
GAP_CONFIGFLAGS="$GAP_CONFIGFLAGS --enable-hpcgap"
fi

# build some packages...
cd pkg

cd io-*
# build GAP in a subdirectory
./autogen.sh
./configure $CONFIGFLAGS
./configure $GAP_CONFIGFLAGS
make -j4 V=1
cd ..

cd profiling-*
./autogen.sh
# HACK to workaround problems when building with clang
if [[ $CC = clang ]]
then
export CXX=clang++
fi
./configure $CONFIGFLAGS
make -j4 V=1
cd ..
# download packages; instruct wget to retry several times if the
# connection is refused, to work around intermittent failures
make bootstrap-pkg-full WGET="wget -N --no-check-certificate --tries=5 --waitretry=5 --retry-connrefused"

# build some packages (default is to build 'io' and 'profiling',
# in order to generate coverage results)
cd pkg
for pkg in ${GAP_PKGS_TO_BUILD-io profiling}; do
../bin/BuildPackages.sh --strict $pkg*
done
21 changes: 11 additions & 10 deletions scripts/build_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ set -ex
export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
export LDFLAGS="$LDFLAGS -fprofile-arcs"

if [[ $ABI = 32 ]]
then
if [[ $ABI = 32 ]]; then
export CFLAGS="$CFLAGS -m32"
export LDFLAGS="$LDFLAGS -m32"
fi

# build this package
#./configure $GAPROOT
#make
if [[ -x autogen.sh ]]; then
./autogen.sh
./configure --with-gaproot=$GAPROOT
make -j4 V=1
elif [[ -x configure ]]; then
./configure $GAPROOT
make -j4
fi

# ... and link it into GAP pkg dir
ls
ls $GAPROOT
ls $GAPROOT/pkg
rm -r $GAPROOT/pkg/unitlib-*
ln -s $PWD $GAPROOT/pkg/
# trick to allow the package directory to be used as a GAP root dir
ln -s . pkg
9 changes: 7 additions & 2 deletions scripts/gather-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/usr/bin/env bash
set -ex

GAP="$GAPROOT/bin/gap.sh --quitonbreak -q"
# If we don't care about code coverage, do nothing
if [[ -n $NO_COVERAGE ]]; then
exit 0
fi

GAP="$GAPROOT/bin/gap.sh -l $PWD; --quitonbreak -q"

# generate library coverage reports
$GAP -a 500M -m 500M -q <<GAPInput
Expand All @@ -15,7 +20,7 @@ for f in DirectoryContents(d) do
if f in [".", ".."] then continue; fi;
Add(covs, Filename(d, f));
od;
Print("Merging coverage results\n");
Print("Merging coverage results from ", covs, "\n");
r := MergeLineByLineProfiles(covs);;
Print("Outputting JSON\n");
OutputJsonCoverage(r, "gap-coverage.json");;
Expand Down
11 changes: 8 additions & 3 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/usr/bin/env bash
set -ex

GAP="$GAPROOT/bin/gap.sh --quitonbreak -q"
GAP="$GAPROOT/bin/gap.sh -l $PWD; --quitonbreak"

mkdir $COVDIR
$GAP --cover $COVDIR/test.coverage tst/testall.g
# unless explicitly turned off, we collect coverage data
if [[ -z $NO_COVERAGE ]]; then
mkdir $COVDIR
GAP="$GAP --cover $COVDIR/test.coverage"
fi

$GAP tst/testall.g

0 comments on commit da5280c

Please sign in to comment.