Merge pull request #4248 from pwojcikdev/ci-overhaul-rebased
Improvements to CI pipeline
This commit is contained in:
commit
d33803e0a3
23 changed files with 378 additions and 73 deletions
97
.github/workflows/unit_tests.yml
vendored
97
.github/workflows/unit_tests.yml
vendored
|
@ -2,10 +2,6 @@ name: Unit Tests
|
|||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
RELEASE: 0
|
||||
artifact: 0
|
||||
|
||||
jobs:
|
||||
macos_test:
|
||||
name: macOS [${{ matrix.BACKEND }}]
|
||||
|
@ -17,8 +13,9 @@ jobs:
|
|||
- ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
env:
|
||||
BACKEND: ${{ matrix.BACKEND }}
|
||||
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
|
||||
RELEASE: ${{ matrix.RELEASE }}
|
||||
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
|
||||
DEADLINE_SCALE_FACTOR: ${{ matrix.BACKEND == 'rocksdb' && '2' || '1' }}
|
||||
runs-on: macos-12
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||||
steps:
|
||||
|
@ -26,7 +23,7 @@ jobs:
|
|||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
fetch-depth: 0 # full history needed for restoring file timestamps
|
||||
fetch-depth: 0 # Full history needed for restoring file timestamps
|
||||
|
||||
- name: Restore Timestamps
|
||||
uses: ./.github/actions/restore-git-mtimes
|
||||
|
@ -39,14 +36,15 @@ jobs:
|
|||
path: build
|
||||
key: ${{ runner.os }}-build-cache
|
||||
|
||||
- name: Fetch Deps
|
||||
run: TEST=1 ci/actions/osx/install_deps.sh
|
||||
- name: Prepare
|
||||
run: ci/prepare/macos/prepare.sh
|
||||
|
||||
- name: Build Tests
|
||||
run: ci/build-ci.sh "/tmp/qt/lib/cmake/Qt5";
|
||||
id: build
|
||||
run: ci/build-tests.sh
|
||||
|
||||
- name: Save Build Cache
|
||||
# only save build cache from develop to avoid polluting it by other branches / PRs
|
||||
# Only save build cache from develop to avoid polluting it by other branches / PRs
|
||||
if: github.ref == 'refs/heads/develop' && success()
|
||||
uses: actions/cache/save@v3
|
||||
continue-on-error: true
|
||||
|
@ -54,10 +52,17 @@ jobs:
|
|||
path: build
|
||||
key: ${{ runner.os }}-build-cache
|
||||
|
||||
- name: Run Tests
|
||||
run: cd build && sudo TEST_USE_ROCKSDB=$TEST_USE_ROCKSDB ../ci/test.sh .
|
||||
env:
|
||||
DEADLINE_SCALE_FACTOR: ${{ env.TEST_USE_ROCKSDB == 1 && '2' || '1' }}
|
||||
- name: Core Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-core-tests.sh
|
||||
|
||||
- name: RPC Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-rpc-tests.sh
|
||||
|
||||
- name: System Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-system-tests.sh
|
||||
|
||||
linux_test:
|
||||
name: Linux [${{ matrix.BACKEND }} | ${{ matrix.COMPILER }}]
|
||||
|
@ -73,15 +78,16 @@ jobs:
|
|||
env:
|
||||
COMPILER: ${{ matrix.COMPILER }}
|
||||
BACKEND: ${{ matrix.BACKEND }}
|
||||
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
|
||||
RELEASE: ${{ matrix.RELEASE }}
|
||||
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
|
||||
DEADLINE_SCALE_FACTOR: ${{ matrix.BACKEND == 'rocksdb' && '2' || '1' }}
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
fetch-depth: 0 # full history needed for restoring file timestamps
|
||||
fetch-depth: 0 # Full history needed for restoring file timestamps
|
||||
|
||||
- name: Restore Timestamps
|
||||
uses: ./.github/actions/restore-git-mtimes
|
||||
|
@ -94,14 +100,15 @@ jobs:
|
|||
path: build
|
||||
key: ${{ runner.os }}-${{ env.COMPILER }}-build-cache
|
||||
|
||||
- name: Fetch Deps
|
||||
run: ci/actions/linux/install_deps.sh
|
||||
- name: Prepare
|
||||
run: sudo -E ci/prepare/linux/prepare.sh
|
||||
|
||||
- name: Build Tests
|
||||
run: docker run -e TEST_USE_ROCKSDB -e RELEASE -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cd /workspace && ./ci/build-ci.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5"
|
||||
id: build
|
||||
run: ci/build-tests.sh
|
||||
|
||||
- name: Save Build Cache
|
||||
# only save build cache from develop to avoid polluting it by other branches / PRs
|
||||
# Only save build cache from develop to avoid polluting it by other branches / PRs
|
||||
if: github.ref == 'refs/heads/develop' && success()
|
||||
uses: actions/cache/save@v3
|
||||
continue-on-error: true
|
||||
|
@ -109,10 +116,21 @@ jobs:
|
|||
path: build
|
||||
key: ${{ runner.os }}-${{ env.COMPILER }}-build-cache
|
||||
|
||||
- name: Run Tests
|
||||
run: docker run -e RELEASE -e TEST_USE_ROCKSDB -e DEADLINE_SCALE_FACTOR -v ${PWD}:/workspace nanocurrency/nano-env:${{ matrix.COMPILER }} /bin/bash -c "cd /workspace/build && ../ci/test.sh ."
|
||||
env:
|
||||
DEADLINE_SCALE_FACTOR: ${{ env.TEST_USE_ROCKSDB == 1 && '2' || '1' }}
|
||||
- name: Core Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-core-tests.sh
|
||||
|
||||
- name: RPC Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-rpc-tests.sh
|
||||
|
||||
- name: System Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-system-tests.sh
|
||||
|
||||
- name: QT Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-qt-tests.sh
|
||||
|
||||
windows_test:
|
||||
name: Windows [${{ matrix.BACKEND }}]
|
||||
|
@ -126,8 +144,8 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
env:
|
||||
BACKEND: ${{ matrix.BACKEND }}
|
||||
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
|
||||
RELEASE: ${{ matrix.RELEASE }}
|
||||
TEST_USE_ROCKSDB: ${{ matrix.BACKEND == 'rocksdb' && '1' || '0' }}
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -147,14 +165,13 @@ jobs:
|
|||
path: build
|
||||
key: ${{ runner.os }}-build-cache
|
||||
|
||||
- name: Windows Defender
|
||||
run: ci/actions/windows/disable_windows_defender.ps1
|
||||
|
||||
- name: Fetch Deps
|
||||
run: ci/actions/windows/install_deps.ps1
|
||||
- name: Prepare
|
||||
run: ci/prepare/windows/prepare.ps1
|
||||
|
||||
- name: Build Tests
|
||||
run: ci/actions/windows/build.ps1
|
||||
id: build
|
||||
run: ci/build-tests.sh
|
||||
shell: bash
|
||||
|
||||
- name: Save Build Cache
|
||||
# only save build cache from develop to avoid polluting it by other branches / PRs
|
||||
|
@ -165,7 +182,17 @@ jobs:
|
|||
path: build
|
||||
key: ${{ runner.os }}-build-cache
|
||||
|
||||
- name: Run Tests [TEST_USE_ROCKSDB=${{ env.TEST_USE_ROCKSDB }}]
|
||||
run: ci/actions/windows/run.ps1
|
||||
env:
|
||||
DEADLINE_SCALE_FACTOR: ${{ env.TEST_USE_ROCKSDB == 1 && '2' || '1' }}
|
||||
- name: Core Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-core-tests.sh
|
||||
shell: bash
|
||||
|
||||
- name: RPC Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-rpc-tests.sh
|
||||
shell: bash
|
||||
|
||||
- name: System Tests
|
||||
if: steps.build.outcome == 'success' && (success() || failure())
|
||||
run: cd build && ../ci/tests/run-system-tests.sh
|
||||
shell: bash
|
|
@ -34,10 +34,6 @@ if(COVERAGE)
|
|||
include(CoverageTest)
|
||||
endif()
|
||||
|
||||
set(CI_TEST
|
||||
0
|
||||
CACHE STRING "")
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/MP)
|
||||
endif()
|
||||
|
@ -67,6 +63,8 @@ endif()
|
|||
|
||||
# Create all libraries and executables in the root binary dir
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
|
||||
|
||||
set(NANO_GUI
|
||||
OFF
|
||||
|
@ -658,6 +656,12 @@ add_subdirectory(nano/nano_node)
|
|||
add_subdirectory(nano/rpc)
|
||||
add_subdirectory(nano/nano_rpc)
|
||||
|
||||
add_custom_target(
|
||||
executables
|
||||
COMMAND echo "BATCH BUILDING node + rpc"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
DEPENDS nano_node nano_rpc)
|
||||
|
||||
if(NANO_FUZZER_TEST)
|
||||
if(NOT WIN32)
|
||||
add_subdirectory(nano/fuzzer_test)
|
||||
|
@ -696,15 +700,10 @@ if(NANO_TEST OR RAIBLOCKS_TEST)
|
|||
add_subdirectory(nano/rpc_test)
|
||||
add_subdirectory(nano/slow_test)
|
||||
add_custom_target(
|
||||
build_tests
|
||||
all_tests
|
||||
COMMAND echo "BATCH BUILDING TESTS"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
DEPENDS core_test load_test rpc_test nano_node nano_rpc)
|
||||
add_custom_target(
|
||||
run_tests
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/ci/test.sh ${CMAKE_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
DEPENDS build_tests)
|
||||
DEPENDS core_test load_test rpc_test slow_test nano_node nano_rpc)
|
||||
endif()
|
||||
|
||||
if(NANO_TEST OR RAIBLOCKS_TEST)
|
||||
|
@ -809,7 +808,7 @@ if(NANO_GUI OR RAIBLOCKS_GUI)
|
|||
set_target_properties(
|
||||
qt_test PROPERTIES COMPILE_FLAGS
|
||||
"-DQT_NO_KEYWORDS -DBOOST_ASIO_HAS_STD_ARRAY=1")
|
||||
add_dependencies(build_tests qt_test)
|
||||
add_dependencies(all_tests qt_test)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
|
|
|
@ -31,7 +31,6 @@ else {
|
|||
}
|
||||
$env:NETWORK_CFG = "dev"
|
||||
$env:NANO_TEST = "-DNANO_TEST=ON"
|
||||
$env:CI = '-DCI_TEST="1"'
|
||||
$env:RUN = "test"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
qt_dir=${1}
|
||||
build_target=${2:-all}
|
||||
|
@ -47,7 +48,6 @@ cmake \
|
|||
-DNANO_WARN_TO_ERR=ON \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
|
||||
-DQt5_DIR=${qt_dir} \
|
||||
-DCI_TEST="1" \
|
||||
${BACKTRACE:-} \
|
||||
${SANITIZERS:-} \
|
||||
..
|
||||
|
|
4
ci/build-node.sh
Executable file
4
ci/build-node.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
set -euox pipefail
|
||||
|
||||
$(dirname "$BASH_SOURCE")/build.sh executables
|
13
ci/build-tests.sh
Executable file
13
ci/build-tests.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -euox pipefail
|
||||
|
||||
BUILD_TYPE="Debug"
|
||||
if [[ "${RELEASE:-false}" == "true" ]]; then
|
||||
BUILD_TYPE="RelWithDebInfo"
|
||||
fi
|
||||
|
||||
BUILD_TYPE=$BUILD_TYPE \
|
||||
NANO_TEST=ON \
|
||||
NANO_NETWORK=dev \
|
||||
NANO_GUI=ON \
|
||||
$(dirname "$BASH_SOURCE")/build.sh all_tests
|
93
ci/build.sh
Executable file
93
ci/build.sh
Executable file
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
set -euox pipefail
|
||||
|
||||
BUILD_TARGET=""
|
||||
if [[ ${1:-} ]]; then
|
||||
BUILD_TARGET="--target $1"
|
||||
fi
|
||||
|
||||
SRC=${SRC:-${PWD}}
|
||||
OS=$(uname)
|
||||
|
||||
CMAKE_BACKTRACE=""
|
||||
if [[ "$OS" == 'Linux' ]]; then
|
||||
CMAKE_BACKTRACE="-DNANO_STACKTRACE_BACKTRACE=ON"
|
||||
|
||||
if [[ "$COMPILER" == 'clang' ]]; then
|
||||
CMAKE_BACKTRACE="${CMAKE_BACKTRACE} -DNANO_BACKTRACE_INCLUDE=</tmp/backtrace.h>"
|
||||
fi
|
||||
fi
|
||||
|
||||
CMAKE_QT_DIR=""
|
||||
if [[ ${QT_DIR:-} ]]; then
|
||||
CMAKE_QT_DIR="-DQt5_DIR=${QT_DIR}"
|
||||
fi
|
||||
|
||||
CMAKE_SANITIZER=""
|
||||
if [[ ${SANITIZER:-} ]]; then
|
||||
case "${SANITIZER}" in
|
||||
ASAN)
|
||||
CMAKE_SANITIZER="-DNANO_ASAN=ON"
|
||||
;;
|
||||
ASAN_INT)
|
||||
CMAKE_SANITIZER="-DNANO_ASAN_INT=ON"
|
||||
;;
|
||||
TSAN)
|
||||
CMAKE_SANITIZER="-DNANO_TSAN=ON"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown sanitizer: '${SANITIZER}'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
BUILD_DIR="build"
|
||||
|
||||
mkdir -p $BUILD_DIR
|
||||
pushd $BUILD_DIR
|
||||
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-"Debug"} \
|
||||
-DPORTABLE=ON \
|
||||
-DACTIVE_NETWORK=nano_${NANO_NETWORK:-"live"}_network \
|
||||
-DNANO_TEST=${NANO_TEST:-OFF} \
|
||||
-DNANO_GUI=${NANO_GUI:-OFF} \
|
||||
-DCOVERAGE=${COVERAGE:-OFF} \
|
||||
${CMAKE_SANITIZER:-} \
|
||||
${CMAKE_QT_DIR:-} \
|
||||
${CMAKE_BACKTRACE:-} \
|
||||
${SRC}
|
||||
|
||||
number_of_processors() {
|
||||
case "$(uname -s)" in
|
||||
Linux*)
|
||||
nproc
|
||||
;;
|
||||
Darwin*)
|
||||
sysctl -n hw.ncpu
|
||||
;;
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
echo "${NUMBER_OF_PROCESSORS}"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown OS"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
parallel_build_flag() {
|
||||
case "$(uname -s)" in
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
echo "-- -m"
|
||||
;;
|
||||
*)
|
||||
echo "--parallel $(number_of_processors)"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cmake --build ${PWD} ${BUILD_TARGET} $(parallel_build_flag)
|
||||
|
||||
popd
|
17
ci/prepare/linux/prepare-clang.sh
Executable file
17
ci/prepare/linux/prepare-clang.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
apt-get update -qq && apt-get install -yqq \
|
||||
clang \
|
||||
lldb
|
||||
|
||||
export CXX=/usr/bin/clang++
|
||||
export CC=/usr/bin/clang
|
||||
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
|
||||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
|
||||
|
||||
# workaround to get a path that can be easily passed into cmake for
|
||||
# BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE
|
||||
# see https://www.boost.org/doc/libs/1_70_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3
|
||||
|
||||
backtrace_file=$(find /usr/lib/gcc/ -name 'backtrace.h' | head -n 1) && test -f $backtrace_file && ln -s $backtrace_file /tmp/backtrace.h
|
2
ci/prepare/linux/prepare-gcc.sh
Executable file
2
ci/prepare/linux/prepare-gcc.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
27
ci/prepare/linux/prepare.sh
Executable file
27
ci/prepare/linux/prepare.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -euox pipefail
|
||||
|
||||
COMPILER=${COMPILER:-gcc}
|
||||
|
||||
echo "Compiler: '${COMPILER}'"
|
||||
|
||||
# Common dependencies needed for building & testing
|
||||
apt-get update -qq
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -yqq \
|
||||
build-essential \
|
||||
g++ \
|
||||
wget \
|
||||
python3 \
|
||||
zlib1g-dev \
|
||||
cmake \
|
||||
git \
|
||||
qtbase5-dev \
|
||||
qtchooser \
|
||||
qt5-qmake \
|
||||
qtbase5-dev-tools \
|
||||
valgrind \
|
||||
xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
|
||||
|
||||
# Compiler specific setup
|
||||
$(dirname "$BASH_SOURCE")/prepare-${COMPILER}.sh
|
11
ci/prepare/macos/prepare.sh
Executable file
11
ci/prepare/macos/prepare.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -euox pipefail
|
||||
|
||||
brew update
|
||||
brew install coreutils
|
||||
|
||||
brew install qt@5
|
||||
brew link qt@5
|
||||
|
||||
# Workaround: https://github.com/Homebrew/homebrew-core/issues/8392
|
||||
echo "$(brew --prefix qt5)/bin" >> $GITHUB_PATH
|
5
ci/prepare/windows/disable-defender.ps1
Normal file
5
ci/prepare/windows/disable-defender.ps1
Normal file
|
@ -0,0 +1,5 @@
|
|||
$ErrorActionPreference = "Continue"
|
||||
|
||||
Set-MpPreference -DisableArchiveScanning $true
|
||||
Set-MpPreference -DisableRealtimeMonitoring $true
|
||||
Set-MpPreference -DisableBehaviorMonitoring $true
|
45
ci/prepare/windows/install-qt.ps1
Normal file
45
ci/prepare/windows/install-qt.ps1
Normal file
|
@ -0,0 +1,45 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Download and extract Qt library.
|
||||
# Original files can be found at: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/
|
||||
|
||||
# Define URLs, file names and their corresponding SHA1 hashes
|
||||
$toDownload = @(
|
||||
@{
|
||||
Url = 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z';
|
||||
FileName = 'qt5base.7z';
|
||||
SHA1 = 'e29464430a2225bce6ce96b4ed18eec3f8b944d6';
|
||||
},
|
||||
@{
|
||||
Url = 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qtwinextras-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z';
|
||||
FileName = 'qt5winextra.7z';
|
||||
SHA1 = '70da33b18ddeac4dd00ceed205f8110c426cea16';
|
||||
}
|
||||
)
|
||||
|
||||
$targetFolder = "C:\Qt"
|
||||
|
||||
# Download and process files
|
||||
foreach ($entry in $toDownload) {
|
||||
$tempFile = Join-Path $env:TEMP $entry.FileName
|
||||
|
||||
# Download file
|
||||
Invoke-WebRequest -Uri $entry.Url -OutFile $tempFile
|
||||
|
||||
# Calculate file hash
|
||||
$fileHash = (Get-FileHash -Path $tempFile -Algorithm SHA1).Hash
|
||||
|
||||
# Compare hashes
|
||||
if ($fileHash -eq $entry.SHA1) {
|
||||
Write-Host "Hashes match for $($entry.FileName)."
|
||||
} else {
|
||||
Write-Error "Hashes do not match for $($entry.FileName). Stopping script execution."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Decompress archive
|
||||
7z x $tempFile -o"$targetFolder" -aoa
|
||||
}
|
||||
|
||||
# Save install location for subsequent steps
|
||||
"QT_DIR=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5" >> $env:GITHUB_ENV
|
4
ci/prepare/windows/prepare.ps1
Normal file
4
ci/prepare/windows/prepare.ps1
Normal file
|
@ -0,0 +1,4 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
& "$PSScriptRoot\disable-defender.ps1"
|
||||
& "$PSScriptRoot\install-qt.ps1"
|
16
ci/tests/common.sh
Normal file
16
ci/tests/common.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
get_exec_extension() {
|
||||
case "$(uname -s)" in
|
||||
Linux*|Darwin*)
|
||||
echo ""
|
||||
;;
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
echo ".exe"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown OS"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
8
ci/tests/run-core-tests.sh
Executable file
8
ci/tests/run-core-tests.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/common.sh"
|
||||
|
||||
BUILD_DIR=${1-${PWD}}
|
||||
|
||||
${BUILD_DIR}/core_test$(get_exec_extension)
|
23
ci/tests/run-qt-tests.sh
Executable file
23
ci/tests/run-qt-tests.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/common.sh"
|
||||
|
||||
BUILD_DIR=${1-${PWD}}
|
||||
|
||||
# Alpine doesn't offer an xvfb
|
||||
xvfb_run_()
|
||||
{
|
||||
INIT_DELAY_SEC=3
|
||||
|
||||
Xvfb :2 -screen 0 1024x768x24 &
|
||||
xvfb_pid=$!
|
||||
sleep ${INIT_DELAY_SEC}
|
||||
DISPLAY=:2 $@
|
||||
res=${?}
|
||||
kill ${xvfb_pid}
|
||||
|
||||
return ${res}
|
||||
}
|
||||
|
||||
xvfb_run_ ${BUILD_DIR}/qt_test$(get_exec_extension)
|
8
ci/tests/run-rpc-tests.sh
Executable file
8
ci/tests/run-rpc-tests.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/common.sh"
|
||||
|
||||
BUILD_DIR=${1-${PWD}}
|
||||
|
||||
${BUILD_DIR}/rpc_test$(get_exec_extension)
|
9
ci/tests/run-system-tests.sh
Executable file
9
ci/tests/run-system-tests.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/common.sh"
|
||||
|
||||
BUILD_DIR=${1-${PWD}}
|
||||
|
||||
export NANO_NODE_EXE=${BUILD_DIR}/nano_node$(get_exec_extension)
|
||||
cd ../systest && ./RUNALL
|
|
@ -1,37 +1,32 @@
|
|||
ARG ENV_REPOSITORY=nanocurrency/nano-env
|
||||
ARG COMPILER=gcc
|
||||
FROM ${ENV_REPOSITORY}:${COMPILER}
|
||||
FROM ubuntu:22.04 as builder
|
||||
|
||||
ARG NETWORK=live
|
||||
ARG COMPILER=gcc
|
||||
ARG NANO_NETWORK=live
|
||||
ARG CI_TAG=DEV_BUILD
|
||||
ARG CI_BUILD=OFF
|
||||
ARG CI_VERSION_PRE_RELEASE=OFF
|
||||
ADD ./ /tmp/src
|
||||
|
||||
WORKDIR /tmp/build
|
||||
# Install build dependencies
|
||||
COPY ./ci/prepare/linux /tmp/prepare
|
||||
RUN /tmp/prepare/prepare.sh
|
||||
|
||||
RUN \
|
||||
cmake /tmp/src \
|
||||
-DCI_BUILD=${CI_BUILD} \
|
||||
-DCI_VERSION_PRE_RELEASE=${CI_VERSION_PRE_RELEASE} \
|
||||
-DPORTABLE=1 \
|
||||
-DACTIVE_NETWORK=nano_${NETWORK}_network
|
||||
COPY ./ /tmp/src
|
||||
WORKDIR /tmp/src
|
||||
|
||||
RUN \
|
||||
make nano_node -j $(nproc) && \
|
||||
make nano_rpc -j $(nproc) && \
|
||||
cd .. && \
|
||||
echo ${NETWORK} >/etc/nano-network
|
||||
# Build node
|
||||
RUN ci/build-node.sh
|
||||
RUN echo ${NANO_NETWORK} >/etc/nano-network
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
RUN groupadd --gid 1000 nanocurrency && \
|
||||
useradd --uid 1000 --gid nanocurrency --shell /bin/bash --create-home nanocurrency
|
||||
|
||||
COPY --from=0 /tmp/build/nano_node /usr/bin
|
||||
COPY --from=0 /tmp/build/nano_rpc /usr/bin
|
||||
COPY --from=0 /tmp/src/api/ /usr/bin/api/
|
||||
COPY --from=0 /etc/nano-network /etc
|
||||
COPY --from=builder /tmp/src/build/nano_node /usr/bin
|
||||
COPY --from=builder /tmp/src/build/nano_rpc /usr/bin
|
||||
COPY --from=builder /tmp/src/api/ /usr/bin/api/
|
||||
COPY --from=builder /etc/nano-network /etc
|
||||
|
||||
COPY docker/node/entry.sh /usr/bin/entry.sh
|
||||
COPY docker/node/config /usr/share/nano/config
|
||||
RUN chmod +x /usr/bin/entry.sh
|
||||
|
@ -44,5 +39,6 @@ USER root
|
|||
ENV PATH="${PATH}:/usr/bin"
|
||||
ENTRYPOINT ["/usr/bin/entry.sh"]
|
||||
CMD ["nano_node", "daemon", "-l"]
|
||||
|
||||
ARG REPOSITORY=nanocurrency/nano-node
|
||||
LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
|
||||
|
|
|
@ -61,7 +61,7 @@ add_executable(
|
|||
|
||||
target_compile_definitions(
|
||||
core_test PRIVATE -DTAG_VERSION_STRING=${TAG_VERSION_STRING}
|
||||
-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH} -DCI=${CI_TEST})
|
||||
-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH})
|
||||
|
||||
target_link_libraries(
|
||||
core_test
|
||||
|
|
|
@ -1014,7 +1014,7 @@ TEST (network, tcp_message_manager)
|
|||
|
||||
// This should give sufficient time to execute put_message
|
||||
// and prove that it waits on condition variable
|
||||
std::this_thread::sleep_for (CI ? 200ms : 100ms);
|
||||
std::this_thread::sleep_for (200ms);
|
||||
|
||||
ASSERT_EQ (manager.entries.size (), manager.max_entries);
|
||||
ASSERT_EQ (manager.get_message ().node_id, item.node_id);
|
||||
|
|
|
@ -124,5 +124,4 @@ target_compile_definitions(
|
|||
-DMINOR_VERSION_STRING=${CPACK_PACKAGE_VERSION_MINOR}
|
||||
-DPATCH_VERSION_STRING=${CPACK_PACKAGE_VERSION_PATCH}
|
||||
-DPRE_RELEASE_VERSION_STRING=${CPACK_PACKAGE_VERSION_PRE_RELEASE}
|
||||
-DCI=${CI_TEST}
|
||||
PUBLIC -DACTIVE_NETWORK=${ACTIVE_NETWORK})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue