diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index bcb03c95..3eb15bd6 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,6 +1,10 @@ name: Setup Rust Builder description: 'Prepare Rust Build Environment' inputs: + runner: + description: 'runner provider' + required: true + default: 'github' cache-key: description: 'the rust cache key suffix' required: false @@ -22,7 +26,8 @@ runs: - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.4 - - name: Cache Cargo + - name: Cache Cargo for Github Runner + if: inputs.runner == 'github' uses: actions/cache@v4 with: path: | @@ -33,6 +38,23 @@ runs: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} ${{ runner.os }}-cargo + - name: Cache Cargo for AWS Self-Hosted Runner + if: inputs.runner == 'aws' + uses: everpcpc/actions-cache@v2 + env: + AWS_REGION: us-east-2 + with: + provider: s3 + bucket: "databend-ci" + root: "bendsql/cache" + path: | + ~/.cargo/registry/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ steps.toolchain.outputs.cachekey }}-${{ inputs.cache-key }} + restore-keys: | + ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ steps.toolchain.outputs.cachekey }} + ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + ${{ runner.os }}-cargo + - name: Setup rust related environment variables shell: bash run: | @@ -48,6 +70,20 @@ runs: echo "RUST_LOG=info" >> $GITHUB_ENV # Enable sparse index echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV - # Enable sccache + + - name: Enable sccache for Github Actions + shell: bash + if: inputs.runner == 'github' + run: | echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + + - name: Enable sccache for AWS Self-Hosted Actions + shell: bash + if: inputs.runner == 'aws' + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_BUCKET=databend-ci" >> $GITHUB_ENV + echo "SCCACHE_REGION=us-east-2" >> $GITHUB_ENV + echo "SCCACHE_S3_KEY_PREFIX=bendsql/sccache/" >> $GITHUB_ENV + echo "SCCACHE_S3_USE_SSL=true" >> $GITHUB_ENV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3b29348..c583562b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,12 +50,19 @@ jobs: integration: needs: check - runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, X64, 4c8g, aws] steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup with: + runner: aws cache-key: integration + - name: Get License from S3 + run: | + aws s3 cp s3://databend-ci/misc/license.key license.key + aws s3 cp s3://databend-ci/misc/license.json license.json + cat license.json + echo "QUERY_DATABEND_ENTERPRISE_LICENSE=$(cat license.key)" >> $GITHUB_ENV - run: make -C tests test-core - run: make -C tests test-driver - run: make -C tests test-bendsql diff --git a/cli/test.sh b/cli/test.sh index dc16e3fd..f4e4e3f1 100755 --- a/cli/test.sh +++ b/cli/test.sh @@ -29,23 +29,9 @@ case $TEST_HANDLER in "flight") echo "==> Testing Flight SQL handler" export BENDSQL_DSN="databend+flight://${DATABEND_USER}:${DATABEND_PASSWORD}@${DATABEND_HOST}:8900/?sslmode=disable" - export BENDSQL="${CARGO_TARGET_DIR}/debug/bendsql" ;; "http") echo "==> Testing REST API handler" - export BENDSQL="${CARGO_TARGET_DIR}/debug/bendsql" - - echo "create user if not exists databend identified by 'databend'" | $BENDSQL -dsn="databend+http://${DATABEND_USER}:${DATABEND_PASSWORD}@${DATABEND_HOST}:8000/?sslmode=disable&presign=on" - echo "grant all on *.* to databend" | $BENDSQL -dsn="databend+http://${DATABEND_USER}:${DATABEND_PASSWORD}@${DATABEND_HOST}:8000/?sslmode=disable&presign=on" - - export BENDSQL_NEW="${BENDSQL} --user databend --password databend --host ${DATABEND_HOST} --port 8000" - - $BENDSQL_NEW --query="select 1 from numbers(10) where number > 1000" - $BENDSQL_NEW --query="create database if not exists aaa" - $BENDSQL_NEW -D aaa --query="create table if not exists bbb(a int)" - $BENDSQL_NEW -D aaa --query="drop table bbb" - $BENDSQL_NEW -D default --query="drop database aaa" - export BENDSQL_DSN="databend+http://${DATABEND_USER}:${DATABEND_PASSWORD}@${DATABEND_HOST}:8000/?sslmode=disable&presign=on" ;; *) @@ -54,6 +40,8 @@ case $TEST_HANDLER in ;; esac +export BENDSQL="${CARGO_TARGET_DIR}/debug/bendsql" + for tf in cli/tests/*.{sql,sh}; do [[ -e "$tf" ]] || continue echo " Running test -- ${tf}" diff --git a/cli/tests/http/05-stream.sh b/cli/tests/http/05-stream.sh index e2d5dad0..d8547945 100644 --- a/cli/tests/http/05-stream.sh +++ b/cli/tests/http/05-stream.sh @@ -1,22 +1,21 @@ #!/bin/bash -## uncomment these when QUERY_DATABEND_ENTERPRISE_LICENSE env is set -# cat <