This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
179 lines (177 loc) · 5.54 KB
/
rust.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
name: build
on:
push:
tags:
- '*'
jobs:
preparation_projects:
name: Preparation Projects
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Git Submodule Update
run: |
git submodule sync --recursive
git submodule update --init --recursive
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Web Package Build
run: npm --prefix web/ install && npm --prefix web/ run build
- name: Create Web Artifact
uses: DuckSoft/[email protected]
with:
pathSource: web/dist/
pathTarget: web.7z
- name: Upload Web Artifact
uses: actions/upload-artifact@v3
with:
name: web-html
path: web.7z
retention-days: 1
build:
name: build for ${{ matrix.target }}
needs: preparation_projects
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: arm-unknown-linux-musleabi
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: arm-unknown-linux-musleabihf
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: mips-unknown-linux-gnu
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: mips-unknown-linux-musl
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: mipsel-unknown-linux-gnu
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: mipsel-unknown-linux-musl
file: tts-server
args: --best --lzma
use_upx: true
- os: ubuntu-latest
target: mips64-unknown-linux-gnuabi64
file: tts-server
args: --best --lzma
use_upx: false
- os: ubuntu-latest
target: mips64el-unknown-linux-gnuabi64
file: tts-server
args: --best --lzma
use_upx: false
- os: macos-latest
target: x86_64-apple-darwin
file: tts-server
args: --best
use_upx: true
- os: windows-latest
target: x86_64-pc-windows-msvc
file: tts-server.exe
args: -9
use_upx: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Git Submodule Update
run: |
git submodule sync --recursive
git submodule update --init --recursive
- name: Download Web Artifact
uses: actions/download-artifact@v3
with:
name: web-html
- name: extract Web Artifact
uses: DuckSoft/[email protected]
with:
pathSource: web.7z
pathTarget: ./
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install cross
run: cargo install --version 0.1.16 cross
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install llvm -y
- name: Build binary
run: cross build --release --target ${{ matrix.target }}
env:
RUST_BACKTRACE: 1
- name: LLVM Strip
if: matrix.os == 'ubuntu-latest'
continue-on-error: true
run: llvm-strip target/${{ matrix.target }}/release/${{ matrix.file }}
- name: MacOS Strip
if: matrix.os == 'macos-latest'
continue-on-error: true
run: strip target/${{ matrix.target }}/release/${{ matrix.file }}
- name: Compress binaries
uses: svenstaro/upx-action@v2
if: matrix.use_upx
with:
file: "target/${{ matrix.target }}/release/${{ matrix.file }}"
args: ${{ matrix.args }}
strip: false
- name: Upload archive
uses: actions/upload-artifact@v1
with:
name: tts-server-${{ matrix.target }}
path: "target/${{ matrix.target }}/release/${{ matrix.file }}"
- name: Zip Release
uses: TheDoctor0/[email protected]
with:
type: zip
filename: tts-server-${{ matrix.target }}.zip
directory: target/${{ matrix.target }}/release/
path: ${{ matrix.file }}
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/${{ matrix.target }}/release/tts-server-${{ matrix.target }}.zip
generate_release_notes: true
draft: true