TRANSFER-726: Fix build wf #203
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: "" }, | |
# 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" }, | |
] | |
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 | |
- shell: bash | |
run: | | |
echo "Running ${{ matrix.suite.group }} suite ${{ matrix.suite.name }}" | |
export RECIPE_CLICKHOUSE_BIN=clickhouse | |
export USE_TESTCONTAINERS=1 | |
for dir in $(find ./transfer_manager/go/${{ matrix.suite.group }}/${{ matrix.suite.path }} -type d); do | |
echo "::group::$dir" | |
if ls "$dir"/*_test.go >/dev/null 2>&1; then | |
echo "Running tests for directory: $dir" | |
gotestsum \ | |
--junitfile="reports/${{ matrix.suite.name }}_${dir//\//_}.xml" \ | |
--junitfile-project-name="${{ matrix.suite.group }}" \ | |
--junitfile-testsuite-name="short" \ | |
--rerun-fails \ | |
--format github-actions \ | |
--packages="$dir" \ | |
-- -timeout=15m | |
else | |
echo "No Go files found in $dir, skipping tests." | |
fi | |
echo "::endgroup::" | |
done | |
- 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 | |
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: "parser", path: "parser" }, | |
# 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" }, | |
# pkg test suites | |
{ 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: "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 | |
- 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="./transfer_manager/go/${{ 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" |