diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:22:06 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:22:06 +0000 |
commit | 5ecaa3a7f798e0da8bd46ed1757c21c0d6334505 (patch) | |
tree | 6947e7c36a88bbb00e0a950ee6b33e2aaf6254ff /ci-legacy/gha | |
parent | Adding upstream version 0.17.0. (diff) | |
download | rnp-upstream.tar.xz rnp-upstream.zip |
Adding upstream version 0.17.1.upstream/0.17.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ci-legacy/gha')
-rw-r--r-- | ci-legacy/gha/setup-env.inc.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ci-legacy/gha/setup-env.inc.sh b/ci-legacy/gha/setup-env.inc.sh new file mode 100644 index 0000000..c0aca85 --- /dev/null +++ b/ci-legacy/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 |