-
Notifications
You must be signed in to change notification settings - Fork 36
178 lines (143 loc) · 5.01 KB
/
build-and-test.yml
File metadata and controls
178 lines (143 loc) · 5.01 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
check-runner:
name: Check Runner Permissions
runs-on: ubuntu-latest
outputs:
use-container: ${{ steps.check.outputs.use-container }}
steps:
- id: check
run: |
# Use container only for fork PRs (when we don't have access to secrets)
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
echo "use-container=true" >> "$GITHUB_OUTPUT"
else
echo "use-container=false" >> "$GITHUB_OUTPUT"
fi
lint-and-unit-test:
name: Lint and Unit Test
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: "1.26.0"
- run: go install go.uber.org/mock/mockgen@latest
- name: Download dependencies
run: go mod download
- name: Generate mocks
run: go generate ./...
- name: Verify mocks are up-to-date
run: |
git diff --exit-code || (echo "Generated mocks are not up-to-date. Please run 'go generate ./...' locally and push the updated files." && exit 1)
- name: Run golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
args: --timeout=1m
- name: Run unit tests
run: go test -v -race ./...
integration-tests-ubuntu:
name: Integration Tests (ubuntu-latest)
needs: check-runner
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: "1.26.0"
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Run integration tests
run: go test -v -tags=integration ./test/integration/...
env:
USE_CONTAINER: ${{ needs.check-runner.outputs.use-container }}
NEO4J_URI: ${{ secrets.AURA_URL }}
NEO4J_USERNAME: ${{ secrets.AURA_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.AURA_PASSWORD }}
integration-tests-other:
name: Integration Tests
needs: check-runner
if: needs.check-runner.outputs.use-container != 'true'
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: "1.26.0"
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Run integration tests
run: go test -v -tags=integration ./test/integration/...
env:
USE_CONTAINER: "false"
NEO4J_URI: ${{ secrets.AURA_URL }}
NEO4J_USERNAME: ${{ secrets.AURA_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.AURA_PASSWORD }}
e2e-tests-ubuntu:
name: E2E Tests (ubuntu-latest)
needs: check-runner
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: "1.26.0"
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Run E2E tests
run: go test -v -tags=e2e ./test/e2e/...
env:
USE_CONTAINER: ${{ needs.check-runner.outputs.use-container }}
NEO4J_URI: ${{ secrets.AURA_URL }}
NEO4J_USERNAME: ${{ secrets.AURA_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.AURA_PASSWORD }}
e2e-tests-other:
name: E2E Tests
needs: check-runner
if: needs.check-runner.outputs.use-container != 'true'
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version: "1.26.0"
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Run E2E tests
run: go test -v -tags=e2e ./test/e2e/...
env:
USE_CONTAINER: "false"
NEO4J_URI: ${{ secrets.AURA_URL }}
NEO4J_USERNAME: ${{ secrets.AURA_USERNAME }}
NEO4J_PASSWORD: ${{ secrets.AURA_PASSWORD }}