forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 2
227 lines (192 loc) · 8.22 KB
/
build-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Build and Release
on:
pull_request:
push:
branches:
- "master"
workflow_dispatch:
jobs:
build-linux:
name: Build Linux binaries
runs-on: ubuntu-24.04
steps:
- name: install Linux deps
run: |
sudo apt-get install build-essential cmake libboost-dev \
libevent-dev pkg-config python3 qtbase5-dev qttools5-dev \
qttools5-dev-tools qtwayland5
- uses: actions/checkout@v4
- name: Restore cached dependencies
uses: actions/cache/restore@v4
with:
path: ./depends
key: linux-${{ hashFiles('depends/packages/**') }}
- name: download dependencies
run: make -C ./depends download-linux
- name: build dependencies
run: make -C ./depends -j4
- name: Cache dependencies
uses: actions/cache/save@v4
with:
path: ./depends
key: linux-${{ hashFiles('depends/packages/**') }}
- name: build
run: |
cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake
cmake --build build -j 4
- name: 'Set environment variables: version number'
run: |
BITCOIN_PATCHED_VERSION=$(grep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-unknown-linux-gnu
if-no-files-found: error
path: |
build/src/bitcoind
build/src/bitcoin-cli
build/src/qt/bitcoin-qt
# cribbed from upstream bitcoin core
# https://github.com/bitcoin/bitcoin/blob/master/.github/workflows/ci.yml
build-windows:
name: 'Win64 native, VS 2022'
# Use latest image, but hardcode version to avoid silent upgrades (and breaks).
# See: https://github.com/actions/runner-images#available-images.
runs-on: windows-2022
timeout-minutes: 360 # windows takes a looooong as time to build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Developer Command Prompt for Microsoft Visual C++
# Using microsoft/setup-msbuild is not enough.
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Get tool information
run: |
cmake -version | Tee-Object -FilePath "cmake_version"
Write-Output "---"
msbuild -version | Tee-Object -FilePath "msbuild_version"
$env:VCToolsVersion | Tee-Object -FilePath "toolset_version"
py -3 --version
Write-Host "PowerShell version $($PSVersionTable.PSVersion.ToString())"
- name: Using vcpkg with MSBuild
run: |
Set-Location "$env:VCPKG_INSTALLATION_ROOT"
Add-Content -Path "triplets\x64-windows.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
Add-Content -Path "triplets\x64-windows-static.cmake" -Value "set(VCPKG_BUILD_TYPE release)"
- name: vcpkg tools cache
uses: actions/cache@v4
with:
path: C:/vcpkg/downloads/tools
key: ${{ github.job }}-vcpkg-tools
- name: Restore vcpkg binary cache
uses: actions/cache/restore@v4
id: vcpkg-binary-cache
with:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
- name: Generate build system
run: |
cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_GUI=ON -DWITH_BDB=OFF -DWITH_ZMQ=ON -DBUILD_BENCH=OFF -DBUILD_FUZZ_BINARY=OFF -DBUILD_TESTS=OFF
- name: Save vcpkg binary cache
uses: actions/cache/save@v4
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true'
with:
path: ~/AppData/Local/vcpkg/archives
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}
- name: Build
working-directory: build
run: |
cmake --build . -j $env:NUMBER_OF_PROCESSORS --config Release
- name: 'Set environment variables: version number'
shell: bash
# This command is a bit different than macOS and Linux, because the Windows version of
# `grep` doesn't have the `-P` option.
run: |
BITCOIN_PATCHED_VERSION=$(grep CMAKE_PROJECT_VERSION:STATIC build/CMakeCache.txt | cut -d = -f2)
echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-w64-msvc
if-no-files-found: error
path: |
build/src/Release/bitcoind.exe
build/src/Release/bitcoin-cli.exe
build/src/qt/Release/bitcoin-qt.exe
build-macos:
name: Build macOS binaries
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: install deps
run: |
# GNU grep is required, as BSD grep does not support perl regexes
brew install boost cmake grep libevent pkg-config qrencode qt@5
- name: Restore cached dependencies
uses: actions/cache/restore@v4
with:
path: ./depends
key: macos-${{ hashFiles('depends/packages/**') }}
- name: download dependencies
run: make -C ./depends download-osx
- name: build dependencies
run: make -C ./depends -j 4
- name: Cache dependencies
uses: actions/cache/save@v4
with:
path: ./depends
key: macos-${{ hashFiles('depends/packages/**') }}
- name: build
run: |
ls depends
cmake -B build -DBUILD_GUI=ON --toolchain depends/x86_64-apple-darwin*/toolchain.cmake
cmake --build build -j 4
- name: 'Set environment variables: version number'
run: |
BITCOIN_PATCHED_VERSION=$(ggrep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
name: bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-apple-darwin
if-no-files-found: error
path: |
build/src/bitcoind
build/src/bitcoin-cli
build/src/qt/bitcoin-qt
upload-artifacts-to-releases-drivechain-info:
name: Upload artifacts to releases.drivechain.info
runs-on: ubuntu-latest
needs: [build-linux, build-macos, build-windows]
if: >
(github.event_name == 'push' &&
github.repository_owner == 'LayerTwo-Labs' &&
github.ref == 'refs/heads/master') ||
github.ref == 'refs/heads/some-whitelisted-branch'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Zip artifacts
run: |
if [ "${{ github.ref }}" == "refs/heads/master" ]; then
VERSION="latest"
else
# We're on a PR, use the branch name
VERSION="${{ github.head_ref }}"
fi
ARTIFACT_PREFIX="L1-bitcoin-patched-$VERSION"
mv bitcoin-patched-*-x86_64-apple-darwin "${ARTIFACT_PREFIX}-x86_64-apple-darwin"
zip -r "${ARTIFACT_PREFIX}-x86_64-apple-darwin.zip" "${ARTIFACT_PREFIX}-x86_64-apple-darwin"
mv bitcoin-patched-*-x86_64-w64-msvc "${ARTIFACT_PREFIX}-x86_64-w64-msvc"
zip -r "${ARTIFACT_PREFIX}-x86_64-w64-msvc.zip" "${ARTIFACT_PREFIX}-x86_64-w64-msvc"
mv bitcoin-patched-*-x86_64-unknown-linux-gnu "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu"
zip -r "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu.zip" "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu"
- name: Upload artifacts to releases.drivechain.info
uses: cross-the-world/ssh-scp-ssh-pipelines@latest
with:
host: 45.33.96.47
user: root
pass: ${{ secrets.RELEASES_SERVER_PW }}
port: 22
scp: |
'L1-bitcoin-patched-*.zip' => '/var/www/html/'