Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul Travis & Codecov setup #18

Merged
merged 1 commit into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ coverage:
status:
project: no
patch: yes
changes: yes
changes: no

comment:
layout: "header, diff, changes, tree"
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 @@ -18,7 +17,7 @@ addons:

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

before_script:
- export GAPROOT="$HOME/gap"
- scripts/build_gap.sh
script:
- scripts/build_pkg.sh
- 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)
Expand Down
50 changes: 21 additions & 29 deletions scripts/build_gap.sh
Original file line number Diff line number Diff line change
@@ -1,39 +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-minimal

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

# install latest version of io
git clone https://github.com/gap-packages/io
cd io
# build GAP in a subdirectory
./autogen.sh
./configure $CONFIGFLAGS
./configure $GAP_CONFIGFLAGS
make -j4 V=1
cd ..

# install latest version of profiling
git clone https://github.com/gap-packages/profiling
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
./autogen.sh
./configure --with-gaproot=$GAPROOT
make -j4 V=1
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
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