Replace legacy CI build script by new one

Since there are no jobs left on Inria's CI that use the legacy
ci-build script, replace it by the new one.
master
Sébastien Hinderer 2017-04-18 16:23:44 +02:00
parent 27fccad357
commit 7d6a661471
2 changed files with 48 additions and 262 deletions

View File

@ -17,24 +17,31 @@
# This script is run on our continuous-integration servers to recompile
# from scratch and run the test suite.
# To know the slave's architecture, this script looks at the OCAML_ARCH
# environment variable. For a given node NODe, this variable can be defined
# in Jenkins at the following address:
# https://ci.inria.fr/ocaml/computer/NODE/configure
# arguments:
# 1. architecture: bsd, macos, linux, cygwin, mingw, mingw64, msvc, msvc64
# 2. directory in which to build (trunk, 4.02, etc)
# If this is "." then build in the Jenkins-checked out directory
# Otherwise, go to $HOME/jenkins-workspace/<dir> and check out a
# fresh copy of the branch, then build there.
# 3. options:
# -conf configure-option add configure-option to configure cmd line
# -patch1 file-name apply patch with -p1
# -no-native do not build "opt" and "opt.opt"
# -conf configure-option add configure-option to configure cmd line
# -patch1 file-name apply patch with -p1
# -no-native do not build "opt" and "opt.opt"
error () {
echo "$1" >&2
exit 3
}
arch_error() {
configure_url = "https://ci.inria.fr/ocaml/computer/${NODE_NAME}/configure"
msg = "Unknown architecture. Make sure the OCAML_ARCH environemnt"
msg = "$msg variable has been defined."
msg = "$msg\nSee ${configure_url}"
error "$msg"
}
# Kill a task on Windows
# Errors (e.g. non-existing tasks) are ignored
# Errors are ignored
kill_task()
{
task=$1
@ -52,19 +59,13 @@ set -x
#########################################################################
# Save the current directory (on cygwin, /etc/profile changes it)
jenkinsdir="$(pwd)"
#########################################################################
# "Parse" mandatory command-line arguments.
arch="$1"
branch="$2"
shift 2
echo jenkinsdir=${jenkinsdir}
#########################################################################
# If we are called from a Windows batch script, we must set up the
# Unix environment variables (e.g. PATH).
case "$arch" in
case "${OCAML_ARCH}" in
bsd|macos|linux) ;;
cygwin|mingw|mingw64)
. /etc/profile
@ -80,7 +81,7 @@ case "$arch" in
. "$HOME/.profile"
. "$HOME/.msenv64"
;;
*) error "unknown architecture: $arch";;
*) arch_error;;
esac
#########################################################################
@ -94,50 +95,40 @@ set -ex
# default values
make=make
instdir="$HOME/ocaml-tmp-install"
makefile=Makefile
configure=unix
confoptions="${OCAML_CONFIGURE_OPTIONS}"
make_native=true
cleanup=false
case "$branch" in
.) workdir="$jenkinsdir"
docheckout=false
;;
*) workdir="$HOME/jenkins-workspace/$branch"
docheckout=true
;;
esac
case "$arch" in
case "${OCAML_ARCH}" in
bsd) make=gmake ;;
macos) ;;
linux) ;;
linux)
confoptions="${confoptions} -with-instrumented-runtime"
;;
cygwin)
cleanup=true;;
mingw)
instdir=/cygdrive/c/ocamlmgw
makefile=Makefile.nt
configure=nt
cleanup=true
;;
mingw64)
instdir=/cygdrive/c/ocamlmgw64
makefile=Makefile.nt
configure=nt
cleanup=true
;;
msvc)
instdir=/cygdrive/c/ocamlms
makefile=Makefile.nt
configure=nt
cleanup=true
;;
msvc64)
instdir=/cygdrive/c/ocamlms64
makefile=Makefile.nt
configure=nt
cleanup=true
;;
*) error "unknown architecture: $arch";;
*) arch_error;;
esac
#########################################################################
@ -152,16 +143,11 @@ fi
# Go to the right directory
pwd
cd "$workdir"
# If Makefile.nt is absent, assume the new makefile system.
if ! [ -f $makefile ]; then makefile=Makefile; fi
cd "$jenkinsdir"
#########################################################################
# parse optional command-line arguments (has to be done after the "cd")
confoptions=""
make_native=true
while [ $# -gt 0 ]; do
case $1 in
-conf) confoptions="$confoptions `quote1 "$2"`"; shift;;
@ -178,36 +164,41 @@ done
# Tell gcc to use only ASCII in its diagnostic outputs.
export LC_ALL=C
$make -f $makefile distclean || :
$make distclean || :
# `make distclean` does not clean the files from previous versions that
# are not produced by the current version, so use `git clean` in addition.
git clean -f -d -x
if $docheckout; then
git fetch origin
git reset --hard FETCH_HEAD
fi
case $configure in
unix) eval "./configure -prefix '$instdir' $confoptions";;
unix)
confoptions="$confoptions -with-debug-runtime"
if $flambda; then
confoptions="$confoptions -flambda"
fi
eval "./configure -prefix '$instdir' $confoptions"
;;
nt)
cp config/m-nt.h config/m.h
cp config/s-nt.h config/s.h
cp config/Makefile.$arch config/Makefile
cp config/Makefile.${OCAML_ARCH} config/Makefile
sed -i 's%RUNTIMED=.\+%RUNTIMED=true%' config/Makefile
if $flambda; then
sed -i 's%FLAMBDA=.\+%FLAMBDA=true%' config/Makefile
fi
;;
*) error "internal error";;
esac
$make -f $makefile coldstart
$make -f $makefile core
$make -f $makefile coreboot
$make -f $makefile world
$make coldstart
$make core
$make coreboot
$make world
if $make_native; then
$make -f $makefile opt
$make -f $makefile opt.opt
$make opt
$make opt.opt
fi
$make -f $makefile install
$make install
rm -rf "$instdir"
cd testsuite

