Skip to content
Snippets Groups Projects
Commit 45f057ba authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[ci] external plugin ci depends on OCAML

parent 09b65855
No related branches found
No related tags found
No related merge requests found
...@@ -5,18 +5,15 @@ set -euxo pipefail ...@@ -5,18 +5,15 @@ set -euxo pipefail
if [[ $# != 1 ]]; if [[ $# != 1 ]];
then then
cat <<EOF cat <<EOF
usage: $0 <plugin> | all usage: OCAML=N_MM $0 <plugin>
$0 all run CI on all plugins $0 <plugin_name> run CI on this plugin
$0 <plugin_name> run CI only on this plugins
EOF EOF
exit 2 exit 2
fi fi
# all plugins to check if [ -z ${OCAML+x} ]; then
all_plugins=(Volatile) echo "OCAML variable must be set to a version of OCaml"
if [[ "$1" = "all" ]]; exit 2
then plugins=("${all_plugins[@]}")
else plugins=("$1")
fi fi
DEFAULT=${DEFAULT:-master} DEFAULT=${DEFAULT:-master}
...@@ -51,59 +48,55 @@ cleanup () { ...@@ -51,59 +48,55 @@ cleanup () {
trap cleanup EXIT trap cleanup EXIT
do_plugin () { OPTS="--arg frama-c-repo $curdir"
OPTS="--arg frama-c-repo $curdir"
plugin=$1
plugin=$1
cd "$(mktemp -d)" cd "$(mktemp -d)"
# the hash of the derivation depends on the directory name
mkdir "$plugin" # the hash of the derivation depends on the directory name
cd "$plugin" mkdir "$plugin"
plugin_repo="$(readlink -f .)" cd "$plugin"
plugin_url="git@git.frama-c.com:frama-c/$plugin.git" plugin_repo="$(readlink -f .)"
plugin_url="git@git.frama-c.com:frama-c/$plugin.git"
plugin_branch="$(get_matching_branch "$plugin_url" "$git_current_branch")"
echo "using branch $plugin_branch of $plugin_url" plugin_branch="$(get_matching_branch "$plugin_url" "$git_current_branch")"
git clone --depth=1 --branch="$plugin_branch" "$plugin_url" . echo "using branch $plugin_branch of $plugin_url"
git clone --depth=1 --branch="$plugin_branch" "$plugin_url" .
declare -A deps=( )
declare -A dirs=( ) declare -A deps=( )
declare -A dirs=( )
if [[ -f "./nix/dependencies" ]]; then
while read -r var value; do
deps[$var]=$value
done < "./nix/dependencies"
for repo in ${!deps[@]}; do
# the hash of the derivation depends on the directory name
mkdir "../$repo"
directory="$(readlink -f ../$repo)"
dirs[$repo]=$directory
url=${deps[$repo]}
branch="$(get_matching_branch "$url" "$git_current_branch")"
echo "using branch $branch of $repo at $directory"
# clone
git clone --depth=1 --branch="$branch" "$url" "$directory"
OPTS="$OPTS --arg $repo $directory"
done
fi
# run the build if [[ -f "./nix/dependencies" ]]; then
nix-build --no-out-link "./nix/pkgs.nix" $OPTS -A ocaml-ng.ocamlPackages_4_12."$plugin" while read -r var value; do
deps[$var]=$value
done < "./nix/dependencies"
cd "$curdir" for repo in ${!deps[@]}; do
# the hash of the derivation depends on the directory name
mkdir "../$repo"
directory="$(readlink -f ../$repo)"
dirs[$repo]=$directory
for repo in ${!dirs[@]}; do url=${deps[$repo]}
if [[ -n ${dirs[$repo]} ]]; branch="$(get_matching_branch "$url" "$git_current_branch")"
then rm -rf "${dirs[$repo]}" echo "using branch $branch of $repo at $directory"
fi # clone
git clone --depth=1 --branch="$branch" "$url" "$directory"
OPTS="$OPTS --arg $repo $directory"
done done
fi
rm -rf "$plugin_repo" # run the build
} nix-build --no-out-link "./nix/pkgs.nix" $OPTS -A ocaml-ng.ocamlPackages_$OCAML."$plugin"
for plugin in "${plugins[@]}"; do cd "$curdir"
do_plugin $plugin
for repo in ${!dirs[@]}; do
if [[ -n ${dirs[$repo]} ]];
then rm -rf "${dirs[$repo]}"
fi
done done
rm -rf "$plugin_repo"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment