From 4aeef1961be2ed0b19ddf00d45517b9644d46563 Mon Sep 17 00:00:00 2001 From: Alexander Koz Date: Mon, 11 Sep 2023 16:10:17 +0400 Subject: [PATCH 1/2] add rustfmt suggestions for pr-review, other jobs requires format check --- .github/workflows/tests.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d592b108..3a518bc7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: defaults: run: shell: bash - + needs: format runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -32,7 +32,7 @@ jobs: - latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache uses: Swatinem/rust-cache@v1 @@ -100,7 +100,7 @@ jobs: defaults: run: shell: bash - + needs: format runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -113,7 +113,7 @@ jobs: - latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache uses: Swatinem/rust-cache@v1 @@ -170,6 +170,14 @@ jobs: 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 From febc0513aaf4e43fdbc0a905683fb8b78a743e48 Mon Sep 17 00:00:00 2001 From: Alexander Koz Date: Mon, 11 Sep 2023 16:43:23 +0400 Subject: [PATCH 2/2] CI speed up and improvements, upd deps --- .github/workflows/tests.yml | 62 +++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a518bc7..e297030b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,6 +16,7 @@ env: jobs: api: + name: API defaults: run: shell: bash @@ -34,7 +35,8 @@ jobs: steps: - 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: | @@ -97,6 +99,7 @@ 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 @@ -115,7 +118,8 @@ jobs: steps: - 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: | @@ -145,6 +149,45 @@ 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 @@ -152,17 +195,18 @@ jobs: 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