aboutsummaryrefslogtreecommitdiff
path: root/contrib/ci/ci.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ci/ci.sh')
-rwxr-xr-xcontrib/ci/ci.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/ci/ci.sh b/contrib/ci/ci.sh
new file mode 100755
index 000000000..7dd3a957a
--- /dev/null
+++ b/contrib/ci/ci.sh
@@ -0,0 +1,30 @@
1#!/bin/bash
2set -evuo pipefail
3
4# Use podman if available, otherwise use docker.
5# Fails if neither is found in PATH
6OCI_RUNTIME=$(which podman || which docker)
7REPO_NAME=$(basename "${PWD}")
8JOB_NAME="${1}"
9JOB_CONTAINER=$((grep CONTAINER_NAME ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${REPO_NAME}")
10
11echo "${JOB_CONTAINER}"
12
13if [ "${JOB_CONTAINER}" = "${REPO_NAME}" ] ; then
14 "${OCI_RUNTIME}" build \
15 -t "${JOB_CONTAINER}" \
16 -f ci/Containerfile .
17fi
18
19"${OCI_RUNTIME}" run \
20 --rm \
21 -ti \
22 --env CI_COMMIT_REF="$(git rev-parse HEAD)" \
23 --volume "${PWD}":/workdir \
24 --workdir /workdir \
25 "${JOB_CONTAINER}" \
26 ci/jobs/"${JOB_NAME}"/job.sh
27
28top_dir=$(dirname "${BASH_SOURCE[0]}")
29
30#"${top_dir}"/build.sh