Merge #6390: guix: build only supported targets using guix-start, update guix-start and guix-check to work correctly outside of containers

c5d482e0d2 chore: suppress `git config` output (UdjinM6)
8ce9bfea59 chore: tweak error message (UdjinM6)
f4d879a0b3 guix: more sanity checks for `WORKSPACE_PATH` (UdjinM6)
07f056a377 guix: Let `XCODE_SOURCE` be specified via env (UdjinM6)
74489dc82d chore: Log when preparing macOS SDK or adding `safe.directory` option (UdjinM6)
3ac5739e38 guix: "Invert" `guix-start`/`guix-check` cmd-line argument behaviour, defaults to `pwd` (UdjinM6)
187a4f1a0c guix: Avoid adding duplicate `safe.directory` option (UdjinM6)
87c978605e guix: `guix-start` should respect `SDK_PATH` (UdjinM6)
ee5f62b0db guix: build only supported targets using Guix container (Kittywhiskers Van Gogh)

Pull request description:

  ## Issue being fixed or feature implemented
  https://github.com/dashpay/dash/pull/6382#discussion_r1833266383 https://github.com/dashpay/dash/pull/6388#discussion_r1835779789

  alternative to #6388

  ## What was done?

  ## How Has This Been Tested?

  ## Breaking Changes

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  kwvg:
    ACK c5d482e0d2

Tree-SHA512: c0271f243f5912f55276fcb371a135f443f23cc1f29480f303ea77deeadb6fd7d3d97e07e6a1fa323a2b2bad1d65aa6298da33978832eb68a0a6303db3e0063c
This commit is contained in:
pasta 2024-11-14 10:22:12 -06:00
commit 9bfb7006a9
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
3 changed files with 25 additions and 20 deletions

View File

@ -114,7 +114,7 @@ jobs:
-v ${{ github.workspace }}/.cache:/home/ubuntu/.cache \ -v ${{ github.workspace }}/.cache:/home/ubuntu/.cache \
-w /src/dash \ -w /src/dash \
ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-guix-builder:${{ needs.build-image.outputs.image-tag }} && \ ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-guix-builder:${{ needs.build-image.outputs.image-tag }} && \
docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start' docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start /src/dash'
- name: Ensure build passes - name: Ensure build passes
run: | run: |

View File

@ -2,14 +2,10 @@
set -eo pipefail set -eo pipefail
if [[ -n "${1}" ]]; then WORKSPACE_PATH="${1:-$(pwd)}"
WORKSPACE_PATH="$1"
else
WORKSPACE_PATH="/src/dash"
fi
if [[ ! -d "$WORKSPACE_PATH" ]]; then if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPACE_PATH}/contrib/guix/libexec/prelude.bash" ]]; then
echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!" echo "${0##*/}: ${WORKSPACE_PATH} is not the top directory of the Dash Core repository, exiting!"
exit 1 exit 1
fi fi

View File

@ -2,30 +2,39 @@
set -eo pipefail set -eo pipefail
if [[ -n "${1}" ]]; then WORKSPACE_PATH="${1:-$(pwd)}"
WORKSPACE_PATH="$1"
else
WORKSPACE_PATH="/src/dash"
fi
if [[ ! -d "$WORKSPACE_PATH" ]]; then if [[ ! -d "${WORKSPACE_PATH}" || ! "${WORKSPACE_PATH}" = /* || ! -f "${WORKSPACE_PATH}/contrib/guix/guix-build" ]]; then
echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!" echo "${0##*/}: ${WORKSPACE_PATH} is not the top directory of the Dash Core repository, exiting!"
exit 1 exit 1
fi fi
XCODE_VERSION="12.2" XCODE_VERSION="12.2"
XCODE_RELEASE="12B45b" XCODE_RELEASE="12B45b"
XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers" XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers"
XCODE_SOURCE="${XCODE_SOURCE:-https://bitcoincore.org/depends-sources/sdks}"
export SDK_PATH="${SDK_PATH:-${WORKSPACE_PATH}/depends/SDKs}"
# Check if macOS SDK is present, if not, download it # Check if macOS SDK is present, if not, download it
if [ ! -d "${WORKSPACE_PATH}/depends/SDKs/${XCODE_ARCHIVE}" ] if [[ ! -d "${SDK_PATH}/${XCODE_ARCHIVE}" ]]; then
then echo "Preparing macOS SDK..."
mkdir -p "${WORKSPACE_PATH}/depends/SDKs" mkdir -p "${SDK_PATH}"
curl -L https://bitcoincore.org/depends-sources/sdks/${XCODE_ARCHIVE}.tar.gz | tar -xz -C "${WORKSPACE_PATH}/depends/SDKs" curl -L "${XCODE_SOURCE}/${XCODE_ARCHIVE}.tar.gz" | tar -xz -C "${SDK_PATH}"
fi
# Add safe.directory option only when WORKSPACE_PATH was specified via cmd-line arguments (happens in CI)
if [[ -n "${1}" ]]; then
# Avoid adding duplicates
git config --global --fixed-value --get safe.directory "${WORKSPACE_PATH}" >> /dev/null || \
(echo "Adding safe.directory" && git config --global --add safe.directory "${WORKSPACE_PATH}")
fi fi
cd "${WORKSPACE_PATH}" cd "${WORKSPACE_PATH}"
git config --global --add safe.directory "${WORKSPACE_PATH}"
git status >> /dev/null git status >> /dev/null
export HOSTS="${HOSTS:-x86_64-linux-gnu aarch64-linux-gnu riscv64-linux-gnu
x86_64-w64-mingw32
x86_64-apple-darwin arm64-apple-darwin}"
./contrib/guix/guix-build ./contrib/guix/guix-build