View File

@ -1,205 +0,0 @@
#!/bin/sh
#**************************************************************************
#* *
#* OCaml *
#* *
#* Damien Doligez, projet Gallium, INRIA Rocquencourt *
#* *
#* Copyright 2014 Institut National de Recherche en Informatique et *
#* en Automatique. *
#* *
#* All rights reserved. This file is distributed under the terms of *
#* the GNU Lesser General Public License version 2.1, with the *
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
# This script is run on our continuous-integration servers to recompile
# from scratch and run the test suite.
# To know the slave's architecture, this script looks at the OCAML_ARCH
# environment variable. For a given node NODe, this variable can be defined
# in Jenkins at the following address:
# https://ci.inria.fr/ocaml/computer/NODE/configure
# arguments:
# -conf configure-option add configure-option to configure cmd line
# -patch1 file-name apply patch with -p1
# -no-native do not build "opt" and "opt.opt"
error () {
echo "$1" >&2
exit 3
}
arch_error() {
configure_url = "https://ci.inria.fr/ocaml/computer/${NODE_NAME}/configure"
msg = "Unknown architecture. Make sure the OCAML_ARCH environemnt"
msg = "$msg variable has been defined."
msg = "$msg\nSee ${configure_url}"
error "$msg"
}
# Kill a task on Windows
# Errors are ignored
kill_task()
{
task=$1
taskkill /f /im ${task} || true
}
quote1 () {
printf "'%s'" "`printf %s "$1" | sed -e "s/'/'\\\\\\\\''/g"`";
}
#########################################################################
# be verbose
set -x
#########################################################################
# Save the current directory (on cygwin, /etc/profile changes it)
jenkinsdir="$(pwd)"
echo jenkinsdir=${jenkinsdir}
#########################################################################
# If we are called from a Windows batch script, we must set up the
# Unix environment variables (e.g. PATH).
case "${OCAML_ARCH}" in
bsd|macos|linux) ;;
cygwin|mingw|mingw64)
. /etc/profile
. "$HOME/.profile"
;;
msvc)
. /etc/profile
. "$HOME/.profile"
. "$HOME/.msenv32"
;;
msvc64)
. /etc/profile
. "$HOME/.profile"
. "$HOME/.msenv64"
;;
*) arch_error;;
esac
#########################################################################
# be verbose and stop on error
set -ex
#########################################################################
# set up variables
# default values
make=make
instdir="$HOME/ocaml-tmp-install"
configure=unix
confoptions="${OCAML_CONFIGURE_OPTIONS}"
make_native=true
cleanup=false
case "${OCAML_ARCH}" in
bsd) make=gmake ;;
macos) ;;
linux)
confoptions="${confoptions} -with-instrumented-runtime"
;;
cygwin)
cleanup=true;;
mingw)
instdir=/cygdrive/c/ocamlmgw
configure=nt
cleanup=true
;;
mingw64)
instdir=/cygdrive/c/ocamlmgw64
configure=nt
cleanup=true
;;
msvc)
instdir=/cygdrive/c/ocamlms
configure=nt
cleanup=true
;;
msvc64)
instdir=/cygdrive/c/ocamlms64
configure=nt
cleanup=true
;;
*) arch_error;;
esac
#########################################################################
# On Windows, cleanup processes that may remain from previous run
if $cleanup; then
tasks="tee ocamlrun program"
for task in ${tasks}; do kill_task ${task}.exe; done
fi
#########################################################################
# Go to the right directory
pwd
cd "$jenkinsdir"
#########################################################################
# parse optional command-line arguments (has to be done after the "cd")
while [ $# -gt 0 ]; do
case $1 in
-conf) confoptions="$confoptions `quote1 "$2"`"; shift;;
-patch1) patch -f -p1 <"$2"; shift;;
-no-native) make_native=false;;
*) error "unknown option $1";;
esac
shift
done
#########################################################################
# Do the work
# Tell gcc to use only ASCII in its diagnostic outputs.
export LC_ALL=C
$make distclean || :
# `make distclean` does not clean the files from previous versions that
# are not produced by the current version, so use `git clean` in addition.
git clean -f -d -x
case $configure in
unix)
confoptions="$confoptions -with-debug-runtime"
if $flambda; then
confoptions="$confoptions -flambda"
fi
eval "./configure -prefix '$instdir' $confoptions"
;;
nt)
cp config/m-nt.h config/m.h
cp config/s-nt.h config/s.h
cp config/Makefile.${OCAML_ARCH} config/Makefile
sed -i 's%RUNTIMED=.\+%RUNTIMED=true%' config/Makefile
if $flambda; then
sed -i 's%FLAMBDA=.\+%FLAMBDA=true%' config/Makefile
fi
;;
*) error "internal error";;
esac
$make coldstart
$make core
$make coreboot
$make world
if $make_native; then
$make opt
$make opt.opt
fi
$make install
rm -rf "$instdir"
cd testsuite
$make all