-
Notifications
You must be signed in to change notification settings - Fork 44
127 lines (105 loc) · 3.38 KB
/
Copy pathgo.yml
File metadata and controls
127 lines (105 loc) · 3.38 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Lint-Build-Test
on:
push:
# Run on all branches but not on tags.
# https://github.com/orgs/community/discussions/25615
branches:
- "**"
tags:
- "!**"
workflow_dispatch:
permissions:
contents: read
# We limit the concurrent runs of this workflow on per branch (ref) level.
# https://docs.github.com/en/enterprise-cloud@latest/actions/using-jobs/using-concurrency#example-using-concurrency-and-the-default-behavior
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# This is the golangci-lint version we use.
#
# Take a look at the official docs to check if there is a newer version
# available:
#
# https://github.com/golangci/golangci-lint/releases
#
GOLANGCI_LINT_VERSION: "v2.11.4"
jobs:
checks-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Check gofmt
run: |
files=$(go fmt -mod=vendor ./...)
[ -z "$files" ] && exit 0
echo "Files not formatted:"
echo
for f in $files; do
echo " $f"
done
exit 1
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
# Directly taken from https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
- name: Check Github workflow files
shell: bash
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color -shellcheck=""
build-test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build tables-to-go
run: |
go build -v -mod=vendor .
- name: Run unit tests
shell: bash
run: |
go test -v -mod=vendor -race ./...
# Run integration tests and coverage only on ubuntu-latest.
#
# Because there is no docker installed on MacOS, see here
# https://github.community/t5/GitHub-Actions/Why-is-Docker-not-installed-on-macOS/td-p/39364
#
# And on Windows we get this error:
#
# vendor\github.com\ory\dockertest\docker\pkg\system\filesys_windows.go:113:24:
# cannot use uintptr(unsafe.Pointer(&sd[0])) (type uintptr) as type *"golang.org/x/sys/windows".SECURITY_DESCRIPTOR in assignment
#
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run integration tests
run: |
go test -v -mod=vendor -race -tags=integration ./internal/integration_tests/...
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run all tests with coverage
run: |
go test -v -mod=vendor -tags=integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt ./...
- name: Upload Coverage
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}