|
| 1 | +# Copyright (c) 2023 The Bitcoin Core developers |
| 2 | +# Distributed under the MIT software license, see the accompanying |
| 3 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php. |
| 4 | + |
| 5 | +name: CI |
| 6 | +on: |
| 7 | + # See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request. |
| 8 | + pull_request: |
| 9 | + # See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push. |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - '**' |
| 13 | + tags-ignore: |
| 14 | + - '**' |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.event_name != 'pull_request' && github.run_id || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +env: |
| 21 | + DANGER_RUN_CI_ON_HOST: 1 |
| 22 | + CI_FAILFAST_TEST_LEAVE_DANGLING: 1 # GHA does not care about dangling processes and setting this variable avoids killing the CI script itself on error |
| 23 | + MAKEJOBS: '-j10' |
| 24 | + |
| 25 | +jobs: |
| 26 | + macos-native-x86_64: |
| 27 | + name: 'macOS 13 native, x86_64, no depends, sqlite only, gui' |
| 28 | + # Use latest image, but hardcode version to avoid silent upgrades (and breaks). |
| 29 | + # See: https://github.com/actions/runner-images#available-images. |
| 30 | + runs-on: macos-13 # Use M1 once available https://github.com/github/roadmap/issues/528 |
| 31 | + |
| 32 | + # No need to run on the read-only mirror, unless it is a PR. |
| 33 | + if: github.repository != 'bitcoin-core/gui' || github.event_name == 'pull_request' |
| 34 | + |
| 35 | + timeout-minutes: 120 |
| 36 | + |
| 37 | + env: |
| 38 | + FILE_ENV: './ci/test/00_setup_env_mac_native.sh' |
| 39 | + BASE_ROOT_DIR: ${{ github.workspace }} |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v3 |
| 44 | + |
| 45 | + - name: Clang version |
| 46 | + run: clang --version |
| 47 | + |
| 48 | + - name: Install Homebrew packages |
| 49 | + run: brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt |
| 50 | + |
| 51 | + - name: Set Ccache directory |
| 52 | + run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV" |
| 53 | + |
| 54 | + - name: Restore Ccache cache |
| 55 | + uses: actions/cache/restore@v3 |
| 56 | + with: |
| 57 | + path: ${{ env.CCACHE_DIR }} |
| 58 | + key: ${{ github.job }}-ccache-${{ github.run_id }} |
| 59 | + restore-keys: ${{ github.job }}-ccache- |
| 60 | + |
| 61 | + - name: CI script |
| 62 | + run: ./ci/test_run_all.sh |
| 63 | + |
| 64 | + - name: Save Ccache cache |
| 65 | + uses: actions/cache/save@v3 |
| 66 | + if: github.event_name != 'pull_request' |
| 67 | + with: |
| 68 | + path: ${{ env.CCACHE_DIR }} |
| 69 | + # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache |
| 70 | + key: ${{ github.job }}-ccache-${{ github.run_id }} |
| 71 | + |
| 72 | + win64-native: |
| 73 | + name: 'Win64 native, VS 2022' |
| 74 | + # Use latest image, but hardcode version to avoid silent upgrades (and breaks). |
| 75 | + # See: https://github.com/actions/runner-images#available-images. |
| 76 | + runs-on: windows-2022 |
| 77 | + |
| 78 | + # No need to run on the read-only mirror, unless it is a PR. |
| 79 | + if: github.repository != 'bitcoin-core/gui' || github.event_name == 'pull_request' |
| 80 | + |
| 81 | + env: |
| 82 | + CCACHE_MAXSIZE: '200M' |
| 83 | + CI_CCACHE_VERSION: '4.7.5' |
| 84 | + 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' |
| 85 | + CI_QT_DIR: 'qt-everywhere-src-5.15.5' |
| 86 | + CI_QT_URL: 'https://download.qt.io/official_releases/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.zip' |
| 87 | + PYTHONUTF8: 1 |
| 88 | + TEST_RUNNER_TIMEOUT_FACTOR: 40 |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: Checkout |
| 92 | + uses: actions/checkout@v3 |
| 93 | + |
| 94 | + - name: Fix Visual Studio installation |
| 95 | + # See: https://github.com/actions/runner-images/issues/7832#issuecomment-1617585694. |
| 96 | + run: | |
| 97 | + Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" |
| 98 | + $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" |
| 99 | + $componentsToRemove= @( |
| 100 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ARM" |
| 101 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ARM.Spectre" |
| 102 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ARM64" |
| 103 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ARM64.Spectre" |
| 104 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.x86.x64" |
| 105 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.x86.x64.Spectre" |
| 106 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ATL" |
| 107 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ATL.Spectre" |
| 108 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ATL.ARM" |
| 109 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ATL.ARM.Spectre" |
| 110 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ATL.ARM64" |
| 111 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.ATL.ARM64.Spectre" |
| 112 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.MFC" |
| 113 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.MFC.Spectre" |
| 114 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.MFC.ARM" |
| 115 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.MFC.ARM.Spectre" |
| 116 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.MFC.ARM64" |
| 117 | + "Microsoft.VisualStudio.Component.VC.14.35.17.5.MFC.ARM64.Spectre" |
| 118 | + ) |
| 119 | + [string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_} |
| 120 | + $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') |
| 121 | + # should be run twice |
| 122 | + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden |
| 123 | + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden |
| 124 | +
|
| 125 | + - name: Configure Developer Command Prompt for Microsoft Visual C++ |
| 126 | + # Using microsoft/setup-msbuild is not enough. |
| 127 | + uses: ilammy/msvc-dev-cmd@v1 |
| 128 | + with: |
| 129 | + arch: x64 |
| 130 | + |
| 131 | + - name: Check MSBuild and Qt |
| 132 | + run: | |
| 133 | + msbuild -version | Out-File -FilePath "$env:GITHUB_WORKSPACE\msbuild_version" |
| 134 | + Get-Content -Path "$env:GITHUB_WORKSPACE\msbuild_version" |
| 135 | + $env:CI_QT_URL | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_url" |
| 136 | + $env:CI_QT_CONF | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_conf" |
| 137 | +
|
| 138 | + - name: Restore static Qt cache |
| 139 | + id: static-qt-cache |
| 140 | + uses: actions/cache/restore@v3 |
| 141 | + with: |
| 142 | + path: C:\Qt_static |
| 143 | + key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }} |
| 144 | + |
| 145 | + - name: Build static Qt. Download |
| 146 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 147 | + shell: cmd |
| 148 | + run: | |
| 149 | + curl --location --output C:\qt-src.zip %CI_QT_URL% |
| 150 | + choco install --yes --no-progress jom |
| 151 | +
|
| 152 | + - name: Build static Qt. Expand source archive |
| 153 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 154 | + shell: cmd |
| 155 | + run: tar -xf C:\qt-src.zip -C C:\ |
| 156 | + |
| 157 | + - name: Build static Qt. Create build directory |
| 158 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 159 | + run: | |
| 160 | + Rename-Item -Path "C:\$env:CI_QT_DIR" -NewName "C:\qt-src" |
| 161 | + New-Item -ItemType Directory -Path "C:\qt-src\build" |
| 162 | +
|
| 163 | + - name: Build static Qt. Configure |
| 164 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 165 | + working-directory: C:\qt-src\build |
| 166 | + shell: cmd |
| 167 | + run: ..\configure %CI_QT_CONF% -prefix C:\Qt_static |
| 168 | + |
| 169 | + - name: Build static Qt. Build |
| 170 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 171 | + working-directory: C:\qt-src\build |
| 172 | + shell: cmd |
| 173 | + run: jom |
| 174 | + |
| 175 | + - name: Build static Qt. Install |
| 176 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 177 | + working-directory: C:\qt-src\build |
| 178 | + shell: cmd |
| 179 | + run: jom install |
| 180 | + |
| 181 | + - name: Save static Qt cache |
| 182 | + if: steps.static-qt-cache.outputs.cache-hit != 'true' |
| 183 | + uses: actions/cache/save@v3 |
| 184 | + with: |
| 185 | + path: C:\Qt_static |
| 186 | + key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }} |
| 187 | + |
| 188 | + - name: Ccache installation cache |
| 189 | + id: ccache-installation-cache |
| 190 | + uses: actions/cache@v3 |
| 191 | + with: |
| 192 | + path: | |
| 193 | + C:\ProgramData\chocolatey\lib\ccache |
| 194 | + C:\ProgramData\chocolatey\bin\ccache.exe |
| 195 | + C:\ccache\cl.exe |
| 196 | + key: ${{ github.job }}-ccache-installation-${{ env.CI_CCACHE_VERSION }} |
| 197 | + |
| 198 | + - name: Install Ccache |
| 199 | + if: steps.ccache-installation-cache.outputs.cache-hit != 'true' |
| 200 | + run: | |
| 201 | + choco install --yes --no-progress ccache --version=$env:CI_CCACHE_VERSION |
| 202 | + New-Item -ItemType Directory -Path "C:\ccache" |
| 203 | + Copy-Item -Path "$env:ChocolateyInstall\lib\ccache\tools\ccache-$env:CI_CCACHE_VERSION-windows-x86_64\ccache.exe" -Destination "C:\ccache\cl.exe" |
| 204 | +
|
| 205 | + - name: Restore Ccache cache |
| 206 | + uses: actions/cache/restore@v3 |
| 207 | + with: |
| 208 | + path: ~/AppData/Local/ccache |
| 209 | + key: ${{ github.job }}-ccache-${{ github.run_id }} |
| 210 | + restore-keys: ${{ github.job }}-ccache- |
| 211 | + |
| 212 | + - name: Using vcpkg with MSBuild |
| 213 | + run: | |
| 214 | + Set-Location "$env:VCPKG_INSTALLATION_ROOT" |
| 215 | + Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)" |
| 216 | + vcpkg --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install |
| 217 | + git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit" |
| 218 | + Get-Content -Path "$env:GITHUB_WORKSPACE\vcpkg_commit" |
| 219 | +
|
| 220 | + - name: vcpkg tools cache |
| 221 | + uses: actions/cache@v3 |
| 222 | + with: |
| 223 | + path: C:/vcpkg/downloads/tools |
| 224 | + key: ${{ github.job }}-vcpkg-tools |
| 225 | + |
| 226 | + - name: vcpkg binary cache |
| 227 | + uses: actions/cache@v3 |
| 228 | + with: |
| 229 | + path: ~/AppData/Local/vcpkg/archives |
| 230 | + key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'build_msvc/vcpkg.json') }} |
| 231 | + |
| 232 | + - name: Generate project files |
| 233 | + run: py -3 build_msvc\msvc-autogen.py |
| 234 | + |
| 235 | + - name: Build |
| 236 | + shell: cmd |
| 237 | + run: | |
| 238 | + ccache --zero-stats |
| 239 | + msbuild build_msvc\bitcoin.sln -property:CLToolPath=C:\ccache;CLToolExe=cl.exe;UseMultiToolTask=true;Configuration=Release -maxCpuCount -verbosity:minimal -noLogo |
| 240 | +
|
| 241 | + - name: Ccache stats |
| 242 | + run: ccache --show-stats |
| 243 | + |
| 244 | + - name: Save Ccache cache |
| 245 | + uses: actions/cache/save@v3 |
| 246 | + if: github.event_name != 'pull_request' |
| 247 | + with: |
| 248 | + path: ~/AppData/Local/ccache |
| 249 | + # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache |
| 250 | + key: ${{ github.job }}-ccache-${{ github.run_id }} |
| 251 | + |
| 252 | + - name: Run unit tests |
| 253 | + run: src\test_bitcoin.exe -l test_suite |
| 254 | + |
| 255 | + - name: Run benchmarks |
| 256 | + run: src\bench_bitcoin.exe -sanity-check |
| 257 | + |
| 258 | + - name: Run util tests |
| 259 | + run: py -3 test\util\test_runner.py |
| 260 | + |
| 261 | + - name: Run rpcauth test |
| 262 | + run: py -3 test\util\rpcauth-test.py |
| 263 | + |
| 264 | + - name: Run functional tests |
| 265 | + shell: cmd |
| 266 | + run: py -3 test\functional\test_runner.py --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% --extended --exclude feature_dbcrash |
0 commit comments