Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
ci
Commits
51e37125
Commit
51e37125
authored
7 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
add main buildjob script
parent
799685e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ansi-colors.sh
+19
-0
19 additions, 0 deletions
ansi-colors.sh
buildjob
+53
-0
53 additions, 0 deletions
buildjob
prepare-opam.sh
+16
-13
16 additions, 13 deletions
prepare-opam.sh
with
88 additions
and
13 deletions
ansi-colors.sh
0 → 100644
+
19
−
0
View file @
51e37125
# provide some variables to get colorful output
DARKGRAY
=
'\033[1;30m'
RED
=
'\033[0;31m'
LIGHTRED
=
'\033[1;31m'
GREEN
=
'\033[0;32m'
YELLOW
=
'\033[1;33m'
BLUE
=
'\033[0;34m'
PURPLE
=
'\033[0;35m'
LIGHTPURPLE
=
'\033[1;35m'
CYAN
=
'\033[0;36m'
WHITE
=
'\033[1;37m'
RESET
=
'\033[0m'
echo_color
()
{
# $1: the color
# $2: the string
echo
"
$1$2$RESET
"
}
This diff is collapsed.
Click to expand it.
buildjob
0 → 100755
+
53
−
0
View file @
51e37125
#!/bin/bash
set
-e
#set -x
## This runs a default build job. The following variables are noteworthy:
## - $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_UPDATE_SECRET, $OPAM_PKG, $OPAM_PKG_BRANCH: 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.
# Parepare
.
ci/ansi-colors
.
ci/prepare-opam
$OPAM_PINS
env
| egrep
'^(CI_BUILD_REF|CI_RUNNER)'
>
build-env.txt
# Build
echo_color
"
$GREEN
"
"[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
"
$GREEN
"
"[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
"
$GREEN
"
"[buildjob] Performing validation"
make validate
;
fi
# maybe create opam package
if
[[
-z
"
$OPAM_PKG_BRANCH
"
]]
;
then
OPAM_PKG_BRANCH
=
master
fi
if
[[
-n
"
$OPAM_PKG
"
&&
"
$CI_COMMIT_REF_NAME
"
==
"
$OPAM_PKG_BRANCH
"
]]
;
then
echo_color
"
$GREEN
"
"[buildjob] Releasing package on opam"
# 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
-X
POST
-F
"token=
$OPAM_UPDATE_SECRET
"
-F
"ref=master"
\
-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
"
\
https://gitlab.mpi-sws.org/api/v4/projects/581/trigger/pipeline
fi
This diff is collapsed.
Click to expand it.
prepare-opam
→
prepare-opam
.sh
100755 → 100644
+
16
−
13
View file @
51e37125
#!/bin/bash
set
-e
set
-x
## This script installs the build dependencies for CI builds.
## This script installs the build dependencies for CI builds.
# Prepare OPAM configuration
# Prepare OPAM configuration
...
@@ -9,10 +6,16 @@ export OPAMJOBS="$((2*$CPU_CORES))"
...
@@ -9,10 +6,16 @@ export OPAMJOBS="$((2*$CPU_CORES))"
export
OPAM_EDITOR
=
"
$(
which
false
)
"
export
OPAM_EDITOR
=
"
$(
which
false
)
"
# Make sure we got a good OPAM.
# Make sure we got a good OPAM.
test
-d
"
$OPAMROOT
"
||
(
mkdir
"
$OPAMROOT
"
&&
opam init
--no-setup
-y
)
if
test
-d
"
$OPAMROOT
"
;
then
echo_color
"
$GREEN
"
"[prepare-opam] Re-using cached opam root"
else
echo_color
"
$YELLOW
"
"[prepare-opam] Creating new opam root"
mkdir
"
$OPAMROOT
"
opam init
--no-setup
-y
fi
eval
`
opam conf
env
`
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
make build-dep/opam
# Update repositories
# Update repositories
...
@@ -36,7 +39,7 @@ echo
...
@@ -36,7 +39,7 @@ echo
# that is not currently possible.
# that is not currently possible.
# Install fixed versions of some dependencies.
# Install fixed versions of some dependencies.
echo
echo
_color
"
$GREEN
"
"[prepare-opam] Processing pins"
while
((
"$#"
))
;
do
# while there are arguments left
while
((
"$#"
))
;
do
# while there are arguments left
PACKAGE
=
"
$1
"
;
shift
PACKAGE
=
"
$1
"
;
shift
KIND
=
"
$1
"
;
shift
KIND
=
"
$1
"
;
shift
...
@@ -45,24 +48,24 @@ while (( "$#" )); do # while there are arguments left
...
@@ -45,24 +48,24 @@ while (( "$#" )); do # while there are arguments left
# Check if the pin is already set
# Check if the pin is already set
read
-a
PIN
<<<
$(
opam pin list |
(
egrep
"^
$PACKAGE
[. ]"
)
)
read
-a
PIN
<<<
$(
opam pin list |
(
egrep
"^
$PACKAGE
[. ]"
)
)
if
[[
"
${
PIN
[1]
}
"
==
"
$KIND
"
&&
"
${
PIN
[2]
}
"
==
"
$VERSION
"
]]
;
then
if
[[
"
${
PIN
[1]
}
"
==
"
$KIND
"
&&
"
${
PIN
[2]
}
"
==
"
$VERSION
"
]]
;
then
echo
"[
opam
-ci
]
$PACKAGE
already
$KIND
-pinned to
$VERSION
"
echo
_color
"
$GREEN
"
"[prepare-
opam]
$PACKAGE
already
$KIND
-pinned to
$VERSION
"
else
else
echo
"[
opam
-ci
]
$KIND
-pinning
$PACKAGE
to
$VERSION
"
echo
_color
"
$YELLOW
"
"[prepare-
opam]
$KIND
-pinning
$PACKAGE
to
$VERSION
"
opam pin add
-y
-k
"
$KIND
"
"
$PACKAGE
"
"
$VERSION
"
opam pin add
-y
-k
"
$KIND
"
"
$PACKAGE
"
"
$VERSION
"
fi
fi
done
done
echo
# Upgrade cached things.
# Upgrade cached things.
echo
echo_color
"
$GREEN
"
"[prepare-opam] Upgrading opam"
echo
"[opam-ci] Upgrading opam"
opam upgrade
-y
--fixup
&&
opam upgrade
-y
opam upgrade
-y
--fixup
&&
opam upgrade
-y
echo
# Install build-dependencies.
# Install build-dependencies.
echo
echo_color
"
$GREEN
"
"[prepare-opam] Installing build-dependencies"
echo
"[opam-ci] Installing build-dependencies"
make build-dep
OPAMFLAGS
=
-y
make build-dep
OPAMFLAGS
=
-y
echo
# done
# done
set
+x
echo
echo
coqc
-v
coqc
-v
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment