Repository navigation
123 lines (109 loc) · 3.57 KB
/
Copy pathci.yml
File metadata and controls
123 lines (109 loc) · 3.57 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
# This workflow runs basic CI checks for the repository:
# - Unit tests
# - Linting
# - Formatting
#
# It is not responsible for running integration tests or other tests that are
# more complex to run in a CI environment.
name: ci
on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
push:
# Always run on push to main. The build cache can only be reused
# if it was saved by a run from the repository's default branch.
# The run result will be identical to that from the merge queue
# because the commit is identical, yet we need to perform it to
# seed the build cache.
branches:
- main
jobs:
discover:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
outputs:
modules: ${{ steps.find.outputs.modules }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Find modules
id: find
run: |
modules=$(find . -name 'go.mod' -exec dirname {} \; | sed 's|^\./||' | sort | jq -Rnc '[inputs]')
echo "modules=$modules" >> $GITHUB_OUTPUT
tests:
needs: discover
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
go-version:
- "1.26"
module: ${{ fromJson(needs.discover.outputs.modules) }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
working-directory: ${{ matrix.module }}
# The examples module intentionally has no packages without its build tag.
run: go list -tags=examples ./... | xargs -r go test -tags=examples -v -race
lint:
needs: discover
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(needs.discover.outputs.modules) }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
go-version: "1.26"
- name: Install golangci-lint
working-directory: ${{ matrix.module }}
env:
GOWORK: "off"
run: jf go install github.com/golangci/golangci-lint/cmd/golangci-lint@8b37f14162043f908949f1b363d061dc9ba713c0 # v1.64.8
- name: Run golangci-lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
with:
install-mode: none
working-directory: ${{ matrix.module }}
args: --timeout=5m --build-tags=examples ./...
fmt:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
env:
GOTOOLCHAIN: local
with:
go-version: "1.26"
cache: false
- name: Run gofmt
run: gofmt -l -w .
- name: Fail on differences
run: git diff --exit-code