Update dependencies #773
Workflow file for this run
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: | |
workflow_call: | |
inputs: | |
ref: | |
description: git branch, tag or SHA to checkout. | |
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 | |
# logging: | |
RUST_LOG: trace | |
CARGO_PLAYDATE_LOG: trace | |
# crates lists: | |
API_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 | |
PD_BUILD_BINDINGS_ONCE: 1 | |
jobs: | |
api: | |
name: API | |
env: | |
FEATURES_1: bindgen-runtime | |
FEATURES_2: bindgen-runtime,bindings-derive-debug | |
FEATURES_3: bindgen-runtime,bindings-derive-debug,sys/bindings-documentation,sys/error-ctx | |
BUILD_STD_ARGS: -Zbuild-std=core,alloc --target=thumbv7em-none-eabihf | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
sdk: | |
- latest | |
- 2.5.0 | |
# - beta | |
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 | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Install Deps | |
uses: ./.github/actions/tools-deps | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
id: sdk | |
uses: pd-rs/get-playdate-sdk@main | |
with: | |
version: ${{ matrix.sdk }} | |
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }} | |
- name: SDK ${{ steps.sdk.outputs.version }} installed | |
run: which pdc && pdc --version | |
# - name: Install Bindgen | |
# # id: pdbindgen | |
# # continue-on-error: true | |
# if: runner.os == 'Windows' | |
# env: | |
# # LLVM_CONFIG_PATH: ${{ env.LLVM_PATH }}\\bin\\llvm-config | |
# LIBCLANG_PATH: ${{ env.LLVM_PATH }}\\bin | |
# run: >- | |
# cargo install playdate-bindgen --path ./support/bindgen | |
# --features=cli | |
# --debug | |
# # --features=cli,static --no-default-features | |
- name: Test Sys (host) | |
run: | | |
cargo test -p=playdate-sys --features=lang-items -- --nocapture | |
cargo test -p=playdate-sys --features=lang-items,$FEATURES_1 | |
cargo test -p=playdate-sys --features=lang-items,$FEATURES_2 | |
- name: Build Sys (device) | |
# env: | |
## add env if step.pdbindgen.failed | |
# DOCS_RS: ${{ runner.os == 'Windows' && 1 || 0 }} | |
# IGNORE_EXISTING_PLAYDATE_SDK: ${{ runner.os == 'Windows' && 1 || 0 }} | |
run: | | |
cargo build -p=playdate-sys ${{ env.BUILD_STD_ARGS }} | |
cargo build -p=playdate-sys --features=lang-items,$FEATURES_1 ${{ env.BUILD_STD_ARGS }} --examples | |
cargo build -p=playdate-sys --features=lang-items,$FEATURES_2 ${{ env.BUILD_STD_ARGS }} --examples | |
- name: Test Crates (host) | |
run: | | |
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 | |
# cargo test ${{ env.API_CRATES }} --lib --no-default-features --features=$FEATURES_3 | |
- name: Check Crates (device) | |
run: cargo check ${{ env.API_CRATES }} --target=thumbv7em-none-eabihf | |
- name: Build Crates (device) | |
run: | | |
cargo build ${{ env.API_CRATES }} --features=sys/lang-items,$FEATURES_1 ${{ env.BUILD_STD_ARGS }} --examples --lib | |
cargo build ${{ env.API_CRATES }} --features=sys/lang-items,$FEATURES_2 ${{ env.BUILD_STD_ARGS }} --examples --lib | |
cargo build ${{ env.API_CRATES }} --features=sys/lang-items,$FEATURES_3 ${{ env.BUILD_STD_ARGS }} --examples --lib | |
# 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 --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 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
sdk: | |
- latest | |
# - 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 | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Install Deps | |
uses: ./.github/actions/tools-deps | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
id: sdk | |
uses: pd-rs/get-playdate-sdk@main | |
with: | |
version: ${{ matrix.sdk }} | |
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }} | |
- 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 --no-default-features -- --nocapture | |
cargo test -p=playdate-build --all-features -- --nocapture | |
cargo test -p=playdate-device | |
cargo test -p=playdate-tool --all-features | |
tool: | |
name: Tool | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
sdk: | |
- latest | |
- 2.5.0 | |
# - 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 | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Install Deps | |
uses: ./.github/actions/tools-deps | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
id: sdk | |
uses: pd-rs/get-playdate-sdk@main | |
with: | |
version: ${{ matrix.sdk }} | |
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }} | |
- name: SDK ${{ steps.sdk.outputs.version }} installed | |
run: which pdc && pdc --version | |
- name: Test | |
run: cargo test -p=cargo-playdate -- --nocapture | |
- name: Clean tmp | |
run: rm -rf ./target/tmp | |
tool-init: | |
name: 'Tool: Init' | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
sdk: | |
- latest | |
- 2.5.0 | |
# - 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 | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Install Deps | |
uses: ./.github/actions/tools-deps | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
id: sdk | |
uses: pd-rs/get-playdate-sdk@main | |
with: | |
version: ${{ matrix.sdk }} | |
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }} | |
- name: SDK ${{ steps.sdk.outputs.version }} installed | |
run: which pdc && pdc --version | |
- name: Test | |
env: | |
RUSTFLAGS: --cfg init_tests | |
run: | | |
cargo test -p=cargo-playdate init:: -- --nocapture ${{ runner.os == 'Windows' && '--test-threads=1' || '' }} | |
- name: Clean tmp | |
run: rm -rf ./target/tmp | |
tool-execution: | |
# This tests are flickering on GH CI 🤷🏻♂️ | |
if: contains(github.event.head_commit.message, 'test execution') | |
name: 'Tool: Run' | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
sdk: | |
- latest | |
- 2.5.0 | |
# - 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 | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- name: Install Deps | |
uses: ./.github/actions/tools-deps | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
id: sdk | |
uses: pd-rs/get-playdate-sdk@main | |
with: | |
version: ${{ matrix.sdk }} | |
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }} | |
- name: SDK ${{ steps.sdk.outputs.version }} installed | |
run: which pdc && pdc --version | |
# 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: Clean tmp | |
run: rm -rf ./target/tmp | |
- name: Test Execution | |
env: | |
RUSTFLAGS: --cfg exec_tests | |
run: | | |
cargo test -p=cargo-playdate run:: -- --nocapture --test-threads=1 | |
sudo killall "Playdate Simulator" || true | |
rm -rf ./target/tmp | |
tool-package: | |
name: 'Tool: Package' | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
sdk: | |
- latest | |
- 2.5.0 | |
# - 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 | |
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: Install Deps | |
uses: ./.github/actions/tools-deps | |
- name: Install Playdate SDK ${{ matrix.sdk }} | |
id: sdk | |
uses: pd-rs/get-playdate-sdk@main | |
with: | |
version: ${{ matrix.sdk }} | |
custom-url: ${{ matrix.sdk == 'beta' && ((runner.os == 'macOS' && secrets.SDK_BETA_MACOS) || (runner.os == 'Linux' && secrets.SDK_BETA_LINUX) || (runner.os == 'Windows' && secrets.SDK_BETA_WINDOWS)) || '' }} | |
- name: SDK ${{ steps.sdk.outputs.version }} installed | |
run: which pdc && pdc --version | |
- name: Install | |
run: cargo install --path=./cargo --debug | |
- name: Examples | |
run: | | |
FEATURES=sys/lang-items,sys/entry-point | |
cargo playdate package --features=lang-items --examples --device --simulator -p=playdate-sys | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-color | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-controls | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-display | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-fs | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-graphics | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-menu | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-scoreboards | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-sound | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-sprite | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-system | |
cargo playdate package --features=$FEATURES --examples --device --simulator -p=playdate-lua | |
cargo playdate package --features=lang-items,entry-point --examples --device --simulator -p=playdate | |
# TODO: build crankstart with examples for compatibility test | |
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 | |
continue-on-error: true | |
run: >- | |
cargo fmt --all -- --check || | |
(echo "::error::Rust format error." && exit 1) | |
- name: Format | |
id: format | |
if: steps.check.outcome == 'failure' | |
run: cargo fmt --all | |
- name: Suggestions | |
uses: reviewdog/action-suggester@v1 | |
with: | |
filter_mode: diff_context | |
fail_on_error: false | |
tool_name: Rustfmt | |
cleanup: false | |
- name: Post Check | |
if: steps.check.outcome == 'failure' | |
run: exit 1 | |
clippy: | |
name: Clippy | |
if: github.event_name == 'pull_request' | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
checks: write | |
issues: write | |
pull-requests: write | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-14 | |
- ubuntu-latest | |
- windows-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref || github.ref }} | |
# fetch-depth: 2 | |
- 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 | |
run: | | |
mkdir -p .cargo | |
cp -rf .github/config.toml .cargo/config.toml | |
- 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 | |
|| (echo "::error::Rust format error." && exit 1) | |
# needed after clippy fix | |
- name: fmt | |
run: cargo fmt --all | |
- name: remove config | |
run: rm -rf .cargo | |
- name: Suggestions | |
uses: reviewdog/action-suggester@v1 | |
continue-on-error: ${{ runner.os == 'Windows' }} # sometimes reviewdog fails on windows | |
with: | |
filter_mode: diff_context | |
fail_on_error: false | |
tool_name: Clippy | |
cleanup: false | |