-
Notifications
You must be signed in to change notification settings - Fork 6
190 lines (185 loc) · 6.63 KB
/
build_and_test.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
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
179
180
181
182
183
184
185
186
187
188
189
190
name: Run Build and Test
on:
push:
branches:
- 'main'
pull_request:
branches:
- "*"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.0"
- shell: bash
run: |
make build
e2e-tests:
needs: build
name: e2e / ${{ matrix.suite.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite: [
# CLI test suites
{ group: "cmd", name: "cmd", path: "" },
# providers suites, some of the providers are too heavy to run as single test
{ group: "pkg/providers", name: "yt", path: "yt", yt: true },
{ group: "pkg/providers", name: "providers-postgres", path: "postgres" },
# e2e test suites
{ group: "tests/e2e", name: "kafka2ch", path: "kafka2ch" },
{ group: "tests/e2e", name: "pg2pg", path: "pg2pg" },
{ group: "tests/e2e", name: "pg2ch", path: "pg2ch" },
{ group: "tests/e2e", name: "mongo2ch", path: "mongo2ch" },
{ group: "tests/e2e", name: "kinesis2ch", path: "kinesis2ch" },
{ group: "tests/e2e", name: "ch2s3", path: "ch2s3" },
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.0"
- shell: bash
run: |
go install gotest.tools/gotestsum@latest
- shell: bash
run: |
curl https://clickhouse.com/ | sh
sudo ./clickhouse install
- name: Setup PostgreSQL
uses: tj-actions/install-postgresql@v3
with:
postgresql-version: 16
- shell: bash
run: |
pg_dump --version
- shell: bash
if: matrix.suite.yt
name: prepare local YT
run: |
go build -o binaries/lightexe ./pkg/providers/yt/lightexe/*.go
docker compose -f "pkg/providers/yt/recipe/docker-compose.yml" up -d --build
export YT_PROXY=localhost:8180
export TEST_DEPS_BINARY_PATH=binaries
- shell: bash
run: |
make run-tests SUITE_GROUP="${{ matrix.suite.group }}" SUITE_PATH="${{ matrix.suite.path }}" SUITE_NAME="${{ matrix.suite.name }}"
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-reports-${{ matrix.suite.name }}
path: reports/*.xml
- name: Fail if tests failed
if: failure()
run: exit 1
generic-tests:
needs: build
name: tests - ${{ matrix.suite.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite: [
# canon test suites
{ group: "tests/canon", name: "canon-parser", path: "parser" },
{ group: "tests/storage", name: "storage-pg", path: "pg" },
# internal test suites
{ group: "internal", name: "internal", path: "..." },
# provider test suites
{ group: "pkg/providers", name: "providers-mongo", path: "mongo" },
{ group: "pkg/providers", name: "providers-mysql", path: "mysql" },
{ group: "pkg/providers", name: "providers-sample", path: "sample" },
{ group: "pkg/providers", name: "providers-kafka", path: "kafka" },
{ group: "pkg/providers", name: "providers-kinesis", path: "kinesis" },
{ group: "pkg/providers", name: "providers-greenplum", path: "greenplum" },
{ group: "pkg/providers", name: "providers-clickhouse", path: "clickhouse" },
{ group: "pkg/providers", name: "providers-elastic", path: "elastic" },
# pkg test suites
{ group: "pkg", name: "abstract", path: "abstract" },
{ group: "pkg", name: "transformer", path: "transformer" },
{ group: "pkg", name: "predicate", path: "predicate" },
{ group: "pkg", name: "dblog", path: "dblog" },
{ group: "pkg", name: "functions", path: "functions" },
{ group: "pkg", name: "maplock", path: "maplock" },
{ group: "pkg", name: "middlewares", path: "middlewares" },
{ group: "pkg", name: "parsequeue", path: "parsequeue" },
{ group: "pkg", name: "util", path: "util" },
{ group: "pkg", name: "stringutil", path: "stringutil" },
{ group: "pkg", name: "serializer", path: "serializer" },
{ group: "pkg", name: "worker", path: "worker" },
{ group: "pkg", name: "schemaregistry", path: "schemaregistry" },
{ group: "pkg", name: "parsers-generic", path: "parsers/generic" },
{ group: "pkg", name: "parsers-scanner", path: "parsers/scanner" }
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.0"
- shell: bash
run: |
go install gotest.tools/gotestsum@latest
- shell: bash
run: |
curl https://clickhouse.com/ | sh
sudo ./clickhouse install
- name: Setup PostgreSQL
uses: tj-actions/install-postgresql@v3
with:
postgresql-version: 16
- shell: bash
run: |
echo "Running ${{ matrix.suite.group }} suite ${{ matrix.suite.name }}"
export RECIPE_CLICKHOUSE_BIN=clickhouse
export USE_TESTCONTAINERS=1
gotestsum \
--junitfile="reports/${{ matrix.suite.name }}.xml" \
--junitfile-project-name="${{ matrix.suite.group }}" \
--junitfile-testsuite-name="short" \
--rerun-fails \
--format github-actions \
--packages="./${{ matrix.suite.group }}/${{ matrix.suite.path }}/..." \
-- -timeout=15m
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-reports-${{ matrix.suite.name }}
path: reports/${{ matrix.suite.name }}.xml
- name: Fail if tests failed
if: failure()
run: exit 1
test-report:
needs: [
generic-tests,
e2e-tests,
]
name: test-report
if: always() && !contains(needs.*.result, 'skipped')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download All Test Reports
uses: actions/download-artifact@v4
with:
pattern: test-reports-*
merge-multiple: true
path: reports/
- name: Test Summary
uses: test-summary/action@v2
if: always()
with:
paths: "reports/*.xml"