-
Notifications
You must be signed in to change notification settings - Fork 7
146 lines (126 loc) · 4.28 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
# 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:
# Run format separately.
#
# This will fast-cancel other CI early if this fails.
#
# `cargo fmt` checks _all_ code, regardless of the OS
# or any `#[cfg]`'s, so this only needs to run on Linux.
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Format
# FIXME: There is no `--ignore` yet, so `external/` prevents using `--all`.
run: cargo fmt --check --package festival-gui --package shukusai
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
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 libfuse2
elif [ "$RUNNER_OS" == "macOS" ]; then
rustup target add aarch64-apple-darwin
fi
shell: bash
- name: Rust Toolchain
if: matrix.os != 'macos-latest'
uses: dtolnay/[email protected]
with:
components: clippy, rust-src
targets: aarch64-apple-darwin
- name: Rust Toolchain (macOS)
if: matrix.os == 'macos-latest'
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: Compress (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: Archive
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.pkg }}-${{ matrix.os }}
path: OUTPUT