45
45
defaults :
46
46
run :
47
47
shell : bash
48
- needs : format
49
48
runs-on : ${{ matrix.os }}
50
49
strategy :
51
50
fail-fast : false
@@ -150,7 +149,6 @@ jobs:
150
149
defaults :
151
150
run :
152
151
shell : bash
153
- needs : format
154
152
runs-on : ${{ matrix.os }}
155
153
strategy :
156
154
fail-fast : false
@@ -203,7 +201,6 @@ jobs:
203
201
defaults :
204
202
run :
205
203
shell : bash
206
- needs : format
207
204
runs-on : ${{ matrix.os }}
208
205
strategy :
209
206
fail-fast : false
@@ -285,7 +282,6 @@ jobs:
285
282
defaults :
286
283
run :
287
284
shell : bash
288
- needs : format
289
285
runs-on : ${{ matrix.os }}
290
286
strategy :
291
287
fail-fast : false
@@ -362,6 +358,7 @@ jobs:
362
358
run :
363
359
shell : bash
364
360
runs-on : ubuntu-latest
361
+ if : github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
365
362
permissions :
366
363
actions : read
367
364
contents : read
@@ -381,12 +378,95 @@ jobs:
381
378
382
379
- name : Format
383
380
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'
385
382
run : cargo fmt --all
386
383
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
388
447
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
+
0 commit comments