Skip to content

Commit dacc6f7

Browse files
committed
ci: Test CMake edge cases
Keep this commit at the top when rebasing.
1 parent a7b61a4 commit dacc6f7

File tree

2 files changed

+503
-291
lines changed

2 files changed

+503
-291
lines changed

.github/workflows/ci.yml

-291
Original file line numberDiff line numberDiff line change
@@ -1,291 +0,0 @@
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-
test-each-commit:
27-
name: 'test each commit'
28-
runs-on: ubuntu-22.04
29-
if: github.event_name == 'pull_request' && github.event.pull_request.commits != 1
30-
timeout-minutes: 360 # Use maximum time, see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes. Assuming a worst case time of 1 hour per commit, this leads to a --max-count=6 below.
31-
env:
32-
MAX_COUNT: 6
33-
steps:
34-
- name: Determine fetch depth
35-
run: echo "FETCH_DEPTH=$((${{ github.event.pull_request.commits }} + 2))" >> "$GITHUB_ENV"
36-
- uses: actions/checkout@v4
37-
with:
38-
ref: ${{ github.event.pull_request.head.sha }}
39-
fetch-depth: ${{ env.FETCH_DEPTH }}
40-
- name: Determine commit range
41-
run: |
42-
# Checkout HEAD~ and find the test base commit
43-
# Checkout HEAD~ because it would be wasteful to rerun tests on the PR
44-
# head commit that are already run by other jobs.
45-
git checkout HEAD~
46-
# Figure out test base commit by listing ancestors of HEAD, excluding
47-
# ancestors of the most recent merge commit, limiting the list to the
48-
# newest MAX_COUNT ancestors, ordering it from oldest to newest, and
49-
# taking the first one.
50-
#
51-
# If the branch contains up to MAX_COUNT ancestor commits after the
52-
# most recent merge commit, all of those commits will be tested. If it
53-
# contains more, only the most recent MAX_COUNT commits will be
54-
# tested.
55-
#
56-
# In the command below, the ^@ suffix is used to refer to all parents
57-
# of the merge commit as described in:
58-
# https://git-scm.com/docs/git-rev-parse#_other_rev_parent_shorthand_notations
59-
# and the ^ prefix is used to exclude these parents and all their
60-
# ancestors from the rev-list output as described in:
61-
# https://git-scm.com/docs/git-rev-list
62-
echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD ^$(git rev-list -n1 --merges HEAD)^@ | head -1)" >> "$GITHUB_ENV"
63-
- run: |
64-
sudo apt-get update
65-
sudo apt-get install clang-15 ccache build-essential libtool autotools-dev automake pkg-config bsdmainutils python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libminiupnpc-dev libnatpmp-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y
66-
- name: Compile and run tests
67-
run: |
68-
# Run tests on commits after the last merge commit and before the PR head commit
69-
# Use clang++, because it is a bit faster and uses less memory than g++
70-
git rebase --exec "echo Running test-one-commit on \$( git log -1 ) && ./autogen.sh && CC=clang-15 CXX=clang++-15 ./configure && make clean && make -j $(nproc) check && ./test/functional/test_runner.py -j $(( $(nproc) * 2 ))" ${{ env.TEST_BASE }}
71-
72-
macos-native-x86_64:
73-
name: 'macOS 13 native, x86_64, no depends, sqlite only, gui'
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: macos-13
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-
timeout-minutes: 120
82-
83-
env:
84-
FILE_ENV: './ci/test/00_setup_env_mac_native.sh'
85-
BASE_ROOT_DIR: ${{ github.workspace }}
86-
87-
steps:
88-
- name: Checkout
89-
uses: actions/checkout@v4
90-
91-
- name: Clang version
92-
run: |
93-
sudo xcode-select --switch /Applications/Xcode_15.0.app
94-
clang --version
95-
96-
- name: Install Homebrew packages
97-
env:
98-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
99-
run: brew install automake libtool pkg-config gnu-getopt ccache boost libevent miniupnpc libnatpmp zeromq qt@5 qrencode
100-
101-
- name: Set Ccache directory
102-
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
103-
104-
- name: Restore Ccache cache
105-
id: ccache-cache
106-
uses: actions/cache/restore@v4
107-
with:
108-
path: ${{ env.CCACHE_DIR }}
109-
key: ${{ github.job }}-ccache-${{ github.run_id }}
110-
restore-keys: ${{ github.job }}-ccache-
111-
112-
- name: CI script
113-
run: ./ci/test_run_all.sh
114-
115-
- name: Save Ccache cache
116-
uses: actions/cache/save@v4
117-
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
118-
with:
119-
path: ${{ env.CCACHE_DIR }}
120-
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
121-
key: ${{ github.job }}-ccache-${{ github.run_id }}
122-
123-
win64-native:
124-
name: 'Win64 native, VS 2022'
125-
# Use latest image, but hardcode version to avoid silent upgrades (and breaks).
126-
# See: https://github.com/actions/runner-images#available-images.
127-
runs-on: windows-2022
128-
129-
# No need to run on the read-only mirror, unless it is a PR.
130-
if: github.repository != 'bitcoin-core/gui' || github.event_name == 'pull_request'
131-
132-
env:
133-
CCACHE_MAXSIZE: '200M'
134-
CI_CCACHE_VERSION: '4.7.5'
135-
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'
136-
CI_QT_DIR: 'qt-everywhere-src-5.15.11'
137-
CI_QT_URL: 'https://download.qt.io/official_releases/qt/5.15/5.15.11/single/qt-everywhere-opensource-src-5.15.11.zip'
138-
PYTHONUTF8: 1
139-
TEST_RUNNER_TIMEOUT_FACTOR: 40
140-
141-
steps:
142-
- name: Checkout
143-
uses: actions/checkout@v4
144-
145-
- name: Configure Developer Command Prompt for Microsoft Visual C++
146-
# Using microsoft/setup-msbuild is not enough.
147-
uses: ilammy/msvc-dev-cmd@v1
148-
with:
149-
arch: x64
150-
151-
- name: Check MSBuild and Qt
152-
run: |
153-
msbuild -version | Out-File -FilePath "$env:GITHUB_WORKSPACE\msbuild_version"
154-
Get-Content -Path "$env:GITHUB_WORKSPACE\msbuild_version"
155-
$env:VCToolsVersion | Out-File -FilePath "$env:GITHUB_WORKSPACE\toolset_version"
156-
Get-Content -Path "$env:GITHUB_WORKSPACE\toolset_version"
157-
$env:CI_QT_URL | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_url"
158-
$env:CI_QT_CONF | Out-File -FilePath "$env:GITHUB_WORKSPACE\qt_conf"
159-
160-
- name: Restore static Qt cache
161-
id: static-qt-cache
162-
uses: actions/cache/restore@v4
163-
with:
164-
path: C:\Qt_static
165-
key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }}
166-
167-
- name: Build static Qt. Download
168-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
169-
shell: cmd
170-
run: |
171-
curl --location --output C:\qt-src.zip %CI_QT_URL%
172-
choco install --yes --no-progress jom
173-
174-
- name: Build static Qt. Expand source archive
175-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
176-
shell: cmd
177-
run: tar -xf C:\qt-src.zip -C C:\
178-
179-
- name: Build static Qt. Create build directory
180-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
181-
run: |
182-
Rename-Item -Path "C:\$env:CI_QT_DIR" -NewName "C:\qt-src"
183-
New-Item -ItemType Directory -Path "C:\qt-src\build"
184-
185-
- name: Build static Qt. Configure
186-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
187-
working-directory: C:\qt-src\build
188-
shell: cmd
189-
run: ..\configure %CI_QT_CONF% -prefix C:\Qt_static
190-
191-
- name: Build static Qt. Build
192-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
193-
working-directory: C:\qt-src\build
194-
shell: cmd
195-
run: jom
196-
197-
- name: Build static Qt. Install
198-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
199-
working-directory: C:\qt-src\build
200-
shell: cmd
201-
run: jom install
202-
203-
- name: Save static Qt cache
204-
if: steps.static-qt-cache.outputs.cache-hit != 'true'
205-
uses: actions/cache/save@v4
206-
with:
207-
path: C:\Qt_static
208-
key: ${{ github.job }}-static-qt-${{ hashFiles('msbuild_version', 'qt_url', 'qt_conf') }}
209-
210-
- name: Ccache installation cache
211-
id: ccache-installation-cache
212-
uses: actions/cache@v4
213-
with:
214-
path: |
215-
C:\ProgramData\chocolatey\lib\ccache
216-
C:\ProgramData\chocolatey\bin\ccache.exe
217-
C:\ccache\cl.exe
218-
key: ${{ github.job }}-ccache-installation-${{ env.CI_CCACHE_VERSION }}
219-
220-
- name: Install Ccache
221-
if: steps.ccache-installation-cache.outputs.cache-hit != 'true'
222-
run: |
223-
choco install --yes --no-progress ccache --version=$env:CI_CCACHE_VERSION
224-
New-Item -ItemType Directory -Path "C:\ccache"
225-
Copy-Item -Path "$env:ChocolateyInstall\lib\ccache\tools\ccache-$env:CI_CCACHE_VERSION-windows-x86_64\ccache.exe" -Destination "C:\ccache\cl.exe"
226-
227-
- name: Restore Ccache cache
228-
id: ccache-cache
229-
uses: actions/cache/restore@v4
230-
with:
231-
path: ~/AppData/Local/ccache
232-
key: ${{ github.job }}-ccache-${{ github.run_id }}
233-
restore-keys: ${{ github.job }}-ccache-
234-
235-
- name: Using vcpkg with MSBuild
236-
run: |
237-
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
238-
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
239-
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_PLATFORM_TOOLSET_VERSION $env:VCToolsVersion)"
240-
.\vcpkg.exe --vcpkg-root "$env:VCPKG_INSTALLATION_ROOT" integrate install
241-
git rev-parse HEAD | Out-File -FilePath "$env:GITHUB_WORKSPACE\vcpkg_commit"
242-
Get-Content -Path "$env:GITHUB_WORKSPACE\vcpkg_commit"
243-
244-
- name: vcpkg tools cache
245-
uses: actions/cache@v4
246-
with:
247-
path: C:/vcpkg/downloads/tools
248-
key: ${{ github.job }}-vcpkg-tools
249-
250-
- name: vcpkg binary cache
251-
uses: actions/cache@v4
252-
with:
253-
path: ~/AppData/Local/vcpkg/archives
254-
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('vcpkg_commit', 'msbuild_version', 'toolset_version', 'build_msvc/vcpkg.json') }}
255-
256-
- name: Generate project files
257-
run: py -3 build_msvc\msvc-autogen.py
258-
259-
- name: Build
260-
shell: cmd
261-
run: |
262-
ccache --zero-stats
263-
msbuild build_msvc\bitcoin.sln -property:CLToolPath=C:\ccache;CLToolExe=cl.exe;UseMultiToolTask=true;Configuration=Release -maxCpuCount -verbosity:minimal -noLogo
264-
265-
- name: Ccache stats
266-
run: ccache --show-stats
267-
268-
- name: Save Ccache cache
269-
uses: actions/cache/save@v4
270-
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
271-
with:
272-
path: ~/AppData/Local/ccache
273-
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
274-
key: ${{ github.job }}-ccache-${{ github.run_id }}
275-
276-
- name: Run unit tests
277-
run: src\test_bitcoin.exe -l test_suite
278-
279-
- name: Run benchmarks
280-
run: src\bench_bitcoin.exe -sanity-check
281-
282-
- name: Run util tests
283-
run: py -3 test\util\test_runner.py
284-
285-
- name: Run rpcauth test
286-
run: py -3 test\util\rpcauth-test.py
287-
288-
- name: Run functional tests
289-
env:
290-
TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }}
291-
run: py -3 test\functional\test_runner.py --jobs $env:NUMBER_OF_PROCESSORS --ci --quiet --tmpdirprefix=$env:RUNNER_TEMP --combinedlogslen=99999999 --timeout-factor=$env:TEST_RUNNER_TIMEOUT_FACTOR $env:TEST_RUNNER_EXTRA

0 commit comments

Comments
 (0)