Skip to content

Add sprite api

Add sprite api #176

Workflow file for this run

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
# crates lists:
API_CRATES: >-
-p=playdate-sys
-p=playdate-fs
-p=playdate-sound
-p=playdate-color
-p=playdate-controls
-p=playdate-menu
-p=playdate-graphics
-p=playdate-display
-p=playdate-system
-p=playdate-sprite
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: actions/cache@v3
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Cache LLVM
id: cache-llvm
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/llvm
key: llvm-14.0
# See:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: runner.os == 'Windows'
uses: KyleMayes/install-llvm-action@v1.8.3
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
env: true
- 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 ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_2 -- --nocapture
- name: Check device target
run: |
# should we check with -Zbuild-std ?
cargo check ${{ env.API_CRATES }} --target=thumbv7em-none-eabihf
- name: Examples
run: |
FEATURES=bindgen-runtime,bindings-derive-debug
# TODO: use ${{ env.API_CRATES }} when all crates will have example
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
utils:
name: Utils
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: actions/cache@v3
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Install Deps
if: runner.os == 'Windows'
run: |
# mingw-w64-x86_64-libusb
choco install pkgconfiglite
pkg-config --cflags --libs libusb-1.0
pkg-config --cflags --libs libusb
- 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
run: |
cargo test -p=playdate-build-utils --all-features
cargo test -p=playdate-build --all-features
cargo test -p=playdate-tool --all-features
tool:
name: Tool
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: actions/cache@v3
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
- name: Config
run: |
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
- name: Cache LLVM
id: cache-llvm
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/llvm
key: llvm-14.0
# See:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: runner.os == 'Windows'
uses: KyleMayes/install-llvm-action@v1.8.3
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
env: true
- name: Install Deps
if: runner.os == 'Windows'
run: |
# mingw-w64-x86_64-libusb
choco install pkgconfiglite
pkg-config --cflags --libs libusb-1.0
pkg-config --cflags --libs libusb
- 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
# Simulator doesn't works in headless mode
# - name: Install Sim Deps
# if: ${{ runner.os == 'Linux' }}
# run: |
# sudo apt update
# sudo apt -y install libwebkit2gtk-4.0-dev
- name: Test
run: |
cargo test -p=cargo-playdate -- --nocapture
rm -rf ./target/tmp
- name: Execution
if: runner.os == 'macOS'
continue-on-error: true # this is flickering on CI 🤷🏻‍♂️
env:
RUSTFLAGS: --cfg exec_tests
run: |
cargo test -p=cargo-playdate run -- --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: actions/cache@v3
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo-tests-examples-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-tests-examples-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
- name: Config
run: |
rm -rf ./target/tmp || true
rm -rf ./target/playdate || true
mkdir -p .cargo
cp -rf .github/config.toml .cargo/config.toml
cargo clean
- name: Cache LLVM
id: cache-llvm
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/llvm
key: llvm-14.0
# See:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: runner.os == 'Windows'
uses: KyleMayes/install-llvm-action@v1.8.3
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
env: true
- 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
# TODO: use ${{ env.API_CRATES }} when all crates will have example
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' || github.event_name == 'pull_request_target' }}
uses: clechasseur/rs-fmt-check@v2
with:
toolchain: nightly
- name: Check
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
run: cargo fmt -- --check