-
Notifications
You must be signed in to change notification settings - Fork 1.8k
136 lines (119 loc) · 3.27 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Lint
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
actions: write
contents: read
pull-requests: read
jobs:
determine_jobs:
name: Determine jobs to run
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: CI related changes
id: ci
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
.github/actions/**
.github/workflows/lint.yml
- name: Rust related changes
id: rust
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
pnpm-lock.yaml
package.json
Cargo.**
crates/**
shim/**
xtask/**
.cargo/**
rust-toolchain
!**.md
!**.mdx
- name: Formatting related changes
id: format
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.{yml,yaml,md,mdx,js,jsx,ts,tsx,json,toml,css}
outputs:
rust: ${{ steps.ci.outputs.diff != '' || steps.rust.outputs.diff != '' }}
format: ${{ steps.ci.outputs.diff != '' || steps.format.outputs.diff != '' }}
rust_lint:
needs: [determine_jobs]
if: needs.determine_jobs.outputs.rust == 'true'
name: Rust lints
runs-on:
- "self-hosted"
- "linux"
- "x64"
- "metal"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Run cargo fmt check
run: |
cargo fmt --check
- name: Check Cargo.toml formatting (taplo)
run: npx @taplo/[email protected] format --check
- name: Check licenses
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check licenses
format_lint:
name: Formatting
runs-on:
- "self-hosted"
- "linux"
- "x64"
- "metal"
needs: determine_jobs
if: needs.determine_jobs.outputs.format == 'true'
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Setup Node"
uses: ./.github/actions/setup-node
with:
extra-flags: --no-optional
node-version: "20"
- name: Install Global Turbo
uses: ./.github/actions/install-global-turbo
- name: Lint
# Filters some packages out, but not sure why
run: |
turbo run lint \
--filter=!@vercel/devlow-bench \
--filter=!@vercel/experimental-nft-next-plugin \
--filter=!@vercel/experimental-nft-next-plugin \
--filter=!turbopack-bump-action \
--filter=!next-integration-stat \
--env-mode=strict
cleanup:
name: Cleanup
needs:
- rust_lint
- format_lint
if: always()
uses: ./.github/workflows/pr-clean-caches.yml
secrets: inherit