-
Notifications
You must be signed in to change notification settings - Fork 10
162 lines (141 loc) · 5.06 KB
/
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
name: Build and release uplink binaries
on:
release:
types: [published]
jobs:
release-tools:
name: Build tools/${{ matrix.build }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [system-stats]
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-musl
- name: Build binary
run: cargo build -p ${{ matrix.build }} --verbose --release --target x86_64-unknown-linux-musl
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: target/x86_64-unknown-linux-musl/release/${{ matrix.build }}
build-release:
name: Build release for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux, macos, linux-arm-gnu, windows]
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: macos-m1
os: macos-latest
rust: stable
target: aarch64-apple-darwin
- build: linux-arm-gnu
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
- build: linux-aarch-musl
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-musl
- build: linux-aarch-gnu
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
- build: windows
os: ubuntu-latest
rust: stable
target: x86_64-pc-windows-gnu
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Use Cross
shell: bash
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Build release binary
run: cross build --verbose --release ${{ env.TARGET_FLAGS }}
- name: Strip release binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos' || matrix.build == 'macos-m1'
run: strip "target/${{ matrix.target }}/release/uplink"
- name: Strip release binary (armv7)
if: matrix.build == 'linux-arm-gnu'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:armv7-unknown-linux-gnueabihf \
arm-linux-gnueabihf-strip \
/target/armv7-unknown-linux-gnueabihf/release/uplink
- name: Strip release binary (aarch-musl)
if: matrix.build == 'linux-aarch-musl'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:aarch64-unknown-linux-musl \
aarch64-linux-musl-strip \
/target/aarch64-unknown-linux-musl/release/uplink
- name: Strip release binary (aarch-gnu)
if: matrix.build == 'linux-aarch-gnu'
run: |
docker run --rm -v \
"$PWD/target:/target:Z" \
rustembedded/cross:aarch64-unknown-linux-gnu \
aarch64-linux-gnu-strip \
/target/aarch64-unknown-linux-gnu/release/uplink
- name: Rename ${{ matrix.target }} binary
if: matrix.build != 'windows'
run: mv "target/${{ matrix.target }}/release/uplink" "uplink-${{ matrix.target }}"
- name: Rename ${{ matrix.target }} binary
if: matrix.build == 'windows'
run: mv "target/${{ matrix.target }}/release/uplink.exe" "uplink-${{ matrix.target }}.exe"
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: uplink*
build-release-android:
name: Build release for android
runs-on: ubuntu-latest
container:
image: bytebeamio/rust-android
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: perms
run: chown root:root .
- name: Build for armv7
run: cargo ndk --target armv7-linux-androideabi --platform 23 build --release --bin uplink
- name: Build for aarch64
run: cargo ndk --target aarch64-linux-android --platform 23 build --release --bin uplink
- name: Rename uplink binaries
run: |
mv "target/aarch64-linux-android/release/uplink" "uplink-aarch64-linux-android"
mv "target/armv7-linux-androideabi/release/uplink" "uplink-armv7-linux-androideabi"
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
files: uplink*