Skip to content

Commit

Permalink
Squashed changes from cmake-staging branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed May 21, 2024
1 parent ecd2365 commit bca48b1
Show file tree
Hide file tree
Showing 156 changed files with 6,099 additions and 2,369 deletions.
150 changes: 47 additions & 103 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ jobs:

env:
CCACHE_MAXSIZE: '200M'
CI_CCACHE_VERSION: '4.7.5'
CI_QT_CONF: '-release -silent -opensource -confirm-license -opengl desktop -static -static-runtime -mp -qt-zlib -qt-pcre -qt-libpng -nomake examples -nomake tests -nomake tools -no-angle -no-dbus -no-gif -no-gtk -no-ico -no-icu -no-libjpeg -no-libudev -no-sql-sqlite -no-sql-odbc -no-sqlite -no-vulkan -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip doc -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -no-openssl -no-feature-bearermanagement -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sql -no-feature-sqlmodel -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-xml'
CI_QT_DIR: 'qt-everywhere-src-5.15.11'
CI_QT_URL: 'https://download.qt.io/official_releases/qt/5.15/5.15.11/single/qt-everywhere-opensource-src-5.15.11.zip'
PYTHONUTF8: 1
TEST_RUNNER_TIMEOUT_FACTOR: 40

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Remove non-MSVC tool installations
run: |
Remove-Item -Path "$env:ProgramFiles/CMake" -Recurse -Force
- name: Configure Developer Command Prompt for Microsoft Visual C++
# Using microsoft/setup-msbuild is not enough.
uses: ilammy/msvc-dev-cmd@v1
Expand All @@ -153,122 +153,67 @@ jobs:

- name: Get tool information
run: |
cmake --version | Out-File -FilePath "cmake_version"
Get-Content -Path "cmake_version"
Write-Output "---"
msbuild -version | Out-File -FilePath "$env:GITHUB_WORKSPACE\msbuild_version"
Get-Content -Path "$env:GITHUB_WORKSPACE\msbuild_version"
$env:VCToolsVersion | Out-File -FilePath "$env:GITHUB_WORKSPACE\toolset_version"
Write-Host "VCToolsVersion $(Get-Content -Path "$env:GITHUB_WORKSPACE\toolset_version")"
$env:CI_QT_URL | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_url"
$env:CI_QT_CONF | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_conf"
py -3 --version
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"
- name: Restore static Qt cache
id: static-qt-cache
uses: actions/cache/restore@v4
with:
path: C:\Qt_static
key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }}

- name: Build static Qt. Download
if: steps.static-qt-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
curl --location --output C:\qt-src.zip %CI_QT_URL%
choco install --yes --no-progress jom
- name: Build static Qt. Expand source archive
if: steps.static-qt-cache.outputs.cache-hit != 'true'
shell: cmd
run: tar -xf C:\qt-src.zip -C C:\

- name: Build static Qt. Create build directory
if: steps.static-qt-cache.outputs.cache-hit != 'true'
run: |
Rename-Item -Path "C:\$env:CI_QT_DIR" -NewName "C:\qt-src"
New-Item -ItemType Directory -Path "C:\qt-src\build"
- name: Build static Qt. Configure
if: steps.static-qt-cache.outputs.cache-hit != 'true'
working-directory: C:\qt-src\build
shell: cmd
run: ..\configure %CI_QT_CONF% -prefix C:\Qt_static

- name: Build static Qt. Build
if: steps.static-qt-cache.outputs.cache-hit != 'true'
working-directory: C:\qt-src\build
shell: cmd
run: jom

- name: Build static Qt. Install
if: steps.static-qt-cache.outputs.cache-hit != 'true'
working-directory: C:\qt-src\build
shell: cmd
run: jom install

- name: Save static Qt cache
if: steps.static-qt-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: C:\Qt_static
key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }}

- name: Ccache installation cache
id: ccache-installation-cache
uses: actions/cache@v4
with:
path: |
C:\ProgramData\chocolatey\lib\ccache
C:\ProgramData\chocolatey\bin\ccache.exe
C:\ccache\cl.exe
key: ${{ github.job }}-ccache-installation-${{ env.CI_CCACHE_VERSION }}

