Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add rustfmt suggestions for pr-review #7

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 66 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ env:

jobs:
api:
name: API
defaults:
run:
shell: bash

needs: format
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -32,9 +33,10 @@ jobs:
- latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v1
uses: Swatinem/[email protected]
with: { shared-key: "tests" }

- name: Config
run: |
Expand Down Expand Up @@ -97,10 +99,11 @@ jobs:
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
Expand All @@ -113,9 +116,10 @@ jobs:
- latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v1
uses: Swatinem/[email protected]
with: { shared-key: "tests" }

- name: Config
run: |
Expand Down Expand Up @@ -145,31 +149,79 @@ jobs:
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/[email protected]
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
cargo playdate package --simulator --device -p=playdate-fs --examples
cargo playdate package --simulator --device -p=playdate-controls --examples
cargo playdate package --simulator --device -p=playdate-color --examples
cargo playdate package --simulator --device -p=playdate-sound --examples
cargo playdate package --simulator --device -p=playdate-menu --examples
cargo playdate package --simulator --device -p=playdate-graphics --examples
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@v3
- 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