-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (104 loc) · 3.64 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
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: 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-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-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: true
- 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: true
- 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: true
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 . | grep robot-agent
- name: Build archive
shell: bash
run: |
binary_name="robot-agent"
resname="$binary_name-${{ matrix.platform.target }}"
mv "target/${{ matrix.platform.target }}/release/$binary_name" "$resname"
echo "ASSET=$resname" >> $GITHUB_ENV
# mkdir "$dirname"
# if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then
# mv "target/${{ matrix.platform.target }}/release/$binary_name.exe" "$dirname"
# else
# mv "target/${{ 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
# fi
- name: Upload the binaries
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.ASSET }}