Skip to content

Commit c228a20

Browse files
authored
ci: test sqlsmith on release (#13072)
1 parent 3326c75 commit c228a20

File tree

5 files changed

+70
-31
lines changed

5 files changed

+70
-31
lines changed

.github/actions/publish_binary/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
description: "Release target"
99
required: true
1010
category:
11-
description: "Release default / hdfs"
11+
description: "Release default/hdfs/testsuite"
1212
required: false
1313
default: default
1414

@@ -26,6 +26,9 @@ runs:
2626
hdfs)
2727
publish_name="databend-hdfs-${{ inputs.version }}-${{ inputs.target }}"
2828
;;
29+
testsuite)
30+
publish_name="databend-testsuite-${{ inputs.version }}-${{ inputs.target }}"
31+
;;
2932
*)
3033
echo "Unknown release category {{ inputs.category }}"
3134
exit 1

.github/workflows/release.yml

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ jobs:
187187
with:
188188
sha: ${{ github.sha }}
189189
target: ${{ steps.target.outputs.target }}
190-
artifacts: sqllogictests,metactl,meta,query
190+
artifacts: sqllogictests,sqlsmith,metactl,meta,query
191191
upload: false
192192
- name: Basic Sqllogic Test
193193
if: matrix.arch == 'x86_64'
@@ -198,29 +198,35 @@ jobs:
198198
mkdir -p target/release
199199
cp ./target/${{ steps.target.outputs.target }}/release/databend-{meta,query,sqllogictests} ./target/release/
200200
bash ./scripts/ci/ci-run-sqllogic-tests.sh base
201-
- name: Pack binaries
201+
- name: Pack Binaries
202202
run: |
203203
target=${{ steps.target.outputs.target }}
204204
version=${{ needs.create_release.outputs.version }}
205205
mkdir -p release/${target}/{bin,configs,systemd,scripts}
206-
cp ./target/${target}/release/databend-* release/${target}/bin/
206+
cp ./target/${target}/release/databend-{query,meta,metactl} release/${target}/bin/
207207
rm -f release/${target}/bin/*.d
208208
cp ./scripts/distribution/systemd/databend-* release/${target}/systemd/
209209
cp ./scripts/distribution/configs/databend-* release/${target}/configs/
210210
cp ./scripts/distribution/release-readme.txt release/${target}/readme.txt
211211
cp -r ./scripts/distribution/local-scripts/* release/${target}/scripts/
212212
cp -r ./scripts/distribution/package-scripts/* release/${target}/scripts/
213213
tar -C ./release/${target} -czvf databend-${version}-${target}.tar.gz bin configs systemd scripts readme.txt
214-
- name: generate sha256sums
214+
sha256sum databend-${version}-${target}.tar.gz >> sha256-${version}-${target}.txt
215+
- name: Pack Testsuite
216+
if: steps.target.outputs.target == 'x86_64-unknown-linux-gnu'
215217
run: |
216218
target=${{ steps.target.outputs.target }}
217219
version=${{ needs.create_release.outputs.version }}
218-
sha256sum databend-${version}-${target}.tar.gz >> sha256-${version}-${target}.txt
220+
mkdir -p release/testsuite/bin
221+
cp -r ./tests/sqllogictests/suites ./release/testsuite/
222+
cp ./target/${target}/release/databend-{sqllogictests,sqlsmith} release/testsuite/bin/
223+
tar -C ./release/testsuite -czvf databend-testsuite-${version}-${target}.tar.gz bin suites
224+
sha256sum databend-testsuite-${version}-${target}.tar.gz >> sha256-testsuite-${version}-${target}.txt
219225
- name: post sha256
220226
uses: actions/upload-artifact@v3
221227
with:
222228
name: sha256sums
223-
path: sha256-${{ needs.create_release.outputs.version }}-${{ steps.target.outputs.target }}.txt
229+
path: sha256-*.txt
224230
retention-days: 1
225231
- name: Publish Binaries
226232
uses: ./.github/actions/publish_binary
@@ -233,6 +239,15 @@ jobs:
233239
with:
234240
version: ${{ needs.create_release.outputs.version }}
235241
target: ${{ steps.target.outputs.target }}
242+
- name: Publish Testsuite
243+
if: steps.target.outputs.target == 'x86_64-unknown-linux-gnu'
244+
uses: ./.github/actions/publish_binary
245+
env:
246+
GH_TOKEN: ${{ github.token }}
247+
with:
248+
version: ${{ needs.create_release.outputs.version }}
249+
target: ${{ steps.target.outputs.target }}
250+
category: testsuite
236251

237252
hdfs:
238253
runs-on: [self-hosted, X64, Linux, 16c32g, gcp]
@@ -283,16 +298,12 @@ jobs:
283298
cp -r ./scripts/distribution/local-scripts/* release/${target}/scripts/
284299
cp -r ./scripts/distribution/package-scripts/* release/${target}/scripts/
285300
tar -C ./release/${target} -czvf databend-hdfs-${version}-${target}.tar.gz bin configs systemd scripts readme.txt
286-
- name: generate sha256sums
287-
run: |
288-
target=${{ steps.target.outputs.target }}
289-
version=${{ needs.create_release.outputs.version }}
290301
sha256sum databend-hdfs-${version}-${target}.tar.gz >> sha256-hdfs-${version}-${target}.txt
291302
- name: post sha256
292303
uses: actions/upload-artifact@v3
293304
with:
294305
name: sha256sums
295-
path: sha256-hdfs-${{ needs.create_release.outputs.version }}-${{ steps.target.outputs.target }}.txt
306+
path: sha256-*.txt
296307
retention-days: 1
297308
- name: Publish Binaries
298309
uses: ./.github/actions/publish_binary
@@ -307,23 +318,6 @@ jobs:
307318
target: ${{ steps.target.outputs.target }}
308319
category: hdfs
309320

310-
testsuites:
311-
runs-on: ubuntu-latest
312-
needs: create_release
313-
steps:
314-
- name: Checkout
315-
uses: actions/checkout@v4
316-
- name: Get the version
317-
id: get_version
318-
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
319-
- name: Upload to github release
320-
env:
321-
GH_TOKEN: ${{ github.token }}
322-
run: |
323-
version=${{ needs.create_release.outputs.version }}
324-
tar -C ./tests/sqllogictests -czvf testsuites-${version}.tar.gz suites
325-
gh release upload ${version} testsuites-${version}.tar.gz --clobber
326-
327321
docker_combined:
328322
name: docker combined
329323
runs-on: ubuntu-latest
@@ -559,6 +553,35 @@ jobs:
559553
version: ${{ needs.create_release.outputs.version }}
560554
runner_provider: aws
561555

556+
sqlsmith:
557+
needs: [create_release, linux]
558+
runs-on: ubuntu-latest
559+
steps:
560+
- uses: actions/checkout@v4
561+
- name: Download artifact for release
562+
env:
563+
GH_TOKEN: ${{ github.token }}
564+
run: |
565+
version=${{ needs.create_release.outputs.version }}
566+
target=x86_64-unknown-linux-gnu
567+
mkdir -p ./distro/
568+
mkdir -p ./target/release/
569+
gh release download ${version} --pattern "databend-${version}-${target}.tar.gz" --dir distro/
570+
gh release download ${version} --pattern "databend-testsuite-${version}-${target}.tar.gz" --dir distro/
571+
tar x -C ./target/release -f ./distro/databend-${version}-${target}.tar.gz --strip-components 1 bin/
572+
tar x -C ./target/release -f ./distro/databend-testsuite-${version}-${target}.tar.gz --strip-components 1 bin/
573+
chmod +x ./target/release/databend-*
574+
- name: Run sqlsmith
575+
timeout-minutes: 30
576+
shell: bash
577+
run: |
578+
bash ./scripts/ci/ci-run-sqlsmith-tests.sh
579+
- name: Upload failure
580+
if: failure()
581+
uses: ./.github/actions/artifact_failure
582+
with:
583+
name: test-sqlsmith
584+
562585
bindings_python:
563586
needs: create_release
564587
uses: ./.github/workflows/bindings.python.yml

scripts/build/build-debug.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
88
cd "$SCRIPT_PATH/../.." || exit
99

1010
echo "Build(DEBUG) start..."
11-
cargo build --bin=databend-query --bin=databend-meta --bin=databend-metactl --bin=open-sharing --bin=databend-query-oss --bin=databend-meta-oss
11+
cargo build --bin=databend-query --bin=databend-meta --bin=databend-metactl --bin=databend-sqllogictests --bin=databend-sqlsmith
1212
echo "All done..."

scripts/ci/ci-run-sqlsmith-tests.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# Copyright 2020-2021 The Databend Authors.
3+
# SPDX-License-Identifier: Apache-2.0.
4+
5+
set -e
6+
7+
echo "Starting standalone DatabendQuery and DatabendMeta"
8+
./scripts/ci/deploy/databend-query-standalone.sh
9+
10+
BUILD_PROFILE=${BUILD_PROFILE:-debug}
11+
12+
echo 'Starting databend-sqlsmith tests...'
13+
nohup target/${BUILD_PROFILE}/databend-sqlsmith

src/tests/sqlsmith/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ common-io = { path = "../../common/io" }
2929
common-sql = { path = "../../query/sql" }
3030

3131
[[bin]]
32-
name = "sqlsmith"
32+
name = "databend-sqlsmith"
3333
path = "src/bin/main.rs"

0 commit comments

Comments
 (0)