Replace Travis with Github Actions for CI builds

Replace Travis for continuous integration with Github Actions.
The Github Actions pipeline is functionally equivalent, with
all the same build permutations supported.
Whilst the Github Actions offering is broadly equivalent to
Travis, a few changes have been made as part of the migration.

- The 'core' and 'optional' Travis stages have been consolidated
into one build matrix. This is due to the current inability in
Github Actions to share build steps between jobs, so this avoids
having to duplicate the steps.
Optional stage jobs will now run in parallel with core jobs,
but they still remain optional in the sense that they don't fail
the build.

- A number of existing Github Action plugins are used to replace
functionality provided by Travis or other tools:
Node setup, caching, Codecov, publishing release artifacts.

- Linux builds are updated to build on Ubuntu 18.04.
MacOS builds are updated to run on 10.15. Similar to the
Travis Xenial upgrade attempt, some changes are required due
to underlying platform and compiler upgrades. This means some
Node 10 toolchains will no longer be supported.

Whilst there is opportunity to upgrade some dependencies and
make the CI steps more idiomatic, I've left this for future changes
and just focussed on functional replication.
This commit is contained in:
Michael Bell
2021-06-24 18:59:15 +01:00
committed by Patrick Niklaus
parent 8af4f700f7
commit eb0c089574
19 changed files with 612 additions and 615 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh -ex
# workaround for gcc4.8 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55642
export CXXFLAGS=-Wa,-mimplicit-it=thumb
UBUNTU_RELEASE=$(lsb_release -sc)
sudo dpkg --add-architecture armhf
sudo tee -a /etc/apt/sources.list > /dev/null <<EOF
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_RELEASE} restricted main multiverse universe
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_RELEASE}-security restricted main multiverse universe
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_RELEASE}-updates restricted main multiverse universe
EOF
cat /etc/apt/sources.list
sudo apt-get update -qq --yes || true
sudo apt-get install -qq --yes --force-yes g++-4.8-arm-linux-gnueabihf g++-4.8-multilib-arm-linux-gnueabihf gcc-4.8-arm-linux-gnueabihf gcc-4.8-multilib-arm-linux-gnueabihf
sudo apt-get install -qq --yes --force-yes libexpat1-dev:armhf zlib1g-dev:armhf libbz2-dev:armhf libboost-date-time-dev:armhf libboost-filesystem-dev:armhf libboost-iostreams-dev:armhf libboost-program-options-dev:armhf libboost-regex-dev:armhf libboost-system-dev:armhf libboost-thread-dev:armhf libtbb-dev:armhf libboost-test-dev:armhf
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh -ex
sudo dpkg --add-architecture i386
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test && ( sudo apt-get update -qq --yes || true )
sudo apt-get install -qq --yes --force-yes g++-7-multilib libxml2-dev:i386 libexpat1-dev:i386 libzip-dev:i386 libbz2-dev:i386 libtbb-dev:i386 lua5.2:i386 liblua5.2-dev:i386 libboost-date-time-dev:i386 libboost-filesystem-dev:i386 libboost-iostreams-dev:i386 libboost-program-options-dev:i386 libboost-regex-dev:i386 libboost-system-dev:i386 libboost-thread-dev:i386 libboost-test-dev:i386
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
sudo add-apt-repository ppa:jonathonf/binutils --yes || true
sudo apt-get update -qq --yes || true
sudo apt-get install -qq --yes --force-yes binutils
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
set -eu pipefail
: '
This script is designed to detect if a gitsha represents a normal
push commit (to any branch) or whether it represents travis attempting
to merge between the origin and the upstream branch.
For more details see: https://docs.travis-ci.com/user/pull-requests
'
# Get the commit message via git log
# This should always be the exact text the developer provided
COMMIT_LOG=$(git log --format=%B --no-merges -n 1 | tr -d '\n')
# Get the commit message via git show
# If the gitsha represents a merge then this will
# look something like "Merge e3b1981 into 615d2a3"
# Otherwise it will be the same as the "git log" output
COMMIT_SHOW=$(git show -s --format=%B | tr -d '\n')
if [[ "${COMMIT_LOG}" != "${COMMIT_SHOW}" ]]; then
echo true
fi
+8
View File
@@ -0,0 +1,8 @@
# Configuration file for LeakSanitizer run on the Travis CI
# TBB leaks some memory allocated in singleton depending on deinitialization order
# Direct leak of 1560 byte(s) in 3 object(s) allocated from:
# #0 0x7f7ae72a80a0 in operator new[](unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc80a0)
# #1 0x7f7ae595d13e (/usr/lib/x86_64-linux-gnu/libtbb.so.2+0x2213e)
leak:libtbb.so
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
set -eu
set -o pipefail
echo "node version is:"
which node
node -v
if [[ ${PUBLISH} == 'On' ]]; then
echo "PUBLISH is set to '${PUBLISH}', publishing!"
NPM_FLAGS=''
if [[ ${BUILD_TYPE} == "Debug" ]]; then
NPM_FLAGS='--debug'
fi
echo "dumping binary meta..."
./node_modules/.bin/node-pre-gyp reveal $NPM_FLAGS
# enforce that binary has proper ORIGIN flags so that
# it can portably find libtbb.so in the same directory
if [[ $(uname -s) == 'Linux' ]]; then
readelf -d ./lib/binding/node_osrm.node > readelf-output.txt
if grep -q 'Flags: ORIGIN' readelf-output.txt; then
echo "Found ORIGIN flag in readelf output"
cat readelf-output.txt
else
echo "*** Error: Could not found ORIGIN flag in readelf output"
cat readelf-output.txt
exit 1
fi
fi
./node_modules/.bin/node-pre-gyp package testpackage $NPM_FLAGS
else
echo "PUBLISH is set to '${PUBLISH}', skipping."
fi
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
# This script is sourced, so do not set -e or -o pipefail here. Doing so would
# bleed into Travis' wrapper script, which messes with their workflow, e.g.
# preventing after_failure scripts to be triggered.
function mapbox_time_start {
local name=$1
mapbox_timer_name=$name
mapbox_fold start $name
mapbox_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
eval "mapbox_start_time_$mapbox_timer_id=$(mapbox_nanoseconds)"
echo -en "travis_time:start:$mapbox_timer_id\n"
}
function mapbox_time_finish {
local name=${1:-$mapbox_timer_name}
local timer_id=${2:-$mapbox_timer_id}
local timer_start="mapbox_start_time_$timer_id"
eval local start_time=\${$timer_start}
local end_time=$(mapbox_nanoseconds)
local duration=$(($end_time-$start_time))
echo -en "travis_time:end:$timer_id:start=$start_time,finish=$end_time,duration=$duration\n"
}
function mapbox_time {
local name=$1 ; shift
mapbox_time_start $name
local timer_id=$mapbox_timer_id
echo "\$ $@"
# note: we capture the return code here
# so that we can ensure mapbox_time_finish is called
# and an error is trickled up correctly
local RESULT=0
$@ || RESULT=$?
mapbox_time_finish $name $timer_id
if [[ ${RESULT} != 0 ]]; then
echo "$name failed with ${RESULT}"
# note: we use false here instead of exit this this script is sourced
# and exit would abort the shell which we don't want
false
else
mapbox_fold end $name
fi
}
function mapbox_fold {
local action=$1
local name=$2
local ANSI_CLEAR="\e[0m"
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
function mapbox_nanoseconds {
local cmd="date"
local format="+%s%N"
local os=$(uname -s)
if hash gdate > /dev/null 2>&1; then
cmd="gdate" # use gdate if available
elif [[ "$os" = Darwin ]]; then
format="+%s000000000" # fallback to second precision on darwin (does not support %N)
fi
$cmd -u $format
}
export JOBS
export -f mapbox_fold
export -f mapbox_nanoseconds
export -f mapbox_time
export -f mapbox_time_start
export -f mapbox_time_finish