diff --git a/.github/workflows/guix-build.yml b/.github/workflows/guix-build.yml index 9e5328e213..ceeffec953 100644 --- a/.github/workflows/guix-build.yml +++ b/.github/workflows/guix-build.yml @@ -51,11 +51,11 @@ jobs: run: | docker run --privileged -d --rm -t \ --name guix-daemon \ - -e ADDITIONAL_GUIX_COMMON_FLAGS='--max-jobs=32' \ + -e ADDITIONAL_GUIX_COMMON_FLAGS="--max-jobs=$(nproc --all)" \ -v ${{ github.workspace }}:/src/dash \ -w /src/dash \ guix_ubuntu:latest && \ - docker exec guix-daemon bash -c "/usr/local/bin/guix-start" + docker exec guix-daemon bash -c '/usr/local/bin/guix-start' - name: Ensure build passes run: | @@ -63,14 +63,7 @@ jobs: echo "Guix build failed!" exit 1 fi - - name: Compute SHA256 checksums for binaries + + - name: Compute SHA256 checksums run: | - ( \ - SRC_PATH_PREFIX=guix-build-$(git rev-parse --short=12 HEAD)/distsrc- && \ - sha256sum ${SRC_PATH_PREFIX}*/src/dash{d,-cli,-tx,-wallet}{,.exe} && \ - sha256sum ${SRC_PATH_PREFIX}*/src/qt/dash-qt{,.exe} && \ - sha256sum ${SRC_PATH_PREFIX}*/src/test/test_dash{,.exe} \ - ) | sort -k 2 - - name: Compute SHA256 checksums for archives - run: | - find guix-build-"$(git rev-parse --short=12 HEAD)"/output -type f | grep -v SHA256 | xargs sha256sum | sort -k 2 + ./contrib/containers/guix/scripts/guix-check ${{ github.workspace }} diff --git a/contrib/containers/guix/scripts/guix-check b/contrib/containers/guix/scripts/guix-check index e70170066a..e16891bc72 100755 --- a/contrib/containers/guix/scripts/guix-check +++ b/contrib/containers/guix/scripts/guix-check @@ -2,16 +2,27 @@ set -eo pipefail -cd /src/dash -COMMIT_ID=$(git rev-parse --short=12 HEAD) +if [[ -n "${1}" ]]; then + WORKSPACE_PATH="$1" +else + WORKSPACE_PATH="/src/dash" +fi -printf "Binaries:\n" +if [[ ! -d "$WORKSPACE_PATH" ]]; then + echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!" + exit 1 +fi + +cd "$WORKSPACE_PATH" +COMMIT_ID="$(git rev-parse --short=12 HEAD)" + +printf "\nBinaries:\n\n" ( \ -SRC_PATH_PREFIX=guix-build-${COMMIT_ID}/distsrc- && \ +SRC_PATH_PREFIX="guix-build-${COMMIT_ID}/distsrc-" && \ sha256sum ${SRC_PATH_PREFIX}*/src/dash{d,-cli,-tx,-wallet}{,.exe} && \ sha256sum ${SRC_PATH_PREFIX}*/src/qt/dash-qt{,.exe} && \ sha256sum ${SRC_PATH_PREFIX}*/src/test/test_dash{,.exe} \ ) | sort -k 2 -printf "Archives:\n" -find guix-build-"${COMMIT_ID}"/output -type f | grep -v SHA256 | xargs sha256sum | sort -k 2 +printf "\nArchives:\n\n" +find "guix-build-${COMMIT_ID}/output" -type f | grep -v SHA256 | xargs sha256sum | sort -k 2 diff --git a/contrib/containers/guix/scripts/guix-start b/contrib/containers/guix/scripts/guix-start index 0e1e1eaf49..7d0f27d811 100755 --- a/contrib/containers/guix/scripts/guix-start +++ b/contrib/containers/guix/scripts/guix-start @@ -2,19 +2,30 @@ set -eo pipefail +if [[ -n "${1}" ]]; then + WORKSPACE_PATH="$1" +else + WORKSPACE_PATH="/src/dash" +fi + +if [[ ! -d "$WORKSPACE_PATH" ]]; then + echo "$0: $WORKSPACE_PATH is not a valid directory, exiting!" + exit 1 +fi + XCODE_VERSION="12.1" XCODE_RELEASE="12A7403" XCODE_ARCHIVE="Xcode-${XCODE_VERSION}-${XCODE_RELEASE}-extracted-SDK-with-libcxx-headers" # Check if macOS SDK is present, if not, download it -if [ ! -d "/src/dash/depends/SDKs/${XCODE_ARCHIVE}" ] +if [ ! -d "${WORKSPACE_PATH}/depends/SDKs/${XCODE_ARCHIVE}" ] then - mkdir -p /src/dash/depends/SDKs - curl -L https://bitcoincore.org/depends-sources/sdks/${XCODE_ARCHIVE}.tar.gz | tar -xz -C /src/dash/depends/SDKs + mkdir -p "${WORKSPACE_PATH}/depends/SDKs" + curl -L https://bitcoincore.org/depends-sources/sdks/${XCODE_ARCHIVE}.tar.gz | tar -xz -C "${WORKSPACE_PATH}/depends/SDKs" fi -cd /src/dash +cd "${WORKSPACE_PATH}" +git config --global --add safe.directory "${WORKSPACE_PATH}" git status >> /dev/null -git config --global --add safe.directory /src/dash ./contrib/guix/guix-build