-
Notifications
You must be signed in to change notification settings - Fork 4
218 lines (184 loc) · 7.49 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
name: Build
on:
pull_request:
branches: [master, main]
push:
branches: [master, main]
workflow_dispatch:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
linux_nix:
uses: SpiralP/github-reusable-workflows/.github/workflows/build.yml@main
windows:
name: Build Windows ${{ matrix.config.arch }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config:
- { arch: x86_64, bits: 64, target: x86_64-pc-windows-msvc }
- { arch: i686, bits: 32, target: i686-pc-windows-msvc }
steps:
- uses: actions/checkout@v4
- name: setup-msbuild
uses: microsoft/setup-msbuild@v2
- name: Install rust
run: |
rustup default stable
rustup component add rustfmt
rustup target add ${{ matrix.config.target }}
- name: Build
if: ${{ startsWith(github.ref, 'refs/tags/') != true }}
run: |
cargo build --target ${{ matrix.config.target }}
- name: Test
if: ${{ startsWith(github.ref, 'refs/tags/') != true }}
run: |
cargo test --target ${{ matrix.config.target }} -- --nocapture --test-threads 1
Move-Item `
-Path 'target\${{ matrix.config.target }}\debug\classicube_chatsounds_plugin.dll' `
-Destination '.\classicube_chatsounds_windows_${{ matrix.config.arch }}.dll'
- name: Build Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
cargo build --target ${{ matrix.config.target }} --release
Move-Item `
-Path 'target\${{ matrix.config.target }}\release\classicube_chatsounds_plugin.dll' `
-Destination '.\classicube_chatsounds_windows_${{ matrix.config.arch }}.dll'
- uses: actions/upload-artifact@v4
with:
name: classicube_chatsounds_windows_${{ matrix.config.arch }}
path: classicube_chatsounds_windows_${{ matrix.config.arch }}.dll
- name: VirusTotal Scan
uses: crazy-max/ghaction-virustotal@v4
if: ${{ startsWith(github.ref, 'refs/tags/') }}
id: virustotal
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
files: |
classicube_chatsounds_windows_${{ matrix.config.arch }}.dll
- name: Generate Release Body Text
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
node .github\format-release.js '${{ steps.virustotal.outputs.analysis }}' > release_body_text.txt
- name: Upload Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: release_body_text.txt
files: |
classicube_chatsounds_windows_${{ matrix.config.arch }}.dll
linux:
name: Build Linux ${{ matrix.config.arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- { arch: x86_64, target: x86_64-unknown-linux-gnu }
# - { arch: i686, target: i686-unknown-linux-gnu }
steps:
- uses: actions/checkout@v4
- name: Install deps
run: |
sudo apt-get -y update
sudo apt-get -y install clang llvm
sudo apt-get -y install mesa-common-dev libopenal-dev libcurl4-openssl-dev libgl1-mesa-dev
sudo apt-get -y install libasound2-dev libpango1.0-dev libatk1.0-dev libgtk-3-dev libssl-dev openssl
- name: Install rust
run: |
rustup default stable
rustup component add rustfmt
rustup target add ${{ matrix.config.target }}
- name: Build
if: ${{ startsWith(github.ref, 'refs/tags/') != true }}
run: |
cargo build --target ${{ matrix.config.target }}
file 'target/${{ matrix.config.target }}/debug/libclassicube_chatsounds_plugin.so'
- name: Test
if: ${{ startsWith(github.ref, 'refs/tags/') != true }}
run: |
cargo test --target ${{ matrix.config.target }} -- --nocapture --test-threads 1
mv 'target/${{ matrix.config.target }}/debug/libclassicube_chatsounds_plugin.so' \
'./classicube_chatsounds_linux_${{ matrix.config.arch }}.so'
- name: Build Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
cargo build --target ${{ matrix.config.target }} --release
file 'target/${{ matrix.config.target }}/release/libclassicube_chatsounds_plugin.so'
mv 'target/${{ matrix.config.target }}/release/libclassicube_chatsounds_plugin.so' \
'./classicube_chatsounds_linux_${{ matrix.config.arch }}.so'
- uses: actions/upload-artifact@v4
with:
name: classicube_chatsounds_linux_${{ matrix.config.arch }}
path: classicube_chatsounds_linux_${{ matrix.config.arch }}.so
- name: Upload Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
classicube_chatsounds_linux_${{ matrix.config.arch }}.so
mac:
name: Build MacOS ${{ matrix.config.arch }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
config:
- { arch: x86_64, target: x86_64-apple-darwin }
steps:
- uses: actions/checkout@v4
- name: Install deps
run: |
brew install llvm
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
- name: Install rust
run: |
rustup default stable
rustup component add rustfmt
rustup target add ${{ matrix.config.target }}
- name: Build
if: ${{ startsWith(github.ref, 'refs/tags/') != true }}
run: |
cargo build --target ${{ matrix.config.target }}
file 'target/${{ matrix.config.target }}/debug/libclassicube_chatsounds_plugin.dylib'
- name: Test
if: ${{ startsWith(github.ref, 'refs/tags/') != true }}
run: |
cargo test --target ${{ matrix.config.target }} -- --nocapture --test-threads 1
mv 'target/${{ matrix.config.target }}/debug/libclassicube_chatsounds_plugin.dylib' \
'./classicube_chatsounds_macos_${{ matrix.config.arch }}.dylib'
- name: Build Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
cargo build --target ${{ matrix.config.target }} --release
file 'target/${{ matrix.config.target }}/release/libclassicube_chatsounds_plugin.dylib'
mv 'target/${{ matrix.config.target }}/release/libclassicube_chatsounds_plugin.dylib' \
'./classicube_chatsounds_macos_${{ matrix.config.arch }}.dylib'
- uses: actions/upload-artifact@v4
with:
name: classicube_chatsounds_macos_${{ matrix.config.arch }}
path: classicube_chatsounds_macos_${{ matrix.config.arch }}.dylib
- name: Upload Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: target/release/classicube_chatsounds_macos_amd64.dylib
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
classicube_chatsounds_macos_${{ matrix.config.arch }}.dylib