-
Notifications
You must be signed in to change notification settings - Fork 60
61 lines (52 loc) · 1.51 KB
/
go-unittests.yaml
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
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Golang Lint and Unit Tests
on:
pull_request:
branches: [main]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- microservices-connector/**
- "!microservices-connector/helm/**"
- "!**.md"
- "!**.txt"
- "!**.png"
workflow_dispatch:
# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GOSRC_DIR: "microservices-connector"
jobs:
go-unittests:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
packages: write
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: "1.21"
id: go
- name: Checkout out Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run golang lint
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=10m
version: v1.55.2
working-directory: ${{ env.GOSRC_DIR }}
- name: Run golangunit test
run: |
cd $GOSRC_DIR
make test
- name: Run tests and generate coverage
run: |
cd $GOSRC_DIR
go test -coverprofile=coverage.out $(go list ./... | grep -v /e2e)
../.github/workflows/scripts/go-coverage.sh