-
Notifications
You must be signed in to change notification settings - Fork 1
246 lines (214 loc) · 8 KB
/
build.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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Self-test
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
build-and-upload:
name: Build and upload
strategy:
fail-fast: false
matrix:
platform:
- platform_name: FreeBSD-x86_64
os: ubuntu-20.04
target: x86_64-unknown-freebsd
expect_file_re: "x86-64.+FreeBSD"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
expect_file_re: "ELF.+x86-64"
expect_cross: "--no-expect-cross"
expect_stripped: "--expect-stripped"
can_test: true
- platform_name: Linux-aarch64
os: ubuntu-20.04
target: aarch64-unknown-linux-musl
expect_file_re: "aarch64"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: true
- platform_name: Linux-aarch64-with-cross-v0.2.3
os: ubuntu-20.04
target: aarch64-unknown-linux-musl
cross-version: "v0.2.3"
expect_file_re: "aarch64"
expect_cross: "--expect-cross"
expect_cross_version: "0.2.3"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-arm
os: ubuntu-20.04
target: arm-unknown-linux-musleabi
expect_file_re: "32.+ARM"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: true
- platform_name: Linux-i586
os: ubuntu-20.04
target: i586-unknown-linux-musl
expect_file_re: "ELF.+80386"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-i686
os: ubuntu-20.04
target: i686-unknown-linux-musl
expect_file_re: "ELF.+80386"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-mips
os: ubuntu-20.04
target: mips-unknown-linux-musl
expect_file_re: "MIPS32.+mips-"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-mipsel
os: ubuntu-20.04
target: mipsel-unknown-linux-musl
expect_file_re: "MIPS32.+mipsel-"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-mips64
os: ubuntu-20.04
target: mips64-unknown-linux-muslabi64
expect_file_re: "MIPS64"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-mips64el
os: ubuntu-20.04
target: mips64el-unknown-linux-muslabi64
expect_file_re: "MIPS64"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-powerpc
os: ubuntu-20.04
target: powerpc-unknown-linux-gnu
expect_file_re: "32.+PowerPC"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-powerpc64
os: ubuntu-20.04
target: powerpc64-unknown-linux-gnu
expect_file_re: "64.+PowerPC"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-powerpc64le
os: ubuntu-20.04
target: powerpc64le-unknown-linux-gnu
expect_file_re: "64.+PowerPC"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-riscv64
os: ubuntu-20.04
target: riscv64gc-unknown-linux-gnu
expect_file_re: "64.+RISC-V"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Linux-s390x
os: ubuntu-20.04
target: s390x-unknown-linux-gnu
expect_file_re: "64.+S/390"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: NetBSD-x86_64
os: ubuntu-20.04
target: x86_64-unknown-netbsd
expect_file_re: "x86-64.+NetBSD"
expect_cross: "--expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Windows-aarch64
os: windows-latest
target: aarch64-pc-windows-msvc
expect_file_re: "Aarch64.+Windows"
expect_cross: "--no-expect-cross"
expect_stripped: "--no-expect-stripped"
can_test: false
- platform_name: Windows-i686
os: windows-latest
target: i686-pc-windows-msvc
expect_file_re: "80386.+Windows"
expect_cross: "--no-expect-cross"
expect_stripped: "--expect-stripped"
can_test: false
- platform_name: Windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
expect_file_re: "x86-64.+Windows"
expect_stripped: "--expect-stripped"
can_test: false
- platform_name: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
expect_file_re: "Mach-O.+x86_64"
expect_cross: "--no-expect-cross"
expect_stripped: "--expect-stripped"
can_test: false
- platform_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
expect_file_re: "Mach-O.+arm64"
expect_cross: "--no-expect-cross"
expect_stripped: "--expect-stripped"
can_test: false
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{github.repository}}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.platform.target }}
- name: list result files (debug)
shell: bash
run: |
find target | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"
- name: Build archive
shell: bash
run: |
binary_name="robotagent"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.platform.target }}"
mkdir "$dirname"
if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then
mv "target/release/${{ matrix.platform.target }}/release/$binary_name.exe" "$dirname"
else
mv "target/release/${{ matrix.platform.target }}/release/$binary_name" "$dirname"
fi
if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
- name: Upload the binaries
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.ASSET }}