-
Notifications
You must be signed in to change notification settings - Fork 112
175 lines (146 loc) · 5.38 KB
/
build_binary.yml
File metadata and controls
175 lines (146 loc) · 5.38 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
name: Binary Release Build
on:
push:
branches:
- release/**
env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
container:
# Use an older docker container to build the binary to guarantee glibc compatibility.
# Ubuntu 20.04 needs to be supported until 2027-05-31 (EOL + 2 Years).
# Make sure to update documentation once the version is updated:
# https://docs.sentry.io/product/relay/operating-guidelines/
image: ubuntu:20.04
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends git ca-certificates gcc libc6-dev curl make zip
- uses: actions/checkout@v6.0.2
with:
submodules: recursive
- name: Add git safe directory exception
run: git config --global --add safe.directory "$(pwd)"
- name: Install Rust Toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain stable -y
- name: Build binary
run: |
. "$HOME/.cargo/env"
make build-linux-release
env:
RELAY_FEATURES:
- name: Bundle Debug File
run: |
cd target/release/
zip relay-Linux-x86_64-debug.zip relay.debug
mv relay relay-Linux-x86_64
- uses: actions/upload-artifact@v7
with:
name: artifact-linux
path: target/release/relay-Linux-x86_64*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
linux-aarch64:
name: Linux Aarch64
# Ubuntu 22.04 needs to be supported until Apr 2029 (EOL + 2 Years).
# Make sure to update documentation once the version is updated:
# https://docs.sentry.io/product/relay/operating-guidelines/
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v6.0.2
with:
submodules: recursive
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Build binary
run: |
make build-linux-release
env:
RELAY_FEATURES:
- name: Bundle Debug File
run: |
cd target/release/
zip relay-Linux-aarch64-debug.zip relay.debug
mv relay relay-Linux-aarch64
- uses: actions/upload-artifact@v7
with:
name: artifact-linux-aarch64
path: target/release/relay-Linux-aarch64*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
macos:
name: macOS
# Make sure to update documentation once the version is updated:
# https://docs.sentry.io/product/relay/operating-guidelines/
runs-on: macos-14
steps:
- uses: actions/checkout@v6.0.2
with:
submodules: recursive
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Run Cargo Build
run: cargo build --manifest-path=relay/Cargo.toml --release
env:
CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO: packed
- name: Bundle dSYM
run: |
cd target/release
mv relay relay-Darwin-x86_64
zip -r relay-Darwin-x86_64-dsym.zip relay.dSYM
- uses: actions/upload-artifact@v7
with:
name: artifact-macos
path: target/release/relay-Darwin-x86_64*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
windows:
name: Windows
# Make sure to update documentation once the version is updated:
# https://docs.sentry.io/product/relay/operating-guidelines/
runs-on: windows-2022
steps:
- uses: actions/checkout@v6.0.2
with:
submodules: recursive
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Run Cargo Build
run: cargo build --manifest-path=relay/Cargo.toml --release
- name: Bundle PDB
run: |
Install-Module 7Zip4PowerShell -Force -Verbose
cd target/release
7z a relay-Windows-x86_64-pdb.zip relay.pdb
mv relay.exe relay-Windows-x86_64.exe
- uses: actions/upload-artifact@v7
with:
name: artifact-windows
path: target/release/relay-Windows-x86_64*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
merge:
name: Create Release Artifact
runs-on: ubuntu-latest
needs: [linux, linux-aarch64, macos, windows]
steps:
# Note: due to the immutability of artifacts in upload-artifact v4,
# there cannot be mutliple upload-artifacts with the same name, in a sha's workflow runs.
# However in this case it is fine because this only runs on release/** branches,
# and the other runs on release-library/** branches.
- uses: actions/upload-artifact/merge@v7
with:
# Craft expects release assets to be a single artifact named after the sha.
name: ${{ github.sha }}
pattern: artifact-*
delete-merged: true