-
Notifications
You must be signed in to change notification settings - Fork 7
199 lines (153 loc) · 5.25 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
linux-cargo-clippy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install libasound2-dev libgtk-3-dev
rustup target add wasm32-unknown-unknown
- name: Clippy All Features
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Clippy No Features
run: cargo clippy --workspace --all-targets --no-default-features -- -D warnings
- name: Clippy Wasm
run: cargo clippy --target wasm32-unknown-unknown -p gameroy-wasm --all-features -- -D warnings
linux-build-and-test:
runs-on: ubuntu-20.04
needs: linux-cargo-clippy
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install libasound2-dev libgtk-3-dev
- uses: robinraju/release-downloader@v1.5
with:
repository: "c-sp/gameboy-test-roms"
tag: "v5.1"
fileName: "game-boy-test-roms-v5.1.zip"
- name: Unzip test roms
run: unzip game-boy-test-roms-v5.1.zip -d core/tests/gameboy-test-roms/
- name: Run tests
run: cargo test --verbose --workspace
- uses: jetli/wasm-pack-action@v0.3.0
with:
# Optional version of wasm-pack to install(eg. 'v0.9.1', 'latest')
version: 'latest'
- name: Build Linux
run: >
cargo build --profile=fast --verbose -p gameroy-native
--target=x86_64-unknown-linux-gnu
--features=static
- name: Install cargo-about
run: cargo install cargo-about --version 0.6.6
- name: Cargo About
run: cargo about generate -m native/Cargo.toml -c license/about-linux.toml license/about.hbs -o license/license.html
- name: Form a Package
run: |
mkdir package
cp target/x86_64-unknown-linux-gnu/fast/gameroy-native package/gameroy.exe
cp license/license.html package/
cp gameroy.toml package/
- name: Archive Linux
uses: actions/upload-artifact@v3
with:
name: gameroy-x86_64-unknown-linux-gnu
path: package/
- name: Build Wasm
run: |
cd wasm
wasm-pack build --target web
cp ../license/license.html .
- name: Archive Web
uses: actions/upload-artifact@v3
with:
name: gameroy-wasm
path: |
wasm/index.html
wasm/license.html
wasm/pkg/gameroy_wasm_bg.wasm
wasm/pkg/gameroy_wasm.js
windows-build:
runs-on: windows-latest
needs: linux-cargo-clippy
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install cargo-about
run: cargo install cargo-about
- name: Build Windows
run: >
cargo build -p gameroy-native --profile=fast --verbose
--target=x86_64-pc-windows-msvc
--no-default-features --features=static,rfd,audio-engine,threads
- name: Cargo About
run: cargo about generate -m native\Cargo.toml -c license\about-windows.toml license\about.hbs -o license\license.html
- name: Form a Package
run: |
mkdir package
copy target\x86_64-pc-windows-msvc\fast\gameroy-native.exe package\gameroy.exe
copy license\license.html package\
copy gameroy.toml package\
- name: Archive Windows
uses: actions/upload-artifact@v3
with:
name: gameroy-x86_64-pc-windows-msvc
path: package/
android-build:
runs-on: ubuntu-latest
needs: linux-cargo-clippy
defaults:
run:
working-directory: ./android
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
cache: gradle
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install libasound2-dev libgtk-3-dev
- name: Install android targets
run: >-
rustup target install
aarch64-linux-android
armv7-linux-androideabi
i686-linux-android
x86_64-linux-android
- name: Install cargo-about
run: cargo install cargo-about
- name: Write Keystore.properties
env:
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
run: echo "$KEYSTORE_PROPERTIES" > keystore.properties
- name: Write keystore.jks
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}
run: echo $ENCODED_KEYSTORE | base64 -di > keystore.jks
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Android
run: ./gradlew assembleRelease
- name: Archive release APK
uses: actions/upload-artifact@v3
with:
name: gameroy-android
path: android/app/build/outputs/apk/release/app-release.apk