|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v[0-9]+.[0-9]+.[0-9]+*' # Matches vX.Y.Z with optional suffix |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-linux: |
| 9 | + runs-on: ubuntu-24.04 |
| 10 | + container: quay.io/pypa/${{ matrix.platform }}_${{ matrix.version }}_${{ matrix.arch }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + 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: depend/bitcoin/build/lib/ |
| 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 | + cd depend/bitcoin && \ |
| 36 | + make -C depends NO_QT=1 NO_QR=1 NO_ZMQ=1 NO_WALLET=1 NO_USDT=1 NO_LIBEVENT=1 NO_SQLITE=1 NO_BDB=1 HOST=${{ matrix.arch }}-linux-gnu -j$(nproc) && \ |
| 37 | + cmake -B build -DCMAKE_TOOLCHAIN_FILE=$PWD/depends/${{ matrix.arch }}-linux-gnu/toolchain.cmake -DBUILD_KERNEL_LIB=ON -DBUILD_BENCH=OFF -DBUILD_DAEMON=OFF -DBUILD_CLI=OFF -DBUILD_GUI=OFF -DBUILD_FUZZ_BINARY=OFF -DBUILD_TESTS=OFF -DBUILD_TX=OFF -DBUILD_UTIL=OFF -DBUILD_UTIL_CHAINSTATE=OFF -DBUILD_WALLET_TOOL=OFF -DENABLE_WALLET=OFF && \ |
| 38 | + cmake --build build --target bitcoinkernel --parallel && \ |
| 39 | + cmake --install build --component Kernel --prefix=build/ --strip |
| 40 | +
|
| 41 | + - name: Save lib cache |
| 42 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 43 | + uses: actions/cache/save@v4 |
| 44 | + with: |
| 45 | + path: depend/bitcoin/build/lib/ |
| 46 | + key: ${{ steps.cache-lib.outputs.cache-primary-key}} |
| 47 | + |
| 48 | + - name: Upload Binary |
| 49 | + uses: actions/upload-artifact@v4 |
| 50 | + with: |
| 51 | + name: bitcoinkernel-${{ matrix.platform }}_${{ matrix.arch }} |
| 52 | + path: depend/bitcoin/build/lib/libbitcoinkernel.so |
| 53 | + if-no-files-found: error |
| 54 | + |
| 55 | + build-windows: |
| 56 | + runs-on: ubuntu-24.04 |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Restore bitcoinkernel from cache |
| 62 | + id: cache-lib |
| 63 | + uses: actions/cache/restore@v4 |
| 64 | + with: |
| 65 | + path: depend/bitcoin/build/bin/ |
| 66 | + key: bitcoinkernel-win_AMD64-${{ hashFiles('depend/bitcoin/**', 'CMakeLists.txt') }} |
| 67 | + |
| 68 | + - name: Install dependencies |
| 69 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 70 | + run: | |
| 71 | + sudo apt-get update -y && \ |
| 72 | + sudo apt-get install g++-mingw-w64-x86-64-posix |
| 73 | +
|
| 74 | + - name: Build bitcoinkernel lib |
| 75 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 76 | + run: | |
| 77 | + cd depend/bitcoin && \ |
| 78 | + make -C depends NO_QT=1 NO_QR=1 NO_ZMQ=1 NO_WALLET=1 NO_USDT=1 NO_LIBEVENT=1 NO_SQLITE=1 NO_BDB=1 HOST=x86_64-w64-mingw32 -j$(nproc) && \ |
| 79 | + cmake -B build -DCMAKE_TOOLCHAIN_FILE=$PWD/depends/x86_64-w64-mingw32/toolchain.cmake -DBUILD_KERNEL_LIB=ON -DBUILD_BENCH=OFF -DBUILD_DAEMON=OFF -DBUILD_CLI=OFF -DBUILD_GUI=OFF -DBUILD_FUZZ_BINARY=OFF -DBUILD_TESTS=OFF -DBUILD_TX=OFF -DBUILD_UTIL=OFF -DBUILD_UTIL_CHAINSTATE=OFF -DBUILD_WALLET_TOOL=OFF -DENABLE_WALLET=OFF && \ |
| 80 | + cmake --build build --target bitcoinkernel --parallel && \ |
| 81 | + cmake --install build --component Kernel --prefix=build/ --strip |
| 82 | +
|
| 83 | + - name: Save lib cache |
| 84 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 85 | + uses: actions/cache/save@v4 |
| 86 | + with: |
| 87 | + path: depend/bitcoin/build/bin/ |
| 88 | + key: ${{ steps.cache-lib.outputs.cache-primary-key}} |
| 89 | + |
| 90 | + - name: Upload Binary |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: bitcoinkernel-win_AMD64 |
| 94 | + path: depend/bitcoin/build/bin/libbitcoinkernel.dll |
| 95 | + if-no-files-found: error |
| 96 | + |
| 97 | + build-osx: |
| 98 | + runs-on: macos-latest |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + include: |
| 102 | + - arch: 'x86_64' |
| 103 | + - arch: 'arm64' |
| 104 | + steps: |
| 105 | + - name: Checkout |
| 106 | + uses: actions/checkout@v4 |
| 107 | + |
| 108 | + - name: Restore bitcoinkernel from cache |
| 109 | + id: cache-lib |
| 110 | + uses: actions/cache/restore@v4 |
| 111 | + with: |
| 112 | + path: build/_libs |
| 113 | + key: bitcoinkernel-macosx_${{ matrix.arch }}-${{ hashFiles('depend/bitcoin/**', 'CMakeLists.txt') }} |
| 114 | + |
| 115 | + - name: Install dependencies |
| 116 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 117 | + run: | |
| 118 | + brew install boost |
| 119 | +
|
| 120 | + - name: Build bitcoinkernel lib |
| 121 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 122 | + run: | |
| 123 | + cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 |
| 124 | + cmake --build build -j |
| 125 | + cmake --install build --strip |
| 126 | +
|
| 127 | + - name: Save lib cache |
| 128 | + if: steps.cache-lib.outputs.cache-hit != 'true' |
| 129 | + uses: actions/cache/save@v4 |
| 130 | + with: |
| 131 | + path: build/_libs |
| 132 | + key: ${{ steps.cache-lib.outputs.cache-primary-key}} |
| 133 | + |
| 134 | + - name: Upload Binary |
| 135 | + uses: actions/upload-artifact@v4 |
| 136 | + with: |
| 137 | + name: bitcoinkernel-macosx_${{ matrix.arch }} |
| 138 | + path: build/_libs/libbitcoinkernel.dylib |
| 139 | + if-no-files-found: error |
| 140 | + |
| 141 | + build-wheels: |
| 142 | + needs: [build-linux, build-osx, build-windows] |
| 143 | + strategy: |
| 144 | + matrix: |
| 145 | + platform_config: |
| 146 | + - platform: 'win' |
| 147 | + arch: 'AMD64' |
| 148 | + os: 'windows-latest' |
| 149 | + lib_path: 'lib/libbitcoinkernel.dll' |
| 150 | + - platform: 'macosx' |
| 151 | + arch: 'arm64' |
| 152 | + os: 'macos-latest' |
| 153 | + lib_path: 'lib/libbitcoinkernel.dylib' |
| 154 | + - platform: 'macosx' |
| 155 | + arch: 'x86_64' |
| 156 | + os: 'macos-latest' |
| 157 | + lib_path: 'lib/libbitcoinkernel.dylib' |
| 158 | + - platform: 'manylinux' |
| 159 | + arch: 'x86_64' |
| 160 | + os: 'ubuntu-latest' |
| 161 | + lib_path: 'lib/libbitcoinkernel.so' |
| 162 | + - platform: 'musllinux' |
| 163 | + arch: 'x86_64' |
| 164 | + os: 'ubuntu-latest' |
| 165 | + lib_path: 'lib/libbitcoinkernel.so' |
| 166 | + runs-on: ${{ matrix.platform_config.os }} |
| 167 | + env: |
| 168 | + PLATFORM_TAG: ${{ matrix.platform_config.platform }}_${{ matrix.platform_config.arch }} |
| 169 | + steps: |
| 170 | + - name: Checkout |
| 171 | + uses: actions/checkout@v4 |
| 172 | + |
| 173 | + - name: Download lib |
| 174 | + uses: actions/download-artifact@v4 |
| 175 | + with: |
| 176 | + name: bitcoinkernel-${{ env.PLATFORM_TAG }} |
| 177 | + path: lib |
| 178 | + |
| 179 | + - name: Build wheels |
| 180 | + |
| 181 | + env: |
| 182 | + CIBW_BUILD: "cp310-${{ env.PLATFORM_TAG }} cp311-${{ env.PLATFORM_TAG }} cp312-${{ env.PLATFORM_TAG }} cp313-${{ env.PLATFORM_TAG }}" |
| 183 | + CIBW_ARCHS: "${{ matrix.platform_config.arch }}" |
| 184 | + CIBW_ENVIRONMENT: "BITCOINKERNEL_LIB=${{ matrix.platform_config.lib_path }}" |
| 185 | + MACOSX_DEPLOYMENT_TARGET: 13.0 |
| 186 | + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" |
| 187 | + CIBW_MUSLLINUX_X86_64_IMAGE: "musllinux_1_2" |
| 188 | + |
| 189 | + - name: Upload Wheels |
| 190 | + uses: actions/upload-artifact@v4 |
| 191 | + with: |
| 192 | + name: wheels-${{ env.PLATFORM_TAG }} |
| 193 | + path: wheelhouse/*.whl |
| 194 | + |
| 195 | + publish-pypi: |
| 196 | + needs: build-wheels |
| 197 | + runs-on: ubuntu-latest |
| 198 | + environment: |
| 199 | + name: pypi |
| 200 | + url: https://pypi.org/p/py-bitcoinkernel |
| 201 | + permissions: |
| 202 | + id-token: write |
| 203 | + |
| 204 | + steps: |
| 205 | + - name: Checkout |
| 206 | + uses: actions/checkout@v4 |
| 207 | + |
| 208 | + - name: Download all wheels |
| 209 | + uses: actions/download-artifact@v4 |
| 210 | + with: |
| 211 | + pattern: wheels-* |
| 212 | + path: dist |
| 213 | + merge-multiple: true |
| 214 | + |
| 215 | + - name: Set up Python |
| 216 | + uses: actions/setup-python@v5 |
| 217 | + with: |
| 218 | + python-version: "3.x" |
| 219 | + |
| 220 | + - name: Build SDist |
| 221 | + run: | |
| 222 | + python -m pip install build |
| 223 | + python -m build --sdist |
| 224 | +
|
| 225 | + - name: Publish to PyPI |
| 226 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments