-
Notifications
You must be signed in to change notification settings - Fork 97
116 lines (96 loc) · 3.36 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
name: Lint
on:
push:
branches:
- main
pull_request:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.ref_name }}-lint
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Setup Golang Environment
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: stable
- name: Lint Code
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
with:
args: --timeout 10m0s
# Disable caching as a workaround for https://github.com/golangci/golangci-lint-action/issues/135.
skip-pkg-cache: true
njs-lint:
name: NJS Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Get Prettier version
id: prettier-version
run: |
echo "version=$(jq -r .devDependencies.prettier ${{ github.workspace }}/internal/mode/static/nginx/modules/package.json)" >> $GITHUB_OUTPUT
- name: Setup Node.js Environment
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
- name: Run Prettier on NJS code
id: prettier-run
uses: rutajdash/prettier-cli-action@d42c4325a3b344f3bd4be482bc34de521998d557 # v1.0.2
with:
config_path: ${{ github.workspace }}/internal/mode/static/nginx/modules/.prettierrc
file_pattern: ${{ github.workspace }}/internal/mode/static/nginx/modules/**/*.js
prettier_version: ${{ steps.prettier-version.outputs.version }}
- name: Prettier Output
if: failure()
shell: bash
run: |
echo "The following files are not formatted:"
echo "${{steps.prettier-run.outputs.prettier_output}}"
echo "Run \"make njs-fmt\" locally to format the code"
actionlint:
name: Actionlint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: reviewdog/action-actionlint@9d8b58041eed1373f173e91b9a3db5a844197236 # v1.44.0
with:
actionlint_flags: -shellcheck ""
markdown-lint:
name: Markdown Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16.0.0
with:
config: ${{ github.workspace }}/.markdownlint-cli2.yaml
globs: "**/*.md"
chart-lint:
name: Chart Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Lint chart
run: make lint-helm
yaml-lint:
name: Yaml Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Install yamllint
run: pip install yamllint
- name: Lint YAML files
run: yamllint .