name: Nightly JSONBench on: schedule: # Trigger at 00:00(Asia/Shanghai) on every weekday. - cron: "0 16 * * 0-4" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: jsonbench: name: Run JSONBench if: ${{ github.repository == 'GreptimeTeam/greptimedb' }} runs-on: ubuntu-latest timeout-minutes: 120 env: JSONBENCH_DATA_DIR: /home/runner/data/bluesky JSONBENCH_OUTPUT_PREFIX: _ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Rust Cache uses: Swatinem/rust-cache@v2 with: shared-key: "nightly-jsonbench" cache-all-crates: "true" save-if: ${{ github.ref == 'refs/heads/main' }} - name: Build GreptimeDB run: cargo build --profile nightly --bin greptime - name: Reclaim disk space shell: bash run: | set -euo pipefail mkdir -p "${RUNNER_TEMP}/greptimedb-bin" cp ./target/nightly/greptime "${RUNNER_TEMP}/greptimedb-bin/greptime" chmod +x "${RUNNER_TEMP}/greptimedb-bin/greptime" rm -rf ./target - name: Run JSONBench shell: bash run: | set -euo pipefail cd "${RUNNER_TEMP}" cp "${RUNNER_TEMP}/greptimedb-bin/greptime" ./greptime chmod +x ./greptime export GREPTIMEDB_STANDALONE__WAL__DIR=greptimedb_data/wal export GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME=greptimedb_data export GREPTIMEDB_STANDALONE__LOGGING__DIR=greptimedb_data/logs export GREPTIMEDB_STANDALONE__LOGGING__APPEND_STDOUT=false export GREPTIMEDB_STANDALONE__HTTP__BODY_LIMIT=1GB export GREPTIMEDB_STANDALONE__HTTP__TIMEOUT=500s ./greptime standalone start > greptimedb.log 2>&1 & greptime_pid=$! trap 'kill "${greptime_pid}" 2>/dev/null || true' EXIT until curl -s --fail -o /dev/null http://localhost:4000/health; do if ! kill -0 "${greptime_pid}" 2>/dev/null; then cat greptimedb.log exit 1 fi sleep 1 done git clone --branch greptimedb-new-json --depth 1 https://github.com/GreptimeTeam/JSONBench.git JSONBench cp ./greptime JSONBench/greptimedb/greptime cd JSONBench/greptimedb ./main.sh 3 "${JSONBENCH_DATA_DIR}" success.log error.log "${JSONBENCH_OUTPUT_PREFIX}" false - name: Upload JSONBench results if: always() uses: actions/upload-artifact@v4 with: name: jsonbench-results path: | ${{ runner.temp }}/greptimedb.log ${{ runner.temp }}/JSONBench/greptimedb/*.log ${{ runner.temp }}/JSONBench/greptimedb/*.total_size ${{ runner.temp }}/JSONBench/greptimedb/*.data_size ${{ runner.temp }}/JSONBench/greptimedb/*.index_size ${{ runner.temp }}/JSONBench/greptimedb/*.count ${{ runner.temp }}/JSONBench/greptimedb/*.results_runtime ${{ runner.temp }}/JSONBench/greptimedb/*.query_results if-no-files-found: ignore retention-days: 7