-
Notifications
You must be signed in to change notification settings - Fork 7
217 lines (187 loc) · 7.08 KB
/
ci.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
# This clippys, docs, tests, builds.
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "full"
RUST_MIN_STACK: 8000000
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, macos-12, ubuntu-20.04]
# pkg: [festival-gui, festivald, festival-cli]
pkg: [festival-gui]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache
uses: actions/cache@v3
with:
path: target
key: ${{ matrix.pkg }}-${{ matrix.os }}
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y libgtk-3-dev libasound2-dev libjack-dev libpulse-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
rustup target add aarch64-apple-darwin
fi
shell: bash
- name: Rust Toolchain
if: matrix.os != 'macos-12'
uses: dtolnay/[email protected]
with:
components: clippy, rust-src
targets: aarch64-apple-darwin,
- name: Rust Toolchain (macOS)
if: matrix.os == 'macos-12'
uses: dtolnay/[email protected]
with:
components: clippy, rust-src
targets: aarch64-apple-darwin
- name: Clippy
run: cargo clippy --release --package ${{ matrix.pkg }}
- name: Test
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cargo test --release --package shukusai --package ${{ matrix.pkg }} --jobs 1
else
cargo test --release --package shukusai --package ${{ matrix.pkg }}
fi
- name: Build
shell: bash
run: |
# ARM builds.
if [ "$RUNNER_OS" == "macOS" ]; then
cargo build --release --package ${{ matrix.pkg }} --target aarch64-apple-darwin
fi
cargo build --release --package ${{ matrix.pkg }}
- name: Test (RPC)
if: matrix.pkg == 'festivald'
shell: bash
run: |
cargo test --release --package rpc
cargo test --release --package festival-cli -- --ignored
- name: Compress (GUI)
if: matrix.pkg == 'festival-gui'
shell: bash
run: |
mkdir OUTPUT
VERSION=$(grep -m1 "version" gui/Cargo.toml | grep -o "[0-9].[0-9].[0-9]")
DOCS=$(grep -m1 "title" gui/mdbook/book.toml | grep -o "[0-9].[0-9].[0-9]")
if [ "$VERSION" != "$DOCS" ]; then
echo "CARGO $VERSION != DOCS TITLE $DOCS"
exit 1
fi
if [ "$RUNNER_OS" == "Linux" ]; then
# AppImage
utils/mk_appimage.sh
mv utils/"Festival-v${VERSION}-x86_64.AppImage" OUTPUT/
# Tar
cp assets/images/icon/512.png target/release/festival.png
cp utils/Festival.AppDir/festival.desktop target/release/
cp LICENSE target/release/
cd target/release
tar -czpf "Festival-v${VERSION}-linux-x64.tar.gz" festival festival.png festival.desktop LICENSE
mv "Festival-v${VERSION}-linux-x64.tar.gz" ../../OUTPUT/
elif [ "$RUNNER_OS" == "macOS" ]; then
# x64
utils/mk_app.sh
utils/mk_dmg.sh "Festival-v${VERSION}-macos-x64"
mv utils/"Festival-v${VERSION}-macos-x64.dmg" OUTPUT/
# ARM64
mv target/aarch64-apple-darwin/release/festival target/release/
utils/mk_app.sh
utils/mk_dmg.sh "Festival-v${VERSION}-macos-arm64"
mv utils/"Festival-v${VERSION}-macos-arm64.dmg" OUTPUT/
elif [ "$RUNNER_OS" == "Windows" ]; then
# Zip
mv target/release/festival.exe target/release/Festival.exe
cd target/release
powershell Compress-Archive -LiteralPath Festival.exe -DestinationPath "Festival-v${VERSION}-windows-x64.zip"
mv "Festival-v${VERSION}-windows-x64.zip" ../../OUTPUT/
fi
- name: Compress (daemon)
if: matrix.pkg == 'festivald'
shell: bash
run: |
mkdir OUTPUT
VERSION="$(grep -m1 "version" daemon/Cargo.toml | grep -o "[0-9].[0-9].[0-9]")"
DOCS=$(grep -m1 "title" daemon/mdbook/book.toml | grep -o "[0-9].[0-9].[0-9]")
if [ "$VERSION" != "$DOCS" ]; then
echo "CARGO $VERSION != DOCS TITLE $DOCS"
exit 1
fi
cp LICENSE target/release/
if [ "$RUNNER_OS" == "Linux" ]; then
# Tar
cp daemon/config/festivald.service target/release/
cd target/release
tar -czpf "festivald-v${VERSION}-linux-x64.tar.gz" festivald LICENSE festivald.service
mv "festivald-v${VERSION}-linux-x64.tar.gz" ../../OUTPUT/
elif [ "$RUNNER_OS" == "macOS" ]; then
# x64
cd target/release
tar -czpf "festivald-v${VERSION}-macos-x64.tar.gz" festivald LICENSE
mv "festivald-v${VERSION}-macos-x64.tar.gz" ../../OUTPUT/
# ARM64
cd ../../
cd target/aarch64-apple-darwin/release/
cp ../../../LICENSE .
tar -czpf "festivald-v${VERSION}-macos-arm64.tar.gz" festivald LICENSE
mv "festivald-v${VERSION}-macos-arm64.tar.gz" ../../../OUTPUT/
elif [ "$RUNNER_OS" == "Windows" ]; then
# Zip
cd target/release/
powershell Compress-Archive -Path "festivald.exe","LICENSE" -DestinationPath "festivald-v${VERSION}-windows-x64.zip"
mv "festivald-v${VERSION}-windows-x64.zip" ../../OUTPUT/
fi
- name: Compress (cli)
if: matrix.pkg == 'festival-cli'
shell: bash
run: |
mkdir OUTPUT
VERSION="$(grep -m1 "version" cli/Cargo.toml | grep -o "[0-9].[0-9].[0-9]")"
DOCS=$(grep -m1 "title" cli/mdbook/book.toml | grep -o "[0-9].[0-9].[0-9]")
if [ "$VERSION" != "$DOCS" ]; then
echo "CARGO $VERSION != DOCS TITLE $DOCS"
exit 1
fi
cp LICENSE target/release/
if [ "$RUNNER_OS" == "Linux" ]; then
# Tar
cd target/release
tar -czpf "festival-cli-v${VERSION}-linux-x64.tar.gz" festival-cli LICENSE
mv "festival-cli-v${VERSION}-linux-x64.tar.gz" ../../OUTPUT/
elif [ "$RUNNER_OS" == "macOS" ]; then
# x64
cd target/release/
tar -czpf "festival-cli-v${VERSION}-macos-x64.tar.gz" festival-cli LICENSE
mv "festival-cli-v${VERSION}-macos-x64.tar.gz" ../../OUTPUT/
# ARM64
cd ../../
cd target/aarch64-apple-darwin/release/
cp ../../../LICENSE .
tar -czpf "festival-cli-v${VERSION}-macos-arm64.tar.gz" festival-cli LICENSE
mv "festival-cli-v${VERSION}-macos-arm64.tar.gz" ../../../OUTPUT/
elif [ "$RUNNER_OS" == "Windows" ]; then
# Zip
cd target/release
powershell Compress-Archive -Path "festival-cli.exe","LICENSE" -DestinationPath "festival-cli-v${VERSION}-windows-x64.zip"
mv "festival-cli-v${VERSION}-windows-x64.zip" ../../OUTPUT/
fi
- name: Archive
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.pkg }}-${{ matrix.os }}
path: OUTPUT