-
Notifications
You must be signed in to change notification settings - Fork 1.1k
139 lines (131 loc) 路 3.96 KB
/
ci-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
137
138
139
name: Lint
permissions:
contents: read
on:
workflow_call:
inputs:
ref:
required: true
description: "GitHub ref to use"
type: string
version-set:
required: true
description: "Version matrix to use"
type: string
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
golangci:
# See https://github.com/pulumi/pulumi/issues/9280 for why this is set to v1.44
container: golangci/golangci-lint:v1.47.3
name: Lint Go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Tidy
run: make tidy
- name: Fail if go mod not tidy
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::error go.mod not tidy"
exit 1
fi
- name: Lint
run: make lint
protobuf-lint:
name: Lint Protobufs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Check Protobufs
run: |
make check-proto
sdk-lint:
name: Lint SDKs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- uses: actions/setup-go@v3
with:
go-version: ${{ fromJson(inputs.version-set).go }}
- name: Set up Python ${{ fromJson(inputs.version-set).python }}
uses: actions/setup-python@v3
with:
python-version: ${{ fromJson(inputs.version-set).python }}
cache: pip
cache-dependency-path: sdk/python/requirements.txt
# TODO: https://github.com/pulumi/pulumi/issues/11000, this step causes spurious errors.
# - name: Set up DotNet ${{ fromJson(inputs.version-set).dotnet }}
# uses: actions/setup-dotnet@v2
# with:
# dotnet-version: ${{ fromJson(inputs.version-set).dotnet }}
- run: mkdir -p "${{ runner.temp }}/opt/pulumi/nuget"
- name: Add NuGet packages as a local NuGet source
run: |
command -v dotnet
dotnet --version
dotnet nuget add source "${{ runner.temp }}/opt/pulumi/nuget"
- name: Set up Node ${{ fromJson(inputs.version-set).nodejs }}
uses: actions/setup-node@v3
with:
node-version: ${{ fromJson(inputs.version-set).nodejs }}
cache: yarn
cache-dependency-path: sdk/nodejs/yarn.lock
- name: Install Python deps
run: |
python -m pip install --upgrade pip requests wheel urllib3 chardet
- name: Setup git
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: Update path
run: |
echo "$RUNNER_TEMP/opt/pulumi/bin" >> "$GITHUB_PATH"
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Set Go Dep path
run: |
echo "PULUMI_GO_DEP_ROOT=$(dirname "$(pwd)")" >> "$GITHUB_ENV"
- name: Ensure
run: |
make ensure
- name: Lint Node
run: |
cd sdk/nodejs && make lint
- name: Lint Python
run: |
cd sdk/python && make lint
- name: Lint .NET
run: |
cd sdk/dotnet && make lint
actionlint:
name: Lint GHA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ fromJson(inputs.version-set).go }}
- run: |
make lint_actions
linear-history:
name: linear-history
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# This should be the merge commit of the PR or candidate merge commit in the staging branch for `bors`.
ref: ${{ inputs.ref }}
fetch-depth: 0
- name: Check for non-linear history
run: ./scripts/git-linear-history-check.sh