forked from redpanda-data/redpanda
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (105 loc) · 3.24 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
# Copyright 2020 Redpanda Data, Inc.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.md
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0
name: Lint all codez
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
branches:
- '**'
jobs:
go:
name: Lint go files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: stable
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
args: --timeout 5m
working-directory: src/go/rpk/
- name: Install gofumpt
env:
GOFUMPT_VER: 0.5.0
run: |
mkdir -v -p "$HOME/.local/bin"
wget -O "$HOME/.local/bin/gofumpt" "https://github.com/mvdan/gofumpt/releases/download/v${GOFUMPT_VER}/gofumpt_v${GOFUMPT_VER}_linux_amd64"
chmod 0700 "$HOME/.local/bin/gofumpt"
- name: Run gofumpt
run: |
find src/go -type f -not -name 'zz*' -name '*.go' | xargs -n1 "$HOME/.local/bin/gofumpt" -w -lang=1.20
git diff --exit-code
- name: go mod tidy (cluster-to-redpanda-migration)
working-directory: src/go/cluster-to-redpanda-migration
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: go mod tidy (k8s)
working-directory: src/go/k8s
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: go mod tidy (rpk)
working-directory: src/go/rpk
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
py:
name: Lint python files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install yapf
run: pip install yapf==0.40.1
- name: Run yapf
run: find . -type f -name '*.py' | xargs -n8 yapf -d
cpp:
name: Lint files with clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run clang-format
run: |
docker run \
-v $PWD:/redpanda ubuntu \
bash -c "cd /redpanda && \
apt update && \
apt install -y wget git lsb-release wget software-properties-common gnupg && \
wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh 16 && \
apt-get install -y clang-format-16 && \
find . -type f -regex '.*\.\(cpp\|h\|hpp\|cc\|proto\|java\)' | xargs -n1 clang-format-16 -i -style=file -fallback-style=none"
git diff --exit-code
sh:
name: Lint shell scripts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install shfmt
env:
SHFMT_VER: 3.6.0
run: |
mkdir -v -p "$HOME/.local/bin"
wget -O "$HOME/.local/bin/shfmt" "https://github.com/mvdan/sh/releases/download/v${SHFMT_VER}/shfmt_v${SHFMT_VER}_linux_amd64"
chmod 0700 "$HOME/.local/bin/shfmt"
- name: Run shfmt
run: shfmt -i 2 -ci -s -d .