-
Notifications
You must be signed in to change notification settings - Fork 14
105 lines (85 loc) · 2.31 KB
/
Copy pathtests.yml
File metadata and controls
105 lines (85 loc) · 2.31 KB
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
name: Tests
on:
push:
branches:
- master
pull_request:
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.13'
cache: true
- name: Download dependencies
run: go mod download
- name: Run unit tests
run: |
# Run tests excluding integration and example packages
# This includes all proxy auth tests (Basic, SPNEGO, etc.)
go test -v -race -coverprofile=coverage.out -covermode=atomic \
$(go list ./... | grep -v '/integration' | grep -v '/example')
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: success()
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Check for test failures
if: failure()
run: |
echo "::error::Unit tests failed. Please check the logs above."
exit 1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.13'
cache: true
- name: Run go fmt
run: |
if [ -n "$(gofmt -s -l . | grep -v vendor)" ]; then
echo "Go code is not formatted:"
gofmt -s -d . | grep -v vendor
exit 1
fi
- name: Run go vet
run: go vet ./...
- name: Check go mod tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.13']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Build
run: go build -v ./...
- name: Test compilation
run: |
go test -c -o /dev/null ./...