-
Notifications
You must be signed in to change notification settings - Fork 7
181 lines (140 loc) · 4.44 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
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
linux-build-and-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Update apt
run: sudo apt update
- name: Install depencies
run: sudo apt-get install libasound2-dev libgtk-3-dev
- name: Install resvg
run: cargo install resvg
- name: Install cargo-about
run: cargo install cargo-about
- uses: robinraju/[email protected]
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/[email protected]
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: Cargo About
run: cargo about generate -m native/Cargo.toml -c license/about-linux.toml license/about.hbs > 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
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install resvg
run: cargo install resvg
- 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 > 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
defaults:
run:
working-directory: ./android
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Update apt
run: sudo apt update
- name: Install depencies
run: 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 resvg
run: cargo install resvg
- 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 build
- name: Archive release APK
uses: actions/upload-artifact@v3
with:
name: gameroy-android
path: android/app/build/outputs/apk/release/app-release.apk