Skip to content

Commit

Permalink
CI: improvements (#7)
Browse files Browse the repository at this point in the history
* add rustfmt suggestions for pr-review

* other jobs requires format check

* CI speed up and improvements, upd deps
  • Loading branch information
boozook authored Sep 11, 2023
1 parent bc6205a commit 46b7c41
Showing 1 changed file with 66 additions and 14 deletions.
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/rust-cache@v2.6.2
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/rust-cache@v2.6.2
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/rust-cache@v2.6.2
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

0 comments on commit 46b7c41

Please sign in to comment.