|
| 1 | +name: Run Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "*" |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + - name: Setup Go |
| 19 | + uses: actions/setup-go@v5 |
| 20 | + with: |
| 21 | + go-version: "1.22.0" |
| 22 | + - shell: bash |
| 23 | + run: | |
| 24 | + make build |
| 25 | +
|
| 26 | + e2e-tests: |
| 27 | + needs: build |
| 28 | + name: e2e / ${{ matrix.suite.name }} |
| 29 | + runs-on: ubuntu-latest |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + suite: [ |
| 34 | + # CLI test suites |
| 35 | + { group: "cmd", name: "cmd", path: "" }, |
| 36 | + # providers suites, some of the providers are too heavy to run as single test |
| 37 | + { |
| 38 | + group: "pkg/providers", |
| 39 | + name: "container", |
| 40 | + path: "container", |
| 41 | + container: true, |
| 42 | + }, |
| 43 | + { group: "pkg/providers", name: "yt", path: "yt", yt: true }, |
| 44 | + { |
| 45 | + group: "pkg/providers", |
| 46 | + name: "providers-postgres", |
| 47 | + path: "postgres", |
| 48 | + }, |
| 49 | + # e2e test suites |
| 50 | + { group: "tests/e2e", name: "kafka2ch", path: "kafka2ch" }, |
| 51 | + { group: "tests/e2e", name: "pg2pg", path: "pg2pg" }, |
| 52 | + { group: "tests/e2e", name: "pg2ch", path: "pg2ch" }, |
| 53 | + { group: "tests/e2e", name: "mongo2ch", path: "mongo2ch" }, |
| 54 | + { group: "tests/e2e", name: "kinesis2ch", path: "kinesis2ch" }, |
| 55 | + { group: "tests/e2e", name: "ch2s3", path: "ch2s3" }, |
| 56 | + ] |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v4 |
| 60 | + - name: Setup Go |
| 61 | + uses: actions/setup-go@v5 |
| 62 | + with: |
| 63 | + go-version: "1.22.0" |
| 64 | + - shell: bash |
| 65 | + run: | |
| 66 | + go install gotest.tools/gotestsum@latest |
| 67 | + - shell: bash |
| 68 | + run: | |
| 69 | + curl https://clickhouse.com/ | sh |
| 70 | + sudo ./clickhouse install |
| 71 | + - name: Setup PostgreSQL |
| 72 | + uses: tj-actions/install-postgresql@v3 |
| 73 | + with: |
| 74 | + postgresql-version: 16 |
| 75 | + - shell: bash |
| 76 | + run: | |
| 77 | + pg_dump --version |
| 78 | + - uses: engineerd/setup-kind@v0.6.2 |
| 79 | + if: matrix.suite.container |
| 80 | + with: |
| 81 | + version: "v0.26.0" |
| 82 | + # Handled by the test code |
| 83 | + skipClusterCreation: true |
| 84 | + skipClusterDeletion: true |
| 85 | + skipClusterLogsExport: true |
| 86 | + - shell: bash |
| 87 | + if: matrix.suite.yt |
| 88 | + name: prepare local YT |
| 89 | + run: | |
| 90 | + go build -o binaries/lightexe ./pkg/providers/yt/lightexe/*.go |
| 91 | + docker compose -f "pkg/providers/yt/recipe/docker-compose.yml" up -d --build |
| 92 | + export YT_PROXY=localhost:8180 |
| 93 | + export TEST_DEPS_BINARY_PATH=binaries |
| 94 | + - shell: bash |
| 95 | + run: | |
| 96 | + make run-tests SUITE_GROUP="${{ matrix.suite.group }}" SUITE_PATH="${{ matrix.suite.path }}" SUITE_NAME="${{ matrix.suite.name }}" |
| 97 | + env: |
| 98 | + TEST_KUBERNETES_INTEGRATION: ${{ matrix.suite.container == true && '1' || '' }} |
| 99 | + - name: Upload Test Results |
| 100 | + uses: actions/upload-artifact@v4 |
| 101 | + if: always() |
| 102 | + with: |
| 103 | + name: test-reports-${{ matrix.suite.name }} |
| 104 | + path: reports/*.xml |
| 105 | + - name: Fail if tests failed |
| 106 | + if: failure() |
| 107 | + run: exit 1 |
| 108 | + |
| 109 | + generic-tests: |
| 110 | + needs: build |
| 111 | + name: tests - ${{ matrix.suite.name }} |
| 112 | + runs-on: ubuntu-latest |
| 113 | + strategy: |
| 114 | + fail-fast: false |
| 115 | + matrix: |
| 116 | + suite: [ |
| 117 | + # canon test suites |
| 118 | + { group: "tests/canon", name: "canon-parser", path: "parser" }, |
| 119 | + { group: "tests/storage", name: "storage-pg", path: "pg" }, |
| 120 | + # internal test suites |
| 121 | + { group: "internal", name: "internal", path: "..." }, |
| 122 | + # provider test suites |
| 123 | + { group: "pkg/providers", name: "providers-mongo", path: "mongo" }, |
| 124 | + { group: "pkg/providers", name: "providers-mysql", path: "mysql" }, |
| 125 | + { |
| 126 | + group: "pkg/providers", |
| 127 | + name: "providers-sample", |
| 128 | + path: "sample", |
| 129 | + }, |
| 130 | + { group: "pkg/providers", name: "providers-kafka", path: "kafka" }, |
| 131 | + { |
| 132 | + group: "pkg/providers", |
| 133 | + name: "providers-kinesis", |
| 134 | + path: "kinesis", |
| 135 | + }, |
| 136 | + { |
| 137 | + group: "pkg/providers", |
| 138 | + name: "providers-greenplum", |
| 139 | + path: "greenplum", |
| 140 | + }, |
| 141 | + { |
| 142 | + group: "pkg/providers", |
| 143 | + name: "providers-clickhouse", |
| 144 | + path: "clickhouse", |
| 145 | + }, |
| 146 | + { |
| 147 | + group: "pkg/providers", |
| 148 | + name: "providers-elastic", |
| 149 | + path: "elastic", |
| 150 | + }, |
| 151 | + # pkg test suites |
| 152 | + { group: "pkg", name: "abstract", path: "abstract" }, |
| 153 | + { group: "pkg", name: "transformer", path: "transformer" }, |
| 154 | + { group: "pkg", name: "predicate", path: "predicate" }, |
| 155 | + { group: "pkg", name: "dblog", path: "dblog" }, |
| 156 | + { group: "pkg", name: "functions", path: "functions" }, |
| 157 | + { group: "pkg", name: "maplock", path: "maplock" }, |
| 158 | + { group: "pkg", name: "middlewares", path: "middlewares" }, |
| 159 | + { group: "pkg", name: "parsequeue", path: "parsequeue" }, |
| 160 | + { group: "pkg", name: "util", path: "util" }, |
| 161 | + { group: "pkg", name: "stringutil", path: "stringutil" }, |
| 162 | + { group: "pkg", name: "serializer", path: "serializer" }, |
| 163 | + { group: "pkg", name: "worker", path: "worker" }, |
| 164 | + { group: "pkg", name: "schemaregistry", path: "schemaregistry" }, |
| 165 | + { group: "pkg", name: "parsers-generic", path: "parsers/generic" }, |
| 166 | + { group: "pkg", name: "parsers-tests", path: "parsers/tests" }, |
| 167 | + { group: "pkg", name: "parsers-scanner", path: "parsers/scanner" }, |
| 168 | + ] |
| 169 | + steps: |
| 170 | + - name: Checkout |
| 171 | + uses: actions/checkout@v4 |
| 172 | + - name: Setup Go |
| 173 | + uses: actions/setup-go@v5 |
| 174 | + with: |
| 175 | + go-version: "1.22.0" |
| 176 | + - shell: bash |
| 177 | + run: | |
| 178 | + go install gotest.tools/gotestsum@latest |
| 179 | + - shell: bash |
| 180 | + run: | |
| 181 | + curl https://clickhouse.com/ | sh |
| 182 | + sudo ./clickhouse install |
| 183 | + - name: Setup PostgreSQL |
| 184 | + uses: tj-actions/install-postgresql@v3 |
| 185 | + with: |
| 186 | + postgresql-version: 16 |
| 187 | + - shell: bash |
| 188 | + run: | |
| 189 | + echo "Running ${{ matrix.suite.group }} suite ${{ matrix.suite.name }}" |
| 190 | + export RECIPE_CLICKHOUSE_BIN=clickhouse |
| 191 | + export USE_TESTCONTAINERS=1 |
| 192 | + gotestsum \ |
| 193 | + --junitfile="reports/${{ matrix.suite.name }}.xml" \ |
| 194 | + --junitfile-project-name="${{ matrix.suite.group }}" \ |
| 195 | + --junitfile-testsuite-name="short" \ |
| 196 | + --rerun-fails \ |
| 197 | + --format github-actions \ |
| 198 | + --packages="./${{ matrix.suite.group }}/${{ matrix.suite.path }}/..." \ |
| 199 | + -- -timeout=15m |
| 200 | + - name: Upload Test Results |
| 201 | + uses: actions/upload-artifact@v4 |
| 202 | + if: always() |
| 203 | + with: |
| 204 | + name: test-reports-${{ matrix.suite.name }} |
| 205 | + path: reports/${{ matrix.suite.name }}.xml |
| 206 | + - name: Fail if tests failed |
| 207 | + if: failure() |
| 208 | + run: exit 1 |
| 209 | + |
| 210 | + test-report: |
| 211 | + needs: [generic-tests, e2e-tests] |
| 212 | + name: test-report |
| 213 | + if: always() && !contains(needs.*.result, 'skipped') |
| 214 | + runs-on: ubuntu-latest |
| 215 | + steps: |
| 216 | + - name: Checkout |
| 217 | + uses: actions/checkout@v4 |
| 218 | + - name: Download All Test Reports |
| 219 | + uses: actions/download-artifact@v4 |
| 220 | + with: |
| 221 | + pattern: test-reports-* |
| 222 | + merge-multiple: true |
| 223 | + path: reports/ |
| 224 | + - name: Test Summary |
| 225 | + uses: test-summary/action@v2 |
| 226 | + if: always() |
| 227 | + with: |
| 228 | + paths: "reports/*.xml" |
0 commit comments