[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/05: ci: add script for running CI locally
From: |
gnunet |
Subject: |
[gnunet] 02/05: ci: add script for running CI locally |
Date: |
Wed, 11 Oct 2023 22:56:38 +0200 |
This is an automated email from the git hooks/post-receive script.
dvn pushed a commit to branch master
in repository gnunet.
commit ea67f52d2e64991acd70324f5db27d1efd99e408
Author: Devan Carpenter <git@dvn.me>
AuthorDate: Thu Sep 21 09:57:38 2023 -0400
ci: add script for running CI locally
---
ci/ci.sh | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/ci/ci.sh b/ci/ci.sh
new file mode 100755
index 000000000..7dd3a957a
--- /dev/null
+++ b/ci/ci.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -evuo pipefail
+
+# Use podman if available, otherwise use docker.
+# Fails if neither is found in PATH
+OCI_RUNTIME=$(which podman || which docker)
+REPO_NAME=$(basename "${PWD}")
+JOB_NAME="${1}"
+JOB_CONTAINER=$((grep CONTAINER_NAME ci/jobs/${JOB_NAME}/config.ini | cut -d'
' -f 3) || echo "${REPO_NAME}")
+
+echo "${JOB_CONTAINER}"
+
+if [ "${JOB_CONTAINER}" = "${REPO_NAME}" ] ; then
+ "${OCI_RUNTIME}" build \
+ -t "${JOB_CONTAINER}" \
+ -f ci/Containerfile .
+fi
+
+"${OCI_RUNTIME}" run \
+ --rm \
+ -ti \
+ --env CI_COMMIT_REF="$(git rev-parse HEAD)" \
+ --volume "${PWD}":/workdir \
+ --workdir /workdir \
+ "${JOB_CONTAINER}" \
+ ci/jobs/"${JOB_NAME}"/job.sh
+
+top_dir=$(dirname "${BASH_SOURCE[0]}")
+
+#"${top_dir}"/build.sh
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.