-
Notifications
You must be signed in to change notification settings - Fork 79
87 lines (85 loc) · 2.62 KB
/
approve-to-run-ci.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
name: Meshery-Operator CI
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
jobs:
golangci-lint:
strategy:
matrix:
platform: [ubuntu-22.04]
go-version: [1.21.x]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: go.sum
- name: Checkout code
uses: actions/checkout@master
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Run golangci-lint
run: make lint
tidy:
name: Go mod tidy
needs: [golangci-lint]
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache: true
cache-dependency-path: go.sum
- name: Run go mod tidy
run: make tidy
codecov:
# golandci-lint need to be run before codecov and succeed
needs: [golangci-lint, tidy]
name: Code Coverage
if: github.repository == 'meshery/meshery-operator'
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache: true
cache-dependency-path: go.sum
- name: Set up test-env
run: make test-env
- name: Run unit tests
run: make test
- name: Upload coverage to Codecov
if: github.repository == 'meshery/meshery-operator'
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: unittests
# if review comment includes approved or LGTM, run the tests
# if review comment includes changes requested, do not run the tests
# if review comment includes approved or LGTM, run the tests
build:
needs: [golangci-lint, tidy, codecov]
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache: true
cache-dependency-path: go.sum
- name: Build
run: make build