- name: Install Ccache
if: steps.ccache-installation-cache.outputs.cache-hit != 'true'
run: |
choco install --yes --no-progress ccache --version=$env:CI_CCACHE_VERSION
New-Item -ItemType Directory -Path "C:\ccache"
Copy-Item -Path "$env:ChocolateyInstall\lib\ccache\tools\ccache-$env:CI_CCACHE_VERSION-windows-x86_64\ccache.exe" -Destination "C:\ccache\cl.exe"
- name: Restore Ccache cache
id: ccache-cache
uses: actions/cache/restore@v4
with:
path: ~/AppData/Local/ccache
key: ${{ github.job }}-ccache-${{ github.run_id }}
restore-keys: ${{ github.job }}-ccache-
choco install --yes --no-progress ccache
- name: Using vcpkg with MSBuild
run: |
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $env:VCToolsVersion)"
.\vcpkg.exe --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install
git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit"
Get-Content -Path "$env:GITHUB_WORKSPACE\vcpkg_commit"
Add-Content -Path "triplets\x64-windows.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
Add-Content -Path "triplets\x64-windows.cmake" -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $env:VCToolsVersion)"
- name: vcpkg tools cache
uses: actions/cache@v4
with:
path: C:/vcpkg/downloads/tools
key: ${{ github.job }}-vcpkg-tools

- name: vcpkg binary cache
uses: actions/cache@v4
- name: Restore vcpkg binary cache
uses: actions/cache/restore@v4
id: vcpkg-binary-cache
with:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'toolset_version', 'build_msvc/vcpkg.json') }}
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

- name: Generate build system
run: |
cmake -B build --preset vs2022 -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DWERROR=ON
- name: Generate project files
run: py -3 build_msvc\msvc-autogen.py
- name: Save vcpkg binary cache
uses: actions/cache/save@v4
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true'
with:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

- name: Restore Ccache cache
id: ccache-cache
uses: actions/cache/restore@v4
with:
path: ~/AppData/Local/ccache
key: ${{ github.job }}-ccache-

- name: Build
shell: cmd
working-directory: build
run: |
ccache --zero-stats
msbuild build_msvc\bitcoin.sln -property:CLToolPath=C:\ccache;CLToolExe=cl.exe;UseMultiToolTask=true;Configuration=Release -maxCpuCount -verbosity:minimal -noLogo
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release
- name: Ccache stats
run: ccache --show-stats
run: |
ccache --version | head -n 1
ccache --show-stats --verbose
- name: Save Ccache cache
uses: actions/cache/save@v4
Expand All @@ -278,20 +223,18 @@ jobs:
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: ${{ github.job }}-ccache-${{ github.run_id }}

- name: Run unit tests
run: src\test_bitcoin.exe -l test_suite

- name: Run benchmarks
run: src\bench_bitcoin.exe -sanity-check

- name: Run util tests
run: py -3 test\util\test_runner.py

- name: Run rpcauth test
run: py -3 test\util\rpcauth-test.py
- name: Run test suite
working-directory: build
run: |
ctest -j $env:NUMBER_OF_PROCESSORS -C Release
- name: Run functional tests
working-directory: build
env:
BITCOIND: '${{ github.workspace }}\build\src\Release\bitcoind.exe'
BITCOINCLI: '${{ github.workspace }}\build\src\Release\bitcoin-cli.exe'
BITCOINUTIL: '${{ github.workspace }}\build\src\Release\bitcoin-util.exe'
BITCOINWALLET: '${{ github.workspace }}\build\src\Release\bitcoin-wallet.exe'
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
shell: cmd
run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA%
Expand All @@ -304,7 +247,8 @@ jobs:
git log -1
- name: Run fuzz binaries
working-directory: build
env:
BITCOINFUZZ: "${{ github.workspace}}\\src\\fuzz.exe"
BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe'
shell: cmd
run: py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_seed_corpus
Loading

0 comments on commit bca48b1

Please sign in to comment.