forked from kedacore/keda
-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (124 loc) · 4.21 KB
/
pr-validation.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
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
- pull_request
jobs:
validate:
name: Validate PR
runs-on: ubuntu-latest
container: ubuntu:focal
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Install necessary packages
run: apt update && apt install -y make ca-certificates gcc
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set Go paths
id: go-paths
run: |
echo ::set-output name=mod_cache::$(go env GOMODCACHE)
echo ::set-output name=build_cache::$(go env GOCACHE)
- name: Go modules cache
uses: actions/[email protected]
with:
path: ${{ steps.go-paths.outputs.mod_cache }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Go build cache
uses: actions/[email protected]
with:
path: ${{ steps.go-paths.outputs.build_cache }}
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}
- name: Go modules sync
run: go mod tidy
- name: Verify Generated clientset is up to date
run: make clientset-verify
- name: Build
run: make build
- name: Test
run: make test
validate-arm64:
name: Validate PR on ARM64
runs-on: ARM64
container: arm64v8/ubuntu:focal
env:
ARCH: arm64
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Install necessary packages
run: apt update && apt install -y make ca-certificates gcc
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set Go paths
id: go-paths
run: |
echo ::set-output name=mod_cache::$(go env GOMODCACHE)
echo ::set-output name=build_cache::$(go env GOCACHE)
- name: Go modules cache
uses: actions/[email protected]
with:
path: ${{ steps.go-paths.outputs.mod_cache }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Go build cache
uses: actions/[email protected]
with:
path: ${{ steps.go-paths.outputs.build_cache }}
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}
- name: Go modules sync
run: go mod tidy
- name: Verify Generated clientset is up to date
run: make clientset-verify
- name: Build
run: make build
- name: Test
run: make test
statics:
name: Static Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]
- uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Get golangci
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0
- uses: pre-commit/[email protected]
codeScanning:
name: Code Scanning
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ['go']
# Learn more... https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1