-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.34 KB
/
go.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
name: Go Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-and-lint:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22.x"
- name: Run tests
if: ${{ !inputs.skipTests }}
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Go Format
run: gofmt -s -w . && git diff --exit-code
- name: Go Vet
run: go vet ./...
- name: Upload Coverage
if: ${{ !inputs.skipTests }} # upload when we really run our tests
uses: codecov/codecov-action@v3
continue-on-error: true # we don't care if it fails
with:
token: ${{secrets.CODECOV_TOKEN}} # set in repository settings
file: ./coverage.txt # file from the previous step
fail_ci_if_error: false
cleanup:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Delete merged branch
uses: dawidd6/action-delete-branch@v3