Skip to content

Commit 94ff0fd

Browse files
authored
Merge pull request #298 from boozook/ci/clippy-suggestions
CI: clippy check & suggestions for tools & utils
2 parents 1aac703 + 988910e commit 94ff0fd

File tree

5 files changed

+95
-12
lines changed

5 files changed

+95
-12
lines changed

.github/workflows/tests.yml

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
defaults:
4646
run:
4747
shell: bash
48-
needs: format
4948
runs-on: ${{ matrix.os }}
5049
strategy:
5150
fail-fast: false
@@ -150,7 +149,6 @@ jobs:
150149
defaults:
151150
run:
152151
shell: bash
153-
needs: format
154152
runs-on: ${{ matrix.os }}
155153
strategy:
156154
fail-fast: false
@@ -203,7 +201,6 @@ jobs:
203201
defaults:
204202
run:
205203
shell: bash
206-
needs: format
207204
runs-on: ${{ matrix.os }}
208205
strategy:
209206
fail-fast: false
@@ -285,7 +282,6 @@ jobs:
285282
defaults:
286283
run:
287284
shell: bash
288-
needs: format
289285
runs-on: ${{ matrix.os }}
290286
strategy:
291287
fail-fast: false
@@ -362,6 +358,7 @@ jobs:
362358
run:
363359
shell: bash
364360
runs-on: ubuntu-latest
361+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
365362
permissions:
366363
actions: read
367364
contents: read
@@ -381,12 +378,95 @@ jobs:
381378
382379
- name: Format
383380
id: format
384-
if: steps.check.outcome == 'failure' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
381+
if: steps.check.outcome == 'failure'
385382
run: cargo fmt --all
386383

387-
- name: Suggest Changes
384+
# - name: Suggestions
385+
# continue-on-error: true
386+
# uses: parkerbxyz/suggest-changes@v1.0.2
387+
# with: comment: Rustfmt suggested the formatting changes.
388+
389+
- name: Suggestions
390+
if: steps.check.outcome == 'failure'
391+
uses: reviewdog/action-suggester@v1
392+
with:
393+
filter_mode: diff_context
394+
fail_on_error: false
395+
tool_name: Rustfmt
396+
cleanup: false
397+
398+
- name: Post Check
399+
if: steps.check.outcome == 'failure'
400+
run: exit 1
401+
402+
clippy:
403+
name: Clippy
404+
if: github.event_name == 'pull_request'
405+
defaults:
406+
run:
407+
shell: bash
408+
permissions:
409+
contents: read
410+
checks: write
411+
issues: write
412+
pull-requests: write
413+
runs-on: ${{ matrix.os }}
414+
strategy:
415+
fail-fast: false
416+
matrix:
417+
os:
418+
- macos-14
419+
- ubuntu-latest
420+
- windows-latest
421+
continue-on-error: true
422+
steps:
423+
- uses: actions/checkout@v4
424+
# with: fetch-depth: 2
425+
426+
- name: Install Clippy
427+
run: rustup component add clippy
428+
429+
- name: Cache
430+
uses: actions/cache@v4
431+
with:
432+
path: |
433+
target/
434+
~/.cargo
435+
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('Cargo.lock') }}
436+
437+
- name: Config
438+
run: |
439+
mkdir -p .cargo
440+
cp -rf .github/config.toml .cargo/config.toml
441+
442+
- name: Install Deps
443+
uses: ./.github/actions/tools-deps
444+
445+
- name: Cargo & Support
446+
id: clippy
388447
continue-on-error: true
389-
if: success() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
390-
# https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
391-
uses: parkerbxyz/suggest-changes@v1.0.4
392-
# with: comment: Rustfmt suggested the formatting changes.
448+
run: >-
449+
cargo clippy --fix --allow-dirty
450+
-p=cargo-playdate
451+
-p=playdate-bindgen
452+
-p=playdate-bindgen-cfg
453+
-p=playdate-build
454+
-p=playdate-device
455+
-p=playdate-simulator-utils
456+
-p=playdate-build-utils
457+
-p=playdate-tool
458+
--bins --examples --all-targets
459+
-- -Aclippy::cargo
460+
|| (echo "::error::Rust format error." && exit 1)
461+
462+
- name: remove config
463+
run: rm -rf .cargo
464+
465+
- name: Suggestions
466+
uses: reviewdog/action-suggester@v1
467+
with:
468+
filter_mode: diff_context
469+
fail_on_error: false
470+
tool_name: Clippy
471+
cleanup: false
472+

.github/workflows/update.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,5 +295,7 @@ jobs:
295295
actions: read
296296
contents: read
297297
pull-requests: write
298+
checks: write
299+
issues: write
298300
with:
299301
ref: ${{ needs.new-branch.outputs.working }}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

support/bindgen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "playdate-bindgen"
3-
version = "0.1.8"
3+
version = "0.1.9"
44
readme = "README.md"
55
description = "Bindgen configuration for Playdate API and utils."
66
keywords = ["playdate", "bindings", "ffi", "code-generation"]

support/bindgen/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ fn create_builder(_target: &str, capi: &Path, header: &Path, derive: &cfg::Deriv
197197

198198
// ignore unused methods that drifting in bindgen result:
199199
.blocklist_function("vaFormatString")
200+
.blocklist_var("vaFormatString")
200201

201202
// experimental:
202203
.default_macro_constant_type(MacroTypeVariation::Unsigned)

0 commit comments

Comments
 (0)