Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • iris/ci
  • msammler/ci
  • snyke7/ci
3 results
Show changes
Commits on Source (11)
*~
# provide some variables to get colorful output
DARKGRAY='0;30'
RED='0;31'
BOLDRED='1;31'
GREEN='0;32'
BOLDGREEN='1;32'
YELLOW='0;33'
BOLDYELLOW='1;33'
BLUE='0;34'
BOLDBLUE='1;34'
PURPLE='0;35'
BOLDPURPLE='1;35'
CYAN='0;36'
WHITE='1;37'
echo_color() {
# $1: the color
# $2: the string
echo -e "\e[${1}m${2}\e[0m"
}
#!/bin/bash
set -e
#set -x
## This runs a default build job. The following variables are noteworthy:
## - $MAIN_BRANCH: The "main branch" this current branch comes from (usually
## master)
## - $OPAM_PINS: Space-separated list of packages to pin in opam, in the format
## "PACKAGE KIND TARGET PACKAGE KIND TARGET ..."
## - $VALIDATE: If non-empty, run `make validate`
## - $OPAM_PKG, $OPAM_UPDATE_SECRET: IF $OPAM_PKG is
## non-empty, release this commit as a new package on opam when done.
## Requires the $OPAM_UPDATE_SECRET variable to be set. This only happens if
## the current branch is $OPAM_PKG_BRANCH, or master if that variable is
## empty.
## - $TIMING_PROJECT, $TIMING_CONF, $TIMING_SECRET: If $TIMING_PROJECT is
## non-empty, submit timing information to coq-speed with the given project
## name and configuration string. Reqires the $TIMING_SECRET variable to be
## set.
# Parepare
. ci/ansi-colors.sh
. ci/prepare-opam.sh $OPAM_PINS # deliberately not quoted
env | egrep '^(CI_BUILD_REF|CI_RUNNER)' > build-env.txt
# Build
echo_color "$BOLDGREEN" "[buildjob] Perfoming build"
time make -k -j$CPU_CORES TIMED=y 2>&1 | tee build-log.txt
if fgrep Axiom build-log.txt >/dev/null; then exit 1; fi
echo_color "$BOLDGREEN" "[buildjob] Build time summary"
cat build-log.txt | egrep "[a-zA-Z0-9_/-]+ \((real|user): [0-9]" | tee build-time.txt
# maybe validate
if [[ -n "$VALIDATE" ]]; then
echo_color "$BOLDGREEN" "[buildjob] Performing validation"
make validate;
fi
# maybe submit timing information
if [[ -n "$TIMING_PROJECT" && -n "$TIMING_CONF" ]]; then
echo_color "$BOLDGREEN" "[buildjob] Submitting timing information to coq-speed"
# check if we have the secret
if [[ -z "$TIMING_SECRET" ]]; then
echo_color "$BOLDRED" "[buildjob] TIMING_SECRET variable is missing"
fi
# Submit to webhook endpoint
curl --fail -sS -X POST https://coq-speed.mpi-sws.org/webhook/build_times \
--user "$TIMING_SECRET" \
-H "X-Commit: $CI_COMMIT_SHA" \
-H "X-Project: $TIMING_PROJECT" \
-H "X-Branch: $CI_COMMIT_REF_NAME" \
-H "X-Config: $TIMING_CONF" \
-H "X-Date: $(git show $CI_COMMIT_SHA -s --pretty=%cI)" \
--data-binary @- < build-time.txt
fi
# maybe create opam package
if [[ -n "$OPAM_PKG" && "$CI_COMMIT_REF_NAME" == "$MAIN_BRANCH" ]]; then
echo_color "$BOLDGREEN" "[buildjob] Releasing package on opam"
# check if we have the secret
if [[ -z "$OPAM_UPDATE_SECRET" ]]; then
echo_color "$BOLDRED" "[buildjob] OPAM_UPDATE_SECRET variable is missing"
fi
# determine package name prefix
if [[ "$CI_COMMIT_REF_NAME" == master ]]; then
OPAM_PKG_PREFIX=dev
else
OPAM_PKG_PREFIX="branch.$CI_COMMIT_REF_NAME"
fi
# Trigger opam updater
curl --fail -sS -X POST https://gitlab.mpi-sws.org/api/v4/projects/581/trigger/pipeline \
-F "token=$OPAM_UPDATE_SECRET" \
-F "ref=master" \ # the branch we trigger on the other end
-F "variables[REPO]=$CI_PROJECT_URL.git" \
-F "variables[REF]=$CI_COMMIT_REF_NAME" \
-F "variables[SHA]=$CI_COMMIT_SHA" \
-F "variables[NAME]=$OPAM_PKG" \
-F "variables[OPAM_PREFIX]=$OPAM_PKG_PREFIX"
fi
#!/bin/bash
set -e
set -x
## This script installs the build dependencies for CI builds.
# Prepare OPAM configuration
......@@ -9,10 +6,16 @@ export OPAMJOBS="$((2*$CPU_CORES))"
export OPAM_EDITOR="$(which false)"
# Make sure we got a good OPAM.
test -d "$OPAMROOT" || (mkdir "$OPAMROOT" && opam init --no-setup -y)
if test -d "$OPAMROOT"; then
echo_color "$BOLDGREEN" "[prepare-opam] Re-using cached opam root"
else
echo_color "$BOLDYELLOW" "[prepare-opam] Creating new opam root"
mkdir "$OPAMROOT"
opam init --no-setup -y
fi
eval `opam conf env`
# Make sure the pin for the builddep package is not stale.
# Make sure the pin for the builddep package exists and is up-to-date
make build-dep/opam
# Update repositories
......@@ -36,7 +39,7 @@ echo
# that is not currently possible.
# Install fixed versions of some dependencies.
echo
echo_color "$BOLDGREEN" "[prepare-opam] Processing pins"
while (( "$#" )); do # while there are arguments left
PACKAGE="$1" ; shift
KIND="$1" ; shift
......@@ -45,24 +48,24 @@ while (( "$#" )); do # while there are arguments left
# Check if the pin is already set
read -a PIN <<< $(opam pin list | (egrep "^$PACKAGE[. ]"))
if [[ "${PIN[1]}" == "$KIND" && "${PIN[2]}" == "$VERSION" ]]; then
echo "[opam-ci] $PACKAGE already $KIND-pinned to $VERSION"
echo_color "$BOLDGREEN" "[prepare-opam] $PACKAGE already $KIND-pinned to $VERSION"
else
echo "[opam-ci] $KIND-pinning $PACKAGE to $VERSION"
echo_color "$BOLDYELLOW" "[prepare-opam] $KIND-pinning $PACKAGE to $VERSION"
opam pin add -y -k "$KIND" "$PACKAGE" "$VERSION"
fi
done
echo
# Upgrade cached things.
echo
echo "[opam-ci] Upgrading opam"
echo_color "$BOLDGREEN" "[prepare-opam] Upgrading packages"
opam upgrade -y --fixup && opam upgrade -y
echo
# Install build-dependencies.
echo
echo "[opam-ci] Installing build-dependencies"
echo_color "$BOLDGREEN" "[prepare-opam] Installing build-dependencies"
make build-dep OPAMFLAGS=-y
echo
# done
set +x
echo
coqc -v