Merge pull request #27 from boozook/api/sys/pre-build #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |