-
-
Notifications
You must be signed in to change notification settings - Fork 8
227 lines (188 loc) · 7.28 KB
/
tests.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
219
220
221
222
223
224
225
226
227
name: Tests
on:
pull_request:
push:
branches: [main, master]
env:
CARGO_INCREMENTAL: 1
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
CARGO_TERM_COLOR: always
CARGO_TERM_PROGRESS_WHEN: never
# logging:
RUST_LOG: trace
CARGO_PLAYDATE_LOG: trace
jobs:
api:
name: API
defaults:
run:
shell: bash
needs: format
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest
sdk:
- latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v2.6.2
with: { shared-key: "tests" }
- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Playdate SDK ${{ matrix.sdk }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
with:
version: ${{ matrix.sdk }}
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version
- name: Test Crates
run: |
FEATURES_1=bindgen-runtime
FEATURES_2=bindgen-runtime,bindings-derive-debug,bindings-documentation,error-ctx
cargo test -p=playdate-sys --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-sys --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-fs --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-fs --lib --no-default-features --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-sound --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-sound --lib --no-default-features --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-color --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-color --lib --no-default-features --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-controls --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-controls --lib --no-default-features --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-menu --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-menu --lib --no-default-features --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-graphics --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-graphics --lib --no-default-features --features=$FEATURES_2 -- --nocapture
- name: Examples
run: |
FEATURES=bindgen-runtime,bindings-derive-debug
cargo build --target=thumbv7em-none-eabihf -p=playdate-fs --examples --features=$FEATURES -Zbuild-std
cargo build --target=thumbv7em-none-eabihf -p=playdate-controls --examples --features=$FEATURES -Zbuild-std
cargo build --target=thumbv7em-none-eabihf -p=playdate-color --examples --features=$FEATURES -Zbuild-std
cargo build --target=thumbv7em-none-eabihf -p=playdate-sound --examples --features=$FEATURES -Zbuild-std
cargo build --target=thumbv7em-none-eabihf -p=playdate-menu --examples --features=$FEATURES -Zbuild-std
cargo build --target=thumbv7em-none-eabihf -p=playdate-graphics --examples --features=$FEATURES -Zbuild-std
# Imitate docs.rs environment
- name: Test in no-sdk environment
env:
DOCS_RS: 1
PLAYDATE_SDK_PATH: 0
IGNORE_EXISTING_PLAYDATE_SDK: 1
run: |
cargo doc -p=playdate-sys -v --target=thumbv7em-none-eabihf --features=bindings-documentation,bindings-derive-default,bindings-derive-eq,bindings-derive-copy,bindings-derive-debug,bindings-derive-hash,bindings-derive-ord,bindings-derive-partialeq,bindings-derive-partialord
tools:
name: Tools
defaults:
run:
shell: bash
needs: format
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
# - ubuntu-latest
# - windows-latest
sdk:
- latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v2.6.2
with: { shared-key: "tests" }
- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Playdate SDK ${{ matrix.sdk }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
with:
version: ${{ matrix.sdk }}
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version
- name: Check
run: cargo check --tests -p=cargo-playdate --all-features
- name: Test Utils
run: |
cargo test -p=playdate-build-utils --all-features
cargo test -p=playdate-build --all-features
cargo test -p=playdate-tool --all-features
- name: Test
run: |
cargo test -p=cargo-playdate -- --nocapture --test-threads=1
rm -rf ./target/tmp
use-tool:
name: Examples
defaults:
run:
shell: bash
needs: format
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
# - ubuntu-latest
# - windows-latest
sdk:
- latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v2.6.2
with:
shared-key: "tests"
save-if: false
- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Playdate SDK ${{ matrix.sdk }}
id: sdk
uses: pd-rs/get-playdate-sdk@main
with:
version: ${{ matrix.sdk }}
- name: SDK ${{ steps.sdk.outputs.version }} installed
run: which pdc && pdc --version
- name: Install
run: cargo install --path=./cargo --debug
- name: Examples
run: |
FEATURES=bindgen-runtime,bindings-derive-debug
cargo playdate package --simulator --device -p=playdate-sys --examples --features=$FEATURES
cargo playdate package --simulator --device -p=playdate-fs --examples --features=$FEATURES
cargo playdate package --simulator --device -p=playdate-controls --examples --features=$FEATURES
cargo playdate package --simulator --device -p=playdate-color --examples --features=$FEATURES
cargo playdate package --simulator --device -p=playdate-sound --examples --features=$FEATURES
cargo playdate package --simulator --device -p=playdate-menu --examples --features=$FEATURES
cargo playdate package --simulator --device -p=playdate-graphics --examples --features=$FEATURES
# TODO: build crankstart with examples for compatibility test
format:
name: Format
defaults:
run:
shell: bash
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check
if: ${{ github.event_name == 'pull_request' }}
uses: clechasseur/rs-fmt-check@v2
with:
toolchain: nightly
- name: Check
if: ${{ github.event_name != 'pull_request' }}
run: cargo fmt -- --check