-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (113 loc) · 3.47 KB
/
lint_format.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
name: Lint and Format
on: [push, pull_request]
jobs:
wpiformat:
name: "wpiformat"
runs-on: ubuntu-latest
steps:
# Checkout
- uses: actions/checkout@v4
- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f master origin/master
# Setup dependencies
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- name: Install wpiformat
run: pip3 install wpiformat
- name: Run wpiformat
run: wpiformat -clang 14
# Check the diff
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > wpiformat-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v4
with:
name: wpiformat fixes
path: wpiformat-fixes.patch
if: ${{ failure() }}
buildifier:
name: "buildifier"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.15.x
uses: actions/setup-go@v5
with:
go-version: 1.15.x
id: go
- name: Install Buildifier
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/[email protected]
- name: Run buildifier
run: buildifier --lint=fix -r .
# Check the diff
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > buildifier-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v4
with:
name: buildifier fixes
path: buildifier-fixes.patch
if: ${{ failure() }}
spotless:
name: "spotless"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Run formatters
- name: Run Spotless
run: ./gradlew spotlessApply
# Check the diff
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > spotless-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v4
with:
name: spotless fixes
path: spotless-fixes.patch
if: ${{ failure() }}
unused_deps:
name: "unused deps"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.15.x
uses: actions/setup-go@v5
with:
go-version: 1.15.x
id: go
- name: Install Unused Deps
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/[email protected]
- name: Run unused deps
run: unused_deps //...
# Check the diff
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > unused-deps-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v4
with:
name: unused deps fixes
path: unused-deps-fixes.patch
if: ${{ failure() }}