Skip to content

Commit c5c6d26

Browse files
committed
ci: simplify release.yml
De-duplicate the build steps, and use the new BITCOINKERNEL_LIB pattern matching to not require specifyin the exact shared library name.
1 parent 5265f74 commit c5c6d26

File tree

1 file changed

+51
-106
lines changed

1 file changed

+51
-106
lines changed

.github/workflows/release.yml

Lines changed: 51 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,47 @@ on:
55
- 'v[0-9]+.[0-9]+.[0-9]+*' # Matches vX.Y.Z with optional suffix
66

77
jobs:
8-
build-linux:
9-
runs-on: ubuntu-24.04
10-
container: quay.io/pypa/${{ matrix.platform }}_${{ matrix.version }}_${{ matrix.arch }}
8+
build-lib:
119
strategy:
1210
matrix:
1311
include:
14-
- arch: 'x86_64'
15-
platform: 'manylinux'
16-
version: '2_28'
17-
- arch: 'x86_64'
18-
platform: 'musllinux'
19-
version: '1_2'
20-
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
24-
25-
- name: Restore bitcoinkernel from cache
26-
id: cache-lib
27-
uses: actions/cache/restore@v4
28-
with:
29-
path: build/_libs/
30-
key: bitcoinkernel-${{ matrix.platform }}_${{ matrix.version }}_${{ matrix.arch }}-${{ hashFiles('depend/bitcoin/**', 'CMakeLists.txt') }}
31-
32-
- name: Build bitcoinkernel lib
33-
if: steps.cache-lib.outputs.cache-hit != 'true'
34-
run: |
35-
cmake -B build -DBITCOIN_TARGET=${{ matrix.arch }}-linux-gnu
36-
cmake --build build -j
37-
cmake --install build
38-
39-
- name: Save lib cache
40-
if: steps.cache-lib.outputs.cache-hit != 'true'
41-
uses: actions/cache/save@v4
42-
with:
43-
path: build/_libs/
44-
key: ${{ steps.cache-lib.outputs.cache-primary-key}}
45-
46-
- name: Upload Binary
47-
uses: actions/upload-artifact@v4
48-
with:
49-
name: bitcoinkernel-${{ matrix.platform }}_${{ matrix.arch }}
50-
path: build/_libs/libbitcoinkernel.so
51-
if-no-files-found: error
52-
53-
build-windows:
54-
runs-on: ubuntu-24.04
12+
# Linux builds
13+
- os: ubuntu-24.04
14+
container: quay.io/pypa/manylinux_2_28_x86_64
15+
arch: x86_64
16+
platform: manylinux
17+
cmake_args: '-DBITCOIN_TARGET=x86_64-linux-gnu'
18+
19+
- os: ubuntu-24.04
20+
container: quay.io/pypa/musllinux_1_2_x86_64
21+
arch: x86_64
22+
platform: musllinux
23+
cmake_args: '-DBITCOIN_TARGET=x86_64-linux-gnu'
24+
25+
# Windows build
26+
- os: ubuntu-24.04
27+
arch: AMD64
28+
platform: win
29+
cmake_args: '-DBITCOIN_TARGET=x86_64-w64-mingw32'
30+
deps_cmd: sudo apt-get update -y && sudo apt-get install g++-mingw-w64-x86-64-posix
31+
32+
# macOS builds
33+
- os: macos-latest
34+
arch: x86_64
35+
platform: macosx
36+
cmake_args: '-DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0'
37+
deps_cmd: brew install boost
38+
39+
- os: macos-latest
40+
arch: arm64
41+
platform: macosx
42+
cmake_args: '-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0'
43+
deps_cmd: brew install boost
44+
45+
runs-on: ${{ matrix.os }}
46+
container: ${{ matrix.container }}
47+
env:
48+
BUILD_PATH: build/_libs
5549
steps:
5650
- name: Checkout
5751
uses: actions/checkout@v4
@@ -60,105 +54,54 @@ jobs:
6054
id: cache-lib
6155
uses: actions/cache/restore@v4
6256
with:
63-
path: build/_libs/
64-
key: bitcoinkernel-win_AMD64-${{ hashFiles('depend/bitcoin/**', 'CMakeLists.txt') }}
57+
path: ${{ env.BUILD_PATH }}
58+
key: bitcoinkernel-${{ matrix.platform }}_${{ matrix.arch }}-${{ hashFiles('depend/bitcoin/**', 'CMakeLists.txt') }}
6559

6660
- name: Install dependencies
67-
if: steps.cache-lib.outputs.cache-hit != 'true'
68-
run: |
69-
sudo apt-get update -y && \
70-
sudo apt-get install g++-mingw-w64-x86-64-posix
61+
if: steps.cache-lib.outputs.cache-hit != 'true' && matrix.deps_cmd != ''
62+
run: ${{ matrix.deps_cmd }}
7163

7264
- name: Build bitcoinkernel lib
7365
if: steps.cache-lib.outputs.cache-hit != 'true'
7466
run: |
75-
cmake -B build -DBITCOIN_TARGET=x86_64-w64-mingw32
67+
cmake -B build ${{ matrix.cmake_args }}
7668
cmake --build build -j
7769
cmake --install build
7870
7971
- name: Save lib cache
8072
if: steps.cache-lib.outputs.cache-hit != 'true'
8173
uses: actions/cache/save@v4
8274
with:
83-
path: build/_libs/
75+
path: ${{ env.BUILD_PATH }}
8476
key: ${{ steps.cache-lib.outputs.cache-primary-key}}
8577

8678
- name: Upload Binary
8779
uses: actions/upload-artifact@v4
8880
with:
89-
name: bitcoinkernel-win_AMD64
90-
path: build/_libs/libbitcoinkernel.dll
91-
if-no-files-found: error
92-
93-
build-osx:
94-
runs-on: macos-latest
95-
strategy:
96-
matrix:
97-
include:
98-
- arch: 'x86_64'
99-
- arch: 'arm64'
100-
steps:
101-
- name: Checkout
102-
uses: actions/checkout@v4
103-
104-
- name: Restore bitcoinkernel from cache
105-
id: cache-lib
106-
uses: actions/cache/restore@v4
107-
with:
108-
path: build/_libs
109-
key: bitcoinkernel-macosx_${{ matrix.arch }}-${{ hashFiles('depend/bitcoin/**', 'CMakeLists.txt') }}
110-
111-
- name: Install dependencies
112-
if: steps.cache-lib.outputs.cache-hit != 'true'
113-
run: |
114-
brew install boost
115-
116-
- name: Build bitcoinkernel lib
117-
if: steps.cache-lib.outputs.cache-hit != 'true'
118-
run: |
119-
cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
120-
cmake --build build -j
121-
cmake --install build --strip
122-
123-
- name: Save lib cache
124-
if: steps.cache-lib.outputs.cache-hit != 'true'
125-
uses: actions/cache/save@v4
126-
with:
127-
path: build/_libs
128-
key: ${{ steps.cache-lib.outputs.cache-primary-key}}
129-
130-
- name: Upload Binary
131-
uses: actions/upload-artifact@v4
132-
with:
133-
name: bitcoinkernel-macosx_${{ matrix.arch }}
134-
path: build/_libs/libbitcoinkernel.dylib
81+
name: bitcoinkernel-${{ matrix.platform }}_${{ matrix.arch }}
82+
path: ${{ env.BUILD_PATH }}/*
13583
if-no-files-found: error
13684

13785
build-wheels:
138-
needs: [build-linux, build-osx, build-windows]
86+
needs: [build-lib]
13987
strategy:
14088
matrix:
14189
platform_config:
14290
- platform: 'win'
14391
arch: 'AMD64'
14492
os: 'windows-latest'
145-
lib_path: 'lib/libbitcoinkernel.dll'
14693
- platform: 'macosx'
14794
arch: 'arm64'
14895
os: 'macos-latest'
149-
lib_path: 'lib/libbitcoinkernel.dylib'
15096
- platform: 'macosx'
15197
arch: 'x86_64'
15298
os: 'macos-latest'
153-
lib_path: 'lib/libbitcoinkernel.dylib'
15499
- platform: 'manylinux'
155100
arch: 'x86_64'
156101
os: 'ubuntu-latest'
157-
lib_path: 'lib/libbitcoinkernel.so'
158102
- platform: 'musllinux'
159103
arch: 'x86_64'
160104
os: 'ubuntu-latest'
161-
lib_path: 'lib/libbitcoinkernel.so'
162105
runs-on: ${{ matrix.platform_config.os }}
163106
env:
164107
PLATFORM_TAG: ${{ matrix.platform_config.platform }}_${{ matrix.platform_config.arch }}
@@ -170,14 +113,14 @@ jobs:
170113
uses: actions/download-artifact@v4
171114
with:
172115
name: bitcoinkernel-${{ env.PLATFORM_TAG }}
173-
path: lib
116+
path: build/_libs
174117

175118
- name: Build wheels
176119
uses: pypa/[email protected]
177120
env:
178121
CIBW_BUILD: "cp310-${{ env.PLATFORM_TAG }} cp311-${{ env.PLATFORM_TAG }} cp312-${{ env.PLATFORM_TAG }} cp313-${{ env.PLATFORM_TAG }}"
179122
CIBW_ARCHS: "${{ matrix.platform_config.arch }}"
180-
CIBW_ENVIRONMENT: "BITCOINKERNEL_LIB=${{ matrix.platform_config.lib_path }}"
123+
CIBW_ENVIRONMENT: "BITCOINKERNEL_LIB=build/_libs/*bitcoinkernel*"
181124
MACOSX_DEPLOYMENT_TARGET: 13.0
182125
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
183126
CIBW_MUSLLINUX_X86_64_IMAGE: "musllinux_1_2"
@@ -220,6 +163,8 @@ jobs:
220163
221164
- name: Test SDist
222165
run: |
166+
sudo apt-get update -y
167+
sudo apt-get install -y libboost-dev
223168
python -m pip install dist/*.tar.gz
224169
pytest
225170

0 commit comments

Comments
 (0)