mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 10:45:50 +00:00
Merge branch 'tmp-conan' into sync-1.12.0-conan
This commit is contained in:
72
.github/workflows/build-in-docker.yml
vendored
72
.github/workflows/build-in-docker.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Release - SH Runner
|
||||
name: Build using Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -11,38 +11,53 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DEBUG_CONTAINERS: 1
|
||||
REMOVE_CONTAINERS: 0
|
||||
DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP: 1
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
checkout:
|
||||
runs-on: [self-hosted, vanity]
|
||||
outputs:
|
||||
checkout_path: ${{ steps.vars.outputs.checkout_path }}
|
||||
steps:
|
||||
- name: Prepare workspace
|
||||
- name: Prepare checkout path
|
||||
id: vars
|
||||
run: |
|
||||
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_ENV
|
||||
mkdir -p "$CHECKOUT_PATH"
|
||||
echo "checkout_path=${CHECKOUT_PATH}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: ${{ env.CHECKOUT_PATH }}
|
||||
path: ${{ steps.vars.outputs.checkout_path }}
|
||||
clean: true
|
||||
fetch-depth: 2
|
||||
fetch-depth: 2 # Only get the last 2 commits, to avoid fetching all history
|
||||
|
||||
checkpatterns:
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: checkout
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ needs.checkout.outputs.checkout_path }}
|
||||
steps:
|
||||
- name: Check for suspicious patterns
|
||||
run: /bin/bash suspicious_patterns.sh
|
||||
|
||||
build:
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: [checkpatterns, checkout]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ needs.checkout.outputs.checkout_path }}
|
||||
steps:
|
||||
- name: Set Cleanup Script Path
|
||||
run: |
|
||||
echo "JOB_CLEANUP_SCRIPT=$(mktemp)" >> $GITHUB_ENV
|
||||
|
||||
- name: Build using Docker
|
||||
working-directory: ${{ env.CHECKOUT_PATH }}
|
||||
run: /bin/bash release-builder.sh
|
||||
|
||||
- name: Stop Container (Cleanup after build)
|
||||
- name: Stop Container (Cleanup)
|
||||
if: always()
|
||||
working-directory: ${{ env.CHECKOUT_PATH }}
|
||||
run: |
|
||||
echo "Running cleanup script: $JOB_CLEANUP_SCRIPT"
|
||||
/bin/bash -e -x "$JOB_CLEANUP_SCRIPT"
|
||||
@@ -56,30 +71,35 @@ jobs:
|
||||
echo "⚠️ Cleanup script failed! Keeping for debugging: $JOB_CLEANUP_SCRIPT"
|
||||
fi
|
||||
|
||||
if [[ "${DEBUG_CONTAINERS}" == "1" ]]; then
|
||||
if [[ "${DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP}" == "1" ]]; then
|
||||
echo "🔍 Checking for leftover containers..."
|
||||
BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "")
|
||||
CONTAINER_NAME="xahaud_cached_builder_${{ github.workflow }}-${{ github.ref_name }}"
|
||||
if [[ -n "$BUILD_CONTAINERS" && "${REMOVE_CONTAINERS}" == "1" ]]; then
|
||||
|
||||
if [[ -n "$BUILD_CONTAINERS" ]]; then
|
||||
echo "⚠️ WARNING: Some build containers are still running"
|
||||
echo "$BUILD_CONTAINERS"
|
||||
echo "Attempting to stop build containers.."
|
||||
echo "Stopping container: $CONTAINER_NAME"
|
||||
docker stop "$CONTAINER_NAME" || echo "Failed to stop container: $CONTAINER_NAME"
|
||||
echo "Removing container: $CONTAINER_NAME"
|
||||
docker rm -f "$CONTAINER_NAME" || echo "Failed to remove container: $CONTAINER_NAME"
|
||||
echo "✅ Build container stopped and removed"
|
||||
else
|
||||
echo "✅ No build containers found"
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Run unit tests
|
||||
working-directory: ${{ env.CHECKOUT_PATH }}
|
||||
tests:
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: [build, checkout]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ needs.checkout.outputs.checkout_path }}
|
||||
steps:
|
||||
- name: Unit tests
|
||||
run: /bin/bash docker-unit-tests.sh
|
||||
|
||||
cleanup:
|
||||
runs-on: [self-hosted, vanity]
|
||||
needs: [tests, checkout]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Cleanup workspace
|
||||
if: always()
|
||||
run: |
|
||||
CHECKOUT_PATH="${{ needs.checkout.outputs.checkout_path }}"
|
||||
echo "Cleaning workspace for ${CHECKOUT_PATH}"
|
||||
rm -rf "${{ github.workspace }}/${CHECKOUT_PATH}"
|
||||
|
||||
@@ -504,7 +504,6 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
}),
|
||||
features,
|
||||
};
|
||||
|
||||
prepareLedgerData(env1, 5);
|
||||
|
||||
// Create catalogue with network ID 123
|
||||
@@ -552,7 +551,6 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
using namespace test::jtx;
|
||||
|
||||
// Create environment and test data
|
||||
|
||||
Env env{
|
||||
*this,
|
||||
envconfig(),
|
||||
@@ -560,7 +558,6 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
nullptr,
|
||||
beast::severities::kDisabled,
|
||||
};
|
||||
|
||||
prepareLedgerData(env, 3);
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
@@ -658,7 +655,6 @@ class Catalogue_test : public beast::unit_test::suite
|
||||
nullptr,
|
||||
beast::severities::kDisabled,
|
||||
};
|
||||
|
||||
prepareLedgerData(env, 3);
|
||||
|
||||
boost::filesystem::path tempDir =
|
||||
|
||||
@@ -8,13 +8,18 @@ files_changed=$(git diff --name-only --relative HEAD~1 HEAD)
|
||||
|
||||
# Loop through each file and search for the patterns
|
||||
for file in $files_changed; do
|
||||
# Skip if the file is Import_test.cpp (exact filename match regardless of path)
|
||||
if [[ "$(basename "$file")" == "Import_test.cpp" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Construct the absolute path
|
||||
absolute_path="$repo_root/$file"
|
||||
|
||||
# Check if the file exists (it might have been deleted)
|
||||
if [ -f "$absolute_path" ]; then
|
||||
# Search the file for the given patterns
|
||||
grep_output=$(grep -n -E '(([^rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz]|^)(s|p)[rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz]{25,60}([^(]|$)))|([^A-Fa-f0-9](02|03|ED)[A-Fa-f0-9]{64})' "$absolute_path")
|
||||
# Search the file for the given patterns, but exclude lines containing 'public_key'
|
||||
grep_output=$(grep -n -E '(([^rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz]|^)(s|p)[rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz]{25,60}([^(]|$)))|([^A-Fa-f0-9](02|03|ED)[A-Fa-f0-9]{64})' "$absolute_path" | grep -v "public_key")
|
||||
|
||||
# Check if grep found any matches
|
||||
if [ ! -z "$grep_output" ]; then
|
||||
@@ -25,7 +30,3 @@ for file in $files_changed; do
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# If the loop completes without finding any suspicious patterns
|
||||
echo "Success: No suspicious patterns found in the diff."
|
||||
exit 0
|
||||
Reference in New Issue
Block a user