Compare commits

..

21 Commits

Author SHA1 Message Date
Denis Angell
d750868fc7 add tests 2025-03-04 15:47:42 +01:00
Denis Angell
7422c3ee79 Merge branch 'dev' into touch 2025-03-04 15:45:30 +01:00
RichardAH
25d6b13b56 Merge branch 'dev' into touch 2024-12-16 16:11:44 +10:00
Denis Angell
3fe4a7970b [fold] remove unused variable 2024-11-20 11:53:47 +01:00
Denis Angell
8be818cd25 Merge branch 'dev' into touch 2024-11-20 11:40:01 +01:00
Denis Angell
bec75d0e6b clang-format 2024-11-20 11:32:54 +01:00
RichardAH
91b9442d42 Merge branch 'dev' into touch 2024-11-09 15:18:44 +10:00
RichardAH
bf7dd9dadc Merge branch 'dev' into touch 2024-11-09 13:48:08 +10:00
Denis Angell
f3e5684a8f fix tests 2024-09-19 14:30:03 +02:00
Denis Angell
c9f448120c clang-format 2024-09-19 11:39:52 +02:00
Denis Angell
34612f9e6f Merge branch 'dev' into touch 2024-09-19 11:35:24 +02:00
Denis Angell
7b5bd46c9f fix tests 2024-07-04 10:27:33 +02:00
Denis Angell
5b328b57fa Merge branch 'dev' into touch 2024-06-05 12:19:31 +02:00
Denis Angell
ebd655ca0f clang-format 2024-05-23 08:18:36 +02:00
Denis Angell
bca4b9ed85 update failing tests 2024-05-23 08:17:52 +02:00
Denis Angell
1d4bc90a4f add test 2024-05-21 15:56:32 +02:00
Denis Angell
f622ad83e4 reorder touch amendment 2024-05-21 15:53:47 +02:00
Denis Angell
658c351d03 fix bug 2024-05-21 15:53:21 +02:00
Denis Angell
bd161982d2 Merge branch 'dev' into touch 2024-05-21 13:43:52 +02:00
RichardAH
0ab2eaa021 Merge branch 'dev' into touch 2024-03-27 13:30:59 +11:00
Richard Holland
247c17215c inital version of touch amendment 2024-03-15 03:02:02 +00:00
4 changed files with 23 additions and 112 deletions

View File

@@ -2,104 +2,37 @@ name: Build using Docker
on: on:
push: push:
branches: ["dev", "candidate", "release", "jshooks"] branches: [ "dev", "candidate", "release", "jshooks" ]
pull_request: pull_request:
branches: ["dev", "candidate", "release", "jshooks"] branches: [ "dev", "candidate", "release", "jshooks" ]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}
cancel-in-progress: true cancel-in-progress: false
env:
DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP: 1
jobs: jobs:
checkout: checkout:
runs-on: [self-hosted, vanity] runs-on: [self-hosted, vanity]
outputs:
checkout_path: ${{ steps.vars.outputs.checkout_path }}
steps: steps:
- name: Prepare checkout path - uses: actions/checkout@v4
id: vars with:
run: | clean: false
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
CHECKOUT_PATH="${SAFE_BRANCH}-${{ github.sha }}"
echo "checkout_path=${CHECKOUT_PATH}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
path: ${{ steps.vars.outputs.checkout_path }}
clean: true
fetch-depth: 2 # Only get the last 2 commits, to avoid fetching all history
checkpatterns: checkpatterns:
runs-on: [self-hosted, vanity] runs-on: [self-hosted, vanity]
needs: checkout needs: checkout
defaults:
run:
working-directory: ${{ needs.checkout.outputs.checkout_path }}
steps: steps:
- name: Check for suspicious patterns - name: Check for suspicious patterns
run: /bin/bash suspicious_patterns.sh run: /bin/bash suspicious_patterns.sh
build: build:
runs-on: [self-hosted, vanity] runs-on: [self-hosted, vanity]
needs: [checkpatterns, checkout] needs: checkpatterns
defaults:
run:
working-directory: ${{ needs.checkout.outputs.checkout_path }}
steps: steps:
- name: Set Cleanup Script Path - name: Build using Docker
run: | run: /bin/bash release-builder.sh
echo "JOB_CLEANUP_SCRIPT=$(mktemp)" >> $GITHUB_ENV
- name: Build using Docker
run: /bin/bash release-builder.sh
- name: Stop Container (Cleanup)
if: always()
run: |
echo "Running cleanup script: $JOB_CLEANUP_SCRIPT"
/bin/bash -e -x "$JOB_CLEANUP_SCRIPT"
CLEANUP_EXIT_CODE=$?
if [[ "$CLEANUP_EXIT_CODE" -eq 0 ]]; then
echo "Cleanup script succeeded."
rm -f "$JOB_CLEANUP_SCRIPT"
echo "Cleanup script removed."
else
echo "⚠️ Cleanup script failed! Keeping for debugging: $JOB_CLEANUP_SCRIPT"
fi
if [[ "${DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP}" == "1" ]]; then
echo "🔍 Checking for leftover containers..."
BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "")
if [[ -n "$BUILD_CONTAINERS" ]]; then
echo "⚠️ WARNING: Some build containers are still running"
echo "$BUILD_CONTAINERS"
else
echo "✅ No build containers found"
fi
fi
tests: tests:
runs-on: [self-hosted, vanity] runs-on: [self-hosted, vanity]
needs: [build, checkout] needs: build
defaults:
run:
working-directory: ${{ needs.checkout.outputs.checkout_path }}
steps: steps:
- name: Unit tests - name: Unit tests
run: /bin/bash docker-unit-tests.sh run: /bin/bash docker-unit-tests.sh
cleanup:
runs-on: [self-hosted, vanity]
needs: [tests, checkout]
if: always()
steps:
- name: Cleanup workspace
run: |
CHECKOUT_PATH="${{ needs.checkout.outputs.checkout_path }}"
echo "Cleaning workspace for ${CHECKOUT_PATH}"
rm -rf "${{ github.workspace }}/${CHECKOUT_PATH}"

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
echo "Mounting $(pwd)/io in ubuntu and running unit tests"
docker run --rm -i -v $(pwd):/io ubuntu sh -c '/io/release-build/xahaud -u' docker run --rm -i -v $(pwd):/io ubuntu sh -c '/io/release-build/xahaud -u'

View File

@@ -5,43 +5,21 @@
# debugging. # debugging.
set -ex set -ex
set -e
echo "START BUILDING (HOST)" echo "START BUILDING (HOST)"
echo "Cleaning previously built binary" echo "Cleaning previously built binary"
rm -f release-build/xahaud rm -f release-build/xahaud
BUILD_CORES=$(echo "scale=0 ; `nproc` / 1.337" | bc) BUILD_CORES=$(echo "scale=0 ; `nproc` / 1.337" | bc)
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-""}
GITHUB_SHA=${GITHUB_SHA:-"local"}
GITHUB_RUN_NUMBER=${GITHUB_RUN_NUMBER:-"0"}
GITHUB_WORKFLOW=${GITHUB_WORKFLOW:-"local"}
GITHUB_REF=${GITHUB_REF:-"local"}
if [[ "$GITHUB_REPOSITORY" == "" ]]; then if [[ "$GITHUB_REPOSITORY" == "" ]]; then
#Default #Default
BUILD_CORES=8 BUILD_CORES=8
fi fi
EXIT_IF_CONTAINER_RUNNING=${EXIT_IF_CONTAINER_RUNNING:-1} CONTAINER_NAME=xahaud_cached_builder_$(echo "$GITHUB_ACTOR" | awk '{print tolower($0)}')
# Ensure still works outside of GH Actions by setting these to /dev/null
# GA will run this script and then delete it at the end of the job
JOB_CLEANUP_SCRIPT=${JOB_CLEANUP_SCRIPT:-/dev/null}
NORMALIZED_WORKFLOW=$(echo "$GITHUB_WORKFLOW" | tr -c 'a-zA-Z0-9' '-')
NORMALIZED_REF=$(echo "$GITHUB_REF" | tr -c 'a-zA-Z0-9' '-')
CONTAINER_NAME="xahaud_cached_builder_${NORMALIZED_WORKFLOW}-${NORMALIZED_REF}"
# Check if the container is already running
if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
echo "⚠️ A running container (${CONTAINER_NAME}) was detected."
if [[ "$EXIT_IF_CONTAINER_RUNNING" -eq 1 ]]; then
echo "❌ EXIT_IF_CONTAINER_RUNNING is set. Exiting."
exit 1
else
echo "🛑 Stopping the running container: ${CONTAINER_NAME}"
docker stop "${CONTAINER_NAME}"
fi
fi
echo "-- BUILD CORES: $BUILD_CORES" echo "-- BUILD CORES: $BUILD_CORES"
echo "-- GITHUB_REPOSITORY: $GITHUB_REPOSITORY" echo "-- GITHUB_REPOSITORY: $GITHUB_REPOSITORY"
@@ -84,8 +62,6 @@ else
# GH Action, runner # GH Action, runner
echo "GH Action, runner, clean & re-create create persistent container" echo "GH Action, runner, clean & re-create create persistent container"
docker rm -f $CONTAINER_NAME docker rm -f $CONTAINER_NAME
echo "echo 'Stopping container: $CONTAINER_NAME'" >> "$JOB_CLEANUP_SCRIPT"
echo "docker stop --time=15 \"$CONTAINER_NAME\" || echo 'Failed to stop container or container not running'" >> "$JOB_CLEANUP_SCRIPT"
docker run -di --user 0:$(id -g) --name $CONTAINER_NAME -v /data/builds:/data/builds -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash docker run -di --user 0:$(id -g) --name $CONTAINER_NAME -v /data/builds:/data/builds -v `pwd`:/io --network host ghcr.io/foobarwidget/holy-build-box-x64 /hbb_exe/activate-exec bash
docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -x /io/build-full.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER" docker exec -i $CONTAINER_NAME /hbb_exe/activate-exec bash -x /io/build-full.sh "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$BUILD_CORES" "$GITHUB_RUN_NUMBER"
docker stop $CONTAINER_NAME docker stop $CONTAINER_NAME

View File

@@ -464,9 +464,11 @@ public:
{ {
if (!defsHash) if (!defsHash)
{ {
static const uint256 fallbackHash( // should be unreachable
// if this does happen we don't want 0 xor 0 so use a random value
// here
return uint256(
"DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA0"); "DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA0");
return fallbackHash;
} }
return *defsHash; return *defsHash;
} }