-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 1.46 KB
/
test_and_report.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
name: test_and_report
on:
push:
branches:
- main
paths:
- go.mod
- go.sum
- "cmd/**"
- "pkg/**"
permissions:
contents: write
jobs:
test_and_report:
strategy:
fail-fast: false
matrix:
go: [1.21]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
name: Test and report maintainability of ldap-cli
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Install go tools
run: |
go install golang.org/x/tools/gopls@latest && \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && \
go install github.com/axw/gocov/gocov@latest
- name: Export Module Name
id: export_module_name
run: echo "MODULE_NAME=$(go mod edit -json | jq -r '.Module.Path')" >> "$GITHUB_OUTPUT"
- name: Run linters
run: gofmt -s -d ./ && golangci-lint run -v -e printf
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPORTER_ID }}
with:
coverageCommand: gocov test ./... -coverprofile=c.out
coverageLocations: ./c.out:gocov
debug: true
prefix: ${{ steps.export_module_name.outputs.MODULE_NAME }}