Skip to content
Snippets Groups Projects
Commit 1443e856 authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Refactor CI setup

parent 08c6fcc0
No related branches found
No related tags found
1 merge request!1Refactor CI setup
image: eicweb.phy.anl.gov:4567/containers/eic_container/eic:latest image: eicweb.phy.anl.gov:4567/eic/juggler/juggler:latest
default: default:
tags:
- silicon
artifacts: artifacts:
expire_in: 10 mins expire_in: 3 days
paths: paths:
- config/ - detector/
- results/ - results/
- sim_output/
- data
# exclude:
# - .git/
# - datasets/.git/
#before_script:
# - git clone https://eicweb.phy.anl.gov/EIC/NPDet.git
# # - cd NPDet/build && cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j10 && make install
# # - cd ../..
stages: stages:
- build - init
- data_init
- config - config
- run - generate
- process
- analyze
- collect
- cleanup
- finish - finish
get_data: detector:
stage: data_init stage: init
tags:
- sodium
script:
- git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
- mkdir -p data
- mkdir -p results
- mkdir -p sim_output
generate_config:
stage: config
needs: ["get_data"]
tags:
- sodium
script: script:
- mkdir -p config && ./bin/gen_ci_config -p test_ -i dummy > config/dummy_config.yml - mkdir -p detector
- mkdir -p config && ./bin/gen_ci_config -p dis_ -i dis > config/dis_config.yml - bash init/build_detector.sh
dummy-pipeline:
stage: run
needs: ["generate_config"]
trigger:
include:
- artifact: config/dummy_config.yml
job: generate_config
strategy: depend
dis-pipeline: include:
stage: run - local: 'dis/config.yml'
needs: ["generate_config"] - local: 'dummy/config.yml'
trigger: - local: 'dvmp/config.yml'
include:
- artifact: config/dis_config.yml
job: generate_config
strategy: depend
final_report: summary:
stage: finish stage: finish
tags: needs: ["dis:results", "dummy:results", "dvmp:results"]
- sodium
needs: ["dis-pipeline","dummy-pipeline"]
script: script:
- echo "It was a success!" - echo "All benchmarks passed"
#!/bin/bash
set -o nounset
set -o errexit
BENCHMARK_SCRIPT_DIR=./dummy
CI_TAG=sodium
CI_JOB_PREFIX=test_
CI_FAILURE="true"
function print_the_help {
echo "USAGE: $0 [-t <runner_tag>] "
echo " OPTIONS: "
echo " -i,--input Input scripts directory "
echo " -t,--tag Gitlab Runner tag"
echo " -p,--prefix job name prefix"
echo " --no-failure do not allow failures"
exit
}
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift # past argument
print_the_help
;;
-i|--input)
BENCHMARK_SCRIPT_DIR="$2"
shift # past argument
shift # past value
;;
-t|--tag)
CI_TAG="$2"
shift # past argument
shift # past value
;;
-p|--prefix)
CI_JOB_PREFIX="$2"
shift # past argument
shift # past value
;;
--no-failure)
CI_FAILURE="false"
shift # past argument
;;
*) # unknown option
#POSITIONAL+=("$1") # save it in an array for later
echo "unknown option $1"
print_the_help
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
shopt -s nullglob
ifile=0
cat <<EOF
stages:
#- simulate
- benchmarks
EOF
for script_name in ${BENCHMARK_SCRIPT_DIR}/*.sh
do
filename=$(basename ${script_name})
filename_noext="${filename%%.*}"
ifile=$((ifile+1))
cat <<EOF
${CI_JOB_PREFIX}${ifile}_${filename_noext}:
tags:
- ${CI_TAG}
stage: benchmarks
script:
- bash ${script_name}
allow_failure: ${CI_FAILURE}
EOF
done
for script_name in ${BENCHMARK_SCRIPT_DIR}/*.cxx
do
filename=$(basename ${script_name})
filename_noext="${filename%%.*}"
ifile=$((ifile+1))
cat <<EOF
${CI_JOB_PREFIX}${ifile}_${filename_noext}:
tags:
- ${CI_TAG}
stage: benchmarks
script:
- root -b -q ${script_name}
allow_failure: ${CI_FAILURE}
EOF
done
#!/bin/bash
if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then
export JUGGLER_DETECTOR="topside"
fi
if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=100
fi
if [[ ! -n "${JUGGLER_INSTALL_PREFIX}" ]] ; then
export JUGGLER_INSTALL_PREFIX="/usr/local"
fi
if [[ ! -n "${DETECTOR_PREFIX}" ]]; then
export DETECTOR_PREFIX=detector
fi
## ensure absolute paths
export JUGGLER_INSTALL_PREFIX=`realpath ${JUGGLER_INSTALL_PREFIX}`
export DETECTOR_PREFIX=`realpath ${DETECTOR_PREFIX}`
## setup detector paths
export LD_LIBRARY_PATH=${DETECTOR_PREFIX}/lib:$LD_LIBRARY_PATH
export DETECTOR_SOURCE_PATH=${DETECTOR_PREFIX}/src
dis:dummy_test:
stage: analyze
needs: ["detector"]
timeout: 1 hours
script:
- dis/dummy_test.sh
dis:dummy_test2:
stage: analyze
needs: ["detector"]
timeout: 1 hours
script:
- dis/dummy_test2.sh
dis:dummy_fail_test:
stage: analyze
needs: ["detector"]
timeout: 1 hours
allow_failure: true
script:
- dis/dummy_fail_test.sh
dis:results:
stage: collect
needs: ["dis:dummy_test", "dis:dummy_test2", "dis:dummy_fail_test"]
script:
- echo "All DIS benchmarks successful"
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
dummy:dummy_test:
stage: analyze
needs: ["detector"]
timeout: 1 hours
script:
- dummy/dummy_test.sh
dummy:dummy_test2:
stage: analyze
needs: ["detector"]
timeout: 1 hours
script:
- dummy/dummy_test2.sh
dummy:dummy_fail_test:
stage: analyze
needs: ["detector"]
timeout: 1 hours
allow_failure: true
script:
- dummy/dummy_fail_test.sh
dummy:results:
stage: collect
needs: ["dummy:dummy_test", "dummy:dummy_test2", "dummy:dummy_fail_test"]
script:
- echo "All DIS benchmarks successful"
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
dvmp:dummy_test:
stage: analyze
needs: ["detector"]
timeout: 1 hours
script:
- dvmp/dummy_test.sh
dvmp:dummy_test2:
stage: analyze
needs: ["detector"]
timeout: 1 hours
script:
- dvmp/dummy_test2.sh
dvmp:dummy_fail_test:
stage: analyze
needs: ["detector"]
timeout: 1 hours
allow_failure: true
script:
- dvmp/dummy_fail_test.sh
dvmp:results:
stage: collect
needs: ["dvmp:dummy_test", "dvmp:dummy_test2", "dvmp:dummy_fail_test"]
script:
- echo "All DIS benchmarks successful"
#!/bin/bash
echo "Dummy Test..."
echo "..."
echo "Fails!"
exit 1
#!/bin/bash
echo "Dummy Test..."
echo "..."
echo "Passes!"
#exit 1
#!/bin/bash
echo "Dummy Test number 2..."
echo "..."
echo "Passes!"
#exit 1
#!/bin/bash
## Init the environment
source config/env.sh
## Build and install the detector plugins.
if [[ ! -d ${DETECTOR_SOURCE_PATH} ]]; then
git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git ${DETECTOR_SOURCE_PATH}
else
pushd ${DETECTOR_SOURCE_PATH}
git pull --ff-only
popd
fi
mkdir -p detector-build
pushd detector-build
echo cmake ${DETECTOR_SOURCE_PATH} -DCMAKE_INSTALL_PREFIX=${DETECTOR_PREFIX} && make -j30 install
cmake ${DETECTOR_SOURCE_PATH} -DCMAKE_INSTALL_PREFIX=${DETECTOR_PREFIX} && make -j30 install
popd
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