-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 1.92 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
name: Lint and Format
on: [pull_request, push]
jobs:
lint_python:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
wpiformat:
name: "wpiformat"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch main
run: |
git branch -f main origin/main
if: github.ref != 'refs/heads/main'
- uses: actions/setup-python@v5
with: { python-version: '3.11' }
- 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/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- run: bazel run --noenable_bzlmod @rules_wpiformat//wpiformat -- -f ..
working-directory: tests
if: github.ref != 'refs/heads/main'
- name: Check Output
run: git --no-pager diff --exit-code HEAD
buildifier:
name: "buildifier"
runs-on: ubuntu-22.04
steps:
- name: Set up Go 1.20.x
uses: actions/setup-go@v5
with:
go-version: 1.20.x
cache: false
id: go
- uses: actions/checkout@v4
- name: Install Buildifier
run: |
cd $(mktemp -d)
GO111MODULE=on go install github.com/bazelbuild/buildtools/buildifier@latest
- name: Run buildifier
run: buildifier -warnings all --lint=fix -r .
- 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() }}