Skip to content

Commit

Permalink
Merge pull request #77 from boozook/api/sprite
Browse files Browse the repository at this point in the history
Add sprite API
  • Loading branch information
boozook authored Sep 20, 2023
2 parents 435374b + 5dfd45a commit 1f1bc30
Show file tree
Hide file tree
Showing 26 changed files with 3,350 additions and 127 deletions.
6 changes: 2 additions & 4 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
api:
- any:
- "api/**/*.rs"
- "api/**/*.toml"
- "components/**/*.rs"
- "components/**/*.toml"
- "api/**"
- "components/**"

pre-built bindings:
- any:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- uses: actions/labeler@v4
with:
dot: false
sync-labels: true
sync-labels: false
139 changes: 100 additions & 39 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ env:
# 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:
Expand Down Expand Up @@ -50,7 +62,7 @@ jobs:
- name: Cache LLVM
id: cache-llvm
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/llvm
Expand All @@ -60,7 +72,7 @@ jobs:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
uses: KyleMayes/[email protected]
with:
version: "14.0"
Expand All @@ -85,34 +97,19 @@ jobs:
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 ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test ${{ env.API_CRATES }} --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
cargo test -p=playdate-display --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-display --lib --no-default-features --features=$FEATURES_2 -- --nocapture
cargo test -p=playdate-system --lib --no-default-features --features=$FEATURES_1 -- --nocapture
cargo test -p=playdate-system --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
Expand All @@ -129,8 +126,64 @@ jobs:
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
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
Expand Down Expand Up @@ -164,7 +217,7 @@ jobs:
- name: Cache LLVM
id: cache-llvm
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/llvm
Expand All @@ -174,7 +227,7 @@ jobs:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
uses: KyleMayes/[email protected]
with:
version: "14.0"
Expand All @@ -183,7 +236,7 @@ jobs:
env: true

- name: Install Deps
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
run: |
# mingw-w64-x86_64-libusb
choco install pkgconfiglite
Expand All @@ -202,15 +255,9 @@ jobs:
- 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
# Simulator doesn't works in headless mode
# - name: Install Sim Deps
# if: ${{ matrix.os == 'ubuntu-latest' }}
# if: ${{ runner.os == 'Linux' }}
# run: |
# sudo apt update
# sudo apt -y install libwebkit2gtk-4.0-dev
Expand All @@ -220,6 +267,15 @@ jobs:
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:
Expand All @@ -245,18 +301,22 @@ jobs:
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('Cargo.lock') }}
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: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ runner.temp }}/llvm
Expand All @@ -266,7 +326,7 @@ jobs:
# https://github.com/rust-lang/rust-bindgen/issues/1797
# https://rust-lang.github.io/rust-bindgen/requirements.html#windows
- name: Install LLVM
if: matrix.os == 'windows-latest'
if: runner.os == 'Windows'
uses: KyleMayes/[email protected]
with:
version: "14.0"
Expand All @@ -290,6 +350,7 @@ jobs:
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
Expand Down
Loading

0 comments on commit 1f1bc30

Please sign in to comment.