forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (85 loc) · 2.29 KB
/
go-testing-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
name: Golang Unit and Integration Tests
on:
push:
branches:
- "master"
paths:
- "**.go"
pull_request:
branches:
- "master"
paths:
- "**.go"
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
jobs:
golangci:
strategy:
matrix:
go: [1.21]
os: [ubuntu-22.04]
name: golangci-lint
if: github.repository == 'meshery/meshery'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.0
args: --config=.golangci.yml --timeout=10m
unit-tests:
name: Unit tests
runs-on: ubuntu-22.04
needs: golangci
steps:
- uses: actions/checkout@master
with:
fetch-depth: 2
- name: Install lynx for xdg-open support
run: sudo apt-get install lynx
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: "1.21"
- name: Run coverage
run: go test --short ./... -race -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
if: github.repository == 'meshery/meshery'
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: unittests
integration-tests:
name: Integration tests
runs-on: ubuntu-22.04
needs: golangci
steps:
- uses: actions/checkout@master
with:
fetch-depth: 2
- name: Install lynx for xdg-open support
run: sudo apt-get install lynx
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: "1.21"
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: "kind-cluster"
- name: Run coverage
run: go test -run Integration ./... -race -coverprofile=coverage.txt -covermode=atomic -timeout 40m
- name: Upload coverage to Codecov
if: github.repository == 'meshery/meshery'
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: gointegrationtests