Skip to content

Commit 4291baa

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

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- '**'
1515

1616
concurrency:
17-
group: ${{ github.event_name != 'pull_request' && github.run_id || github.ref }}
17+
group: ${{ github.workflow }}${{ github.event_name != 'pull_request' && github.run_id || github.ref }}
1818
cancel-in-progress: true
1919

2020
env:

.github/workflows/cmake.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright (c) 2023-present The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or https://opensource.org/license/mit/.
4+
5+
name: CMake
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.workflow }}${{ github.event_name != 'pull_request' && github.run_id || github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
cross-build:
22+
name: ${{ matrix.host.name }}
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
host:
29+
- name: 'Linux 32-bit, Clang, link to libatomic'
30+
packages: 'clang-14 g++-multilib'
31+
triplet: 'i686-pc-linux-gnu'
32+
c_compiler: 'clang-14 -m32'
33+
cxx_compiler: 'clang++-14 -m32'
34+
depends_options: 'NO_QT=1'
35+
configure_options: '-DWERROR=ON'
36+
37+
env:
38+
CCACHE_MAXSIZE: '120M'
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Install dependency packages
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install --no-install-recommends ccache ${{ matrix.host.packages }}
48+
echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV"
49+
50+
- name: Depends fingerprint
51+
id: depends_fingerprint
52+
run: |
53+
${{ matrix.host.c_compiler }} -v 2>&1 | tee depends/c_compiler_version
54+
${{ matrix.host.cxx_compiler }} -v 2>&1 | tee depends/cxx_compiler_version
55+
echo ${{ matrix.host.depends_options }} > depends/depends_options
56+
echo "hash=${{ hashFiles('./depends/**') }}" >> "$GITHUB_OUTPUT"
57+
58+
- name: Depends cache
59+
id: depends_cache
60+
uses: actions/cache@v3
61+
with:
62+
path: |
63+
depends/built
64+
key: ${{ matrix.host.triplet }}-depends-${{ steps.depends_fingerprint.outputs.hash }}
65+
66+
- name: Build depends
67+
run: |
68+
cd depends
69+
make -j$(nproc) HOST=${{ matrix.host.triplet }} CC='${{ matrix.host.c_compiler }}' CXX='${{ matrix.host.cxx_compiler }}' ${{ matrix.host.depends_options }} LOG=1
70+
71+
- name: Restore Ccache cache
72+
uses: actions/cache/restore@v3
73+
id: ccache-cache
74+
with:
75+
path: ${{ env.CCACHE_DIR }}
76+
key: ${{ matrix.host.triplet }}-ccache-${{ github.run_id }}
77+
restore-keys: ${{ matrix.host.triplet }}-ccache-
78+
79+
- name: Generate build system
80+
run: |
81+
cmake -B build --toolchain depends/${{ matrix.host.triplet }}/share/toolchain.cmake ${{ matrix.host.configure_options }}
82+
83+
- name: Build
84+
run: |
85+
ccache --zero-stats
86+
cmake --build build -j $(nproc)
87+
ccache --version | head -n 1 && ccache --show-stats
88+
file build/src/bitcoind
89+
90+
- name: Save Ccache cache
91+
uses: actions/cache/save@v3
92+
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
93+
with:
94+
path: ${{ env.CCACHE_DIR }}
95+
key: ${{ matrix.host.triplet }}-ccache-${{ github.run_id }}
96+
97+
- name: Check
98+
run: |
99+
ctest --test-dir build -j $(nproc)

0 commit comments

Comments
 (0)