-
Notifications
You must be signed in to change notification settings - Fork 35
232 lines (202 loc) · 10.6 KB
/
Copy pathrelease_linux.yml
File metadata and controls
232 lines (202 loc) · 10.6 KB
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
228
229
230
231
232
name: Build Linux
on:
workflow_call:
inputs:
binary_list:
required: true
type: string
workflow_dispatch:
inputs:
binary_list:
description: 'Binaries bundled into the plain tar.gz artifacts (packaged debs/rpms always ship the full set)'
required: false
type: string
default: 'api-blockchain-scanner-daemon,api-web-server,dns-server,node-daemon,wallet-address-generator,wallet-cli,wallet-rpc-daemon'
concurrency:
group: release_linux-${{ github.ref }}
cancel-in-progress: true
env:
FEDORA_IMAGE: fedora:44 # pinned for reproducible packaging; bump deliberately
jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 180
permissions:
contents: read
strategy:
fail-fast: false
matrix:
arch: [aarch64, x86_64]
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
fetch-depth: 0 # git describe needs history for the dispatch fallback version
# Register qemu binfmt handlers so `docker run --platform linux/arm64`
# works on the arm64 matrix leg (needed for the debian:12 deb builder).
- uses: docker/setup-qemu-action@v3
- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
if [ "$VERSION" = "$GITHUB_REF" ]; then
VERSION="$(git describe --tags --abbrev=0 2>/dev/null | sed -e 's/^v//' || true)"
fi
if [ -z "$VERSION" ]; then
VERSION="0.0.0-ci"
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Version extracted: $VERSION"
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.arch }}-unknown-linux-gnu
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install build dependencies
run: |
if [ "${{ matrix.arch }}" = "aarch64" ]; then
sudo dpkg --add-architecture arm64
sudo sed -i -E 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
{
echo 'deb [arch=arm64 signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse'
echo 'deb [arch=arm64 signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse'
echo 'deb [arch=arm64 signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse'
echo 'deb [arch=arm64 signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe multiverse'
} | sudo tee /etc/apt/sources.list.d/ubuntu-ports-arm64.list > /dev/null
sudo apt-get update
sudo apt-get install -y \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
libdbus-1-dev:arm64 \
libusb-1.0-0-dev:arm64 \
libudev-dev:arm64
else
sudo apt-get update
sudo apt-get install -y \
libdbus-1-dev \
libusb-1.0-0-dev \
libudev-dev
fi
sudo apt-get install -y zip pkg-config
- name: Build
env:
PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu: "1"
PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu: "/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
run: |
cargo build --release --locked --target ${{ matrix.arch }}-unknown-linux-gnu --features trezor,ledger
# Shared hicolor icon set for the GUI packages (deb and rpm builders
# consume it; avoids ImageMagick in the fedora container).
- name: Pre-generate icons
run: |
docker run --rm --platform linux/${{ matrix.arch }} -v "$PWD":/work -w /work debian:12 \
bash -ec "
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq && apt-get install -y -qq imagemagick >/dev/null
packaging/make-icons.sh build-tools/assets/node-gui-icon_512.png dist/assets/icons
"
# GH-hosted ubuntu runners ship qemu-user-static + binfmt, so
# `docker run --platform linux/arm64` works out of the box: the arm64 leg
# runs the deb builder inside an arm64 debian:12 container. The same
# scripts run locally via packaging/test-local.sh.
- name: Create Debian packages
run: |
ARCH=${{ matrix.arch }}
if [ "$ARCH" = "x86_64" ]; then DEBARCH=amd64; else DEBARCH=arm64; fi
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work debian:12 \
packaging/deb/build.sh \
--package node --version "${{ steps.get_version.outputs.VERSION }}" \
--debarch $DEBARCH \
--binaries-dir /work/target/$ARCH-unknown-linux-gnu/release \
--out /work/dist
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work debian:12 \
packaging/deb/build.sh \
--package gui --version "${{ steps.get_version.outputs.VERSION }}" \
--debarch $DEBARCH \
--gui-binary /work/target/$ARCH-unknown-linux-gnu/release/node-gui \
--repo-root /work --out /work/dist
# Arch-matched container (qemu on the arm64 leg): native strip works and
# the binaries run under emulation so help2man generates real man pages.
- name: Create RPM packages
run: |
ARCH=${{ matrix.arch }}
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work ${{ env.FEDORA_IMAGE }} \
packaging/rpm/build.sh \
--package node --rpmarch $ARCH \
--version "${{ steps.get_version.outputs.VERSION }}" \
--binaries-dir /work/target/$ARCH-unknown-linux-gnu/release \
--out /work/dist
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work ${{ env.FEDORA_IMAGE }} \
packaging/rpm/build.sh \
--package gui --rpmarch $ARCH \
--version "${{ steps.get_version.outputs.VERSION }}" \
--gui-binary /work/target/$ARCH-unknown-linux-gnu/release/node-gui \
--repo-root /work --out /work/dist
# Install smoke tests in fresh containers (same images as production use)
- name: Smoke test Debian packages
run: |
ARCH=${{ matrix.arch }}
if [ "$ARCH" = "x86_64" ]; then DEBARCH=amd64; else DEBARCH=arm64; fi
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work debian:12 \
packaging/checks/smoke-deb.sh dist/Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${DEBARCH}.deb mintlayer-node node
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work debian:12 \
packaging/checks/smoke-deb.sh dist/Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${DEBARCH}.deb mintlayer-node-gui gui
- name: Smoke test RPM packages
run: |
ARCH=${{ matrix.arch }}
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work ${{ env.FEDORA_IMAGE }} \
packaging/checks/smoke-rpm.sh dist/Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${ARCH}.rpm mintlayer-node node
docker run --rm --platform linux/$ARCH -v "$PWD":/work -w /work ${{ env.FEDORA_IMAGE }} \
packaging/checks/smoke-rpm.sh dist/Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${ARCH}.rpm mintlayer-node-gui gui
- name: Package Mintlayer Node (without GUI) as tar.gz
run: |
mkdir -p Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
IFS=',' read -ra BINARIES <<< "${{ inputs.binary_list }}"
for binary in "${BINARIES[@]}"; do
cp target/${{ matrix.arch }}-unknown-linux-gnu/release/$binary Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}/mintlayer-$binary
done
tar -czvf Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.tar.gz Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
- name: Package Mintlayer Node GUI as tar.gz
run: |
mkdir -p Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
cp target/${{ matrix.arch }}-unknown-linux-gnu/release/node-gui Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}/mintlayer-node-gui
tar -czvf Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.tar.gz Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}
- name: Upload Node DEB Artifact (without GUI)
uses: actions/upload-artifact@v4
with:
name: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_deb
path: dist/Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64' }}.deb
- name: Upload GUI DEB Artifact
uses: actions/upload-artifact@v4
with:
name: Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_deb
path: dist/Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64' }}.deb
- name: Upload Node RPM Artifact
uses: actions/upload-artifact@v4
with:
name: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_rpm
path: dist/Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.rpm
- name: Upload GUI RPM Artifact
uses: actions/upload-artifact@v4
with:
name: Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_rpm
path: dist/Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}.rpm
- name: List tar.gz files
run: |
echo "Matching tar.gz files:"
ls -l Mintlayer_Node_linux_*.tar.gz
- name: Upload Node GUI tar.gz Artifact
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Mintlayer_Node_GUI_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_tar.gz
path: Mintlayer_Node_GUI_linux_*.tar.gz
- name: Upload Node tar.gz Artifact (without GUI)
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Mintlayer_Node_linux_${{ steps.get_version.outputs.VERSION }}_${{ matrix.arch }}_tar.gz
path: Mintlayer_Node_linux_*.tar.gz