Skip to content

playdate-graphics: add draw_text_in_rect (#497) #975

playdate-graphics: add draw_text_in_rect (#497)

playdate-graphics: add draw_text_in_rect (#497) #975

Workflow file for this run

name: Tests
on:
workflow_call:
inputs:
ref:
description: git branch, tag or SHA to checkout.
type: string
required: true
sdk:
description: "Version of Playdate SDK"
default: latest
type: string
required: true
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
# RUST_LOG: trace
# CARGO_PLAYDATE_LOG: trace
jobs:
api-sys:
name: Api
uses: ./.github/workflows/tests-api.yml
secrets: inherit
with:
sdk: ${{ inputs.sdk || 'latest' }}
ref: ${{ inputs.ref || github.ref }}
docs:
name: Docs
uses: ./.github/workflows/tests-docs.yml
secrets: inherit
with:
ref: ${{ inputs.ref || github.ref }}
api:
name: Api (${{ matrix.os.name }})
env:
FEATURES_1: ""
FEATURES_2: bindings-derive-debug
FEATURES_3: bindings-derive-debug,sys/bindings-documentation,sys/error-ctx
BUILD_STD_ARGS: -Zbuild-std=core,alloc --target=thumbv7em-none-eabihf
CRATES: >-
-p=playdate-color
-p=playdate-controls
-p=playdate-display
-p=playdate-fs
-p=playdate-graphics
-p=playdate-menu
-p=playdate-scoreboards
-p=playdate-sound
-p=playdate-sprite
-p=playdate-system
-p=playdate
defaults:
run:
shell: bash
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
- { name: win, key: windows-latest }
- { name: linux, key: ubuntu-latest }
sdk:
- ${{ inputs.sdk || 'latest' }}
# - 2.6.2
steps:
- run: arch
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Install bindgen
if: matrix.sdk == 'beta'
uses: ./.github/actions/install-bindgen
- name: Install SDK (${{ matrix.sdk }})
uses: ./.github/actions/install-sdk
with:
version: ${{ matrix.sdk }}
mac: ${{ secrets.SDK_BETA_MACOS }}
win: ${{ secrets.SDK_BETA_WINDOWS }}
linux: ${{ secrets.SDK_BETA_LINUX }}
- name: Test Crates (host)
run: |
cargo test ${{ env.CRATES }} --lib --no-default-features --features=$FEATURES_1
cargo test ${{ env.CRATES }} --lib --no-default-features --features=$FEATURES_2
# cargo test ${{ env.CRATES }} --lib --no-default-features --features=$FEATURES_3
- name: Check Crates (device)
run: cargo check ${{ env.CRATES }} --target=thumbv7em-none-eabihf
- name: Build Crates (device)
run: |
cargo build ${{ env.CRATES }} --features=sys/lang-items,$FEATURES_1 ${{ env.BUILD_STD_ARGS }} --examples --lib
cargo build ${{ env.CRATES }} --features=sys/lang-items,$FEATURES_2 ${{ env.BUILD_STD_ARGS }} --examples --lib
cargo build ${{ env.CRATES }} --features=sys/lang-items,$FEATURES_3 ${{ env.BUILD_STD_ARGS }} --examples --lib
utils:
name: Utils (${{ matrix.os.name }})
defaults:
run:
shell: bash
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
- { name: win, key: windows-latest }
- { name: linux, key: ubuntu-latest }
sdk:
- ${{ inputs.sdk || 'latest' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Rustup warmup
if: runner.os == 'Windows'
run: rustup show &
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: Install SDK (${{ matrix.sdk }})
uses: ./.github/actions/install-sdk
with:
version: ${{ matrix.sdk }}
mac: ${{ secrets.SDK_BETA_MACOS }}
win: ${{ secrets.SDK_BETA_WINDOWS }}
linux: ${{ secrets.SDK_BETA_LINUX }}
- name: Test
run: |
cargo test --locked -p=playdate-build-utils --all-features
cargo test --locked -p=playdate-build --no-default-features
cargo test --locked -p=playdate-build --all-features
cargo test --locked -p=playdate-device
cargo test --locked -p=playdate-tool --all-features
cargo test -p=playdate-bindgen-cfg --all-features
cargo test -p=playdate-bindgen --features=cli,runtime
tool:
name: Tool (${{ matrix.os.name }})
defaults:
run:
shell: bash
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
- { name: win, key: windows-latest }
- { name: linux, key: ubuntu-latest }
sdk:
- ${{ inputs.sdk || 'latest' }}
# - 2.6.2
# - beta
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Rustup warmup
if: runner.os == 'Windows'
run: rustup show &
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: Install SDK (${{ matrix.sdk }})
uses: ./.github/actions/install-sdk
with:
version: ${{ matrix.sdk }}
mac: ${{ secrets.SDK_BETA_MACOS }}
win: ${{ secrets.SDK_BETA_WINDOWS }}
linux: ${{ secrets.SDK_BETA_LINUX }}
- name: Test
run: cargo test --locked -p=cargo-playdate
- name: Clean tmp
run: rm -rf ./target/tmp
tool-init:
name: "Tool: Init (${{ matrix.os.name }})"
defaults:
run:
shell: bash
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
- { name: win, key: windows-latest }
- { name: linux, key: ubuntu-latest }
sdk:
- ${{ inputs.sdk || 'latest' }}
# - 2.6.2
# - beta
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Rustup warmup
if: runner.os == 'Windows'
run: rustup show &
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: Install SDK (${{ matrix.sdk }})
uses: ./.github/actions/install-sdk
with:
version: ${{ matrix.sdk }}
mac: ${{ secrets.SDK_BETA_MACOS }}
win: ${{ secrets.SDK_BETA_WINDOWS }}
linux: ${{ secrets.SDK_BETA_LINUX }}
- name: Test
env:
RUSTFLAGS: --cfg init_tests
run: |
cargo test --locked -p=cargo-playdate init:: -- ${{ runner.os == 'Windows' && '--test-threads=1' || '' }}
- name: Clean tmp
run: rm -rf ./target/tmp
tool-execution:
name: "Tool: Run (${{ matrix.os.name }})"
defaults:
run:
shell: bash
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
# - { name: win, key: windows-latest } # Disabled due to issue #487
# - { name: linux, key: ubuntu-latest } # sim doesn't work
sdk:
- ${{ inputs.sdk || 'latest' }}
# - 2.6.2
# - beta
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Rustup warmup
if: runner.os == 'Windows'
run: rustup show &
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: Install SDK (${{ matrix.sdk }})
uses: ./.github/actions/install-sdk
with:
version: ${{ matrix.sdk }}
mac: ${{ secrets.SDK_BETA_MACOS }}
win: ${{ secrets.SDK_BETA_WINDOWS }}
linux: ${{ secrets.SDK_BETA_LINUX }}
- name: Clean tmp
run: rm -rf ./target/tmp
- name: Test Execution
env:
# RUST_LOG: trace
# CARGO_PLAYDATE_LOG: trace
RUSTFLAGS: --cfg exec_tests
run: |
cargo test --locked -p=cargo-playdate run:: -- --nocapture --test-threads=1
sudo killall "Playdate Simulator" || true
rm -rf ./target/tmp
- name: kill proc
shell: powershell
if: runner.os == 'Windows'
run: Stop-Process -Name "PlaydateSimulator" -Force -ErrorAction SilentlyContinue
tool-package:
name: "Tool: Package (${{ matrix.os.name }})"
defaults:
run:
shell: bash
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
- { name: win, key: windows-latest }
- { name: linux, key: ubuntu-latest }
sdk:
- ${{ inputs.sdk || 'latest' }}
# - 2.6.2
# - beta
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-examples-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-examples-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Clean
run: |
rm -rf ./target/tmp || true
rm -rf ./target/playdate || true
cargo clean
- name: Rustup warmup
if: runner.os == 'Windows'
run: rustup show &
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: Install SDK (${{ matrix.sdk }})
uses: ./.github/actions/install-sdk
with:
version: ${{ matrix.sdk }}
mac: ${{ secrets.SDK_BETA_MACOS }}
win: ${{ secrets.SDK_BETA_WINDOWS }}
linux: ${{ secrets.SDK_BETA_LINUX }}
- name: Install cargo-playdate
run: cargo install --path=./cargo --debug --locked
# Run `cargo playdate package` without bindgen-features and without the tool:
- name: Examples
env:
IGNORE_EXISTING_PLAYDATE_SDK: 1
FEATURES: lang-items,entry-point,bindings-derive-debug
FEATURES_DEP: sys/lang-items,sys/entry-point,sys/bindings-derive-debug
run: |
cargo playdate package --features=lang-items,bindings-derive-debug --examples --device --simulator -p=playdate-sys --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-color --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-controls --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-display --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-fs --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-graphics --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-menu --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-scoreboards --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-sound --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-sprite --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-system --no-default-features
cargo playdate package --features=$FEATURES_DEP --examples --device --simulator -p=playdate-lua --no-default-features
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate --no-default-features
format:
name: Format
defaults:
run:
shell: bash
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
permissions:
actions: read
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Check
id: check-rs
continue-on-error: true # do not failt before suggestions
run: cargo fmt --all -- --check
- name: Format (rs)
id: format
if: steps.check-rs.outcome == 'failure'
run: |
cargo fmt --all
cargo fmt --all
# ^ second run needed as anti-flickering workaround for rustfmt issue:
# https://github.com/rust-lang/rustfmt/issues/6240
# Needed as anti-flicker, see above.
# In any normal case should not fail because everything formatted properly at prev step.
- name: Check (rs again)
id: check-rs-success
continue-on-error: true
run: cargo fmt --all -- --check
- name: Install Taplo
uses: uncenter/setup-taplo@v1.0.8
with:
version: "0.9.3"
- name: Format (toml)
id: check-toml
continue-on-error: true # do not failt before suggestions
run: taplo fmt "**/*.toml" --check
- name: Format (toml)
if: steps.check-toml.outcome == 'failure'
run: taplo fmt "**/*.toml"
- name: Suggestions
continue-on-error: true
uses: reviewdog/action-suggester@v1
with:
filter_mode: diff_context
fail_level: none
tool_name: Format
cleanup: false
- name: Fail (rs)
if: steps.check-rs.outcome == 'failure' && steps.check-rs-success.outcome != 'failure'
run: echo "::error::Rust format error." && exit 1
- name: Fail (toml)
if: steps.check-toml.outcome == 'failure'
run: echo "::error::Toml format error." && exit 1
clippy: # with fmt suggestions needed after clippy fix.
name: Clippy (${{ matrix.os.name }})
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
defaults:
run:
shell: bash
permissions:
contents: read
checks: write
issues: write
pull-requests: write
runs-on: ${{ matrix.os.key }}
strategy:
fail-fast: false
matrix:
os:
- { name: mac, key: macos-14 }
- { name: win, key: windows-latest }
- { name: linux, key: ubuntu-latest }
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Install Clippy
run: rustup component add clippy
- name: Cache
uses: actions/cache@v4
with:
path: |
target/
~/.cargo
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Config
uses: ./.github/actions/init-cfg
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: Cargo & Support
id: clippy
continue-on-error: true
run: >-
cargo clippy --fix --allow-dirty
-p=cargo-playdate
-p=playdate-bindgen
-p=playdate-bindgen-cfg
-p=playdate-build
-p=playdate-device
-p=playdate-simulator-utils
-p=playdate-build-utils
-p=playdate-tool
--bins --examples --all-targets
-- -Aclippy::cargo
# needed after clippy fix
- name: fmt
run: |
cargo fmt --all
cargo fmt --all
# ^ second run needed as anti-flickering workaround for rustfmt issue:
# https://github.com/rust-lang/rustfmt/issues/6240
- name: remove config
run: rm -rf .cargo
- name: Suggestions
continue-on-error: true
uses: reviewdog/action-suggester@v1
with:
filter_mode: diff_context
fail_level: none
tool_name: Clippy & fmt
cleanup: false
semver:
name: Semver
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check
env:
DOCS_RS: 1
PLAYDATE_SDK_PATH: 0
IGNORE_EXISTING_PLAYDATE_SDK: 1
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
feature-group: default-features
rust-toolchain: manual
bumped:
name: Consistency
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check
id: crates
uses: katyo/publish-crates@v2
with:
dry-run: true
- name: Output
if: fromJSON(steps.crates.outputs.published).*
run: |
LIST="${{ join(fromJSON(steps.crates.outputs.published).*.name, ', ') }}"
echo "crates: $LIST"