-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (92 loc) · 2.96 KB
/
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
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
name: ci
on:
push:
branches: [ "main" ]
pull_request:
branches:
- "main"
- "release/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set environment variables
run: |
echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> "$GITHUB_ENV"
- name: Setup Code Climate test-reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter
chmod +x /tmp/cc-test-reporter
/tmp/cc-test-reporter before-build
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Install dependencies
run: |
go install go.uber.org/mock/mockgen@latest
- name: Setup gotestsum
uses: autero1/[email protected]
with:
gotestsum_version: 1.11.0
- name: Build
run: make build-all
- name: Generate
run: make generate
- name: Test
run: |
mkdir -p /tmp/test-results
gotestsum \
--junitfile /tmp/test-results/gotestsum-report.xml \
-- \
-failfast \
-covermode atomic \
-coverprofile c.out \
./...
cp c.out /tmp/test-results/coverage.out
go tool cover -html=c.out -o /tmp/test-results/coverage.html
/tmp/cc-test-reporter after-build \
--id ${{ secrets.CC_TEST_REPORTER_ID }} \
--prefix "github.com/six78/2-story-points-cli" \
--exit-code $?
- name: Report tests
uses: dorny/[email protected]
if: success() || failure()
with:
name: Go Tests
path: /tmp/test-results/gotestsum-report.xml
reporter: jest-junit
- name: Upload artifcats
uses: actions/upload-artifact@v4
with:
path: |
/tmp/test-results/gotestsum-report.xml
/tmp/test-results/coverage.out
/tmp/test-results/coverage.html
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Install dependencies
run: |
go install go.uber.org/mock/mockgen@latest
- name: Generate
run: make generate
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.56.2
permissions:
contents: read # Required: allow read access to the content for analysis.
pull-requests: read # Optional: allow read access to pull request. Use with `only-new-issues` option.
checks: write