summaryrefslogtreecommitdiffstats
path: root/ci/gha
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:32:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:32:49 +0000
commit8053187731ae8e3eb368d8360989cf5fd6eed9f7 (patch)
tree32bada84ff5d7460cdf3934fcbdbe770d6afe4cd /ci/gha
parentInitial commit. (diff)
downloadrnp-8053187731ae8e3eb368d8360989cf5fd6eed9f7.tar.xz
rnp-8053187731ae8e3eb368d8360989cf5fd6eed9f7.zip
Adding upstream version 0.17.0.upstream/0.17.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ci/gha')
-rw-r--r--ci/gha/setup-env.inc.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/ci/gha/setup-env.inc.sh b/ci/gha/setup-env.inc.sh
new file mode 100644
index 0000000..c0aca85
--- /dev/null
+++ b/ci/gha/setup-env.inc.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+# shellcheck disable=SC2086,SC2129,SC2034
+
+set -euxo pipefail
+# execute this script in a separate, early step
+
+LOCAL_BUILDS="${GITHUB_WORKSPACE}/builds"
+
+# To install and cache our dependencies we need an absolute path
+# that does not change, is writable, and resides within
+# GITHUB_WORKSPACE.
+# On macOS GITHUB_WORKSPACE includes the github runner version,
+# so it does not remain constant.
+# This causes problems with, for example, pkgconfig files
+# referencing paths that no longer exist.
+CACHE_DIR="installs"
+mkdir -p "${CACHE_DIR}"
+
+if [[ "${RUNNER_OS}" = "Windows" ]]
+then
+ rnp_local_installs="${RUNNER_TEMP}/rnp-local-installs"
+else
+ rnp_local_installs=/tmp/rnp-local-installs
+fi
+
+ln -s "$GITHUB_WORKSPACE/installs" "${rnp_local_installs}"
+LOCAL_INSTALLS="${rnp_local_installs}"
+
+# When building packages, dependencies with non-standard installation paths must
+# be found by the (DEB) package builder.
+BOTAN_INSTALL="${rnp_local_installs}/botan-install"
+JSONC_INSTALL="${rnp_local_installs}/jsonc-install"
+GPG_INSTALL="${rnp_local_installs}/gpg-install"
+
+# set this explicitly since we don't want to cache the rnp installation
+RNP_INSTALL="${GITHUB_WORKSPACE}/rnp-install"
+
+for var in \
+ LOCAL_BUILDS \
+ CACHE_DIR \
+ LOCAL_INSTALLS \
+ BOTAN_INSTALL \
+ JSONC_INSTALL \
+ GPG_INSTALL \
+ RNP_INSTALL
+do
+ val="${!var}"
+
+ # Replace all backslashes with forward slashes, for cmake, so the following
+ # error would not come up:
+ #
+ # Invalid character escape '\a'.
+ #
+ if [[ "${RUNNER_OS}" = "Windows" ]]
+ then
+ val="${val//\\/\/}"
+ fi
+
+ echo "${var}=${val}" >> "$GITHUB_ENV"
+done