Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/upstream-sql-tests-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Upstream SQL tests by label

# Runs upstream-sql-tests.yml on a pull request when a maintainer adds the
# tests:run-core-sql label. Use it for a pull request that does not start
# that workflow itself, for example a change in client-v2 or jdbc-v2. The run
# removes the label when it ends, so to run the tests again, add the label
# again.
on:
# Not pull_request_target: the tests need no secrets, and pull_request runs
# the code of a fork with a read-only token. The `paths` filter of the
# pull_request trigger in upstream-sql-tests.yml also applies to a
# `labeled` event, so the label needs this workflow of its own.
pull_request:
types: [labeled]

permissions: {}

jobs:
upstream-sql-tests:
name: Upstream SQL tests
if: github.event.label.name == 'tests:run-core-sql'
uses: ./.github/workflows/upstream-sql-tests.yml
permissions:
contents: read

remove-label:
name: Remove the tests:run-core-sql label
needs: upstream-sql-tests
# The token of a pull request from a fork cannot write: remove the label
# by hand there.
if: >-
always() && github.event.label.name == 'tests:run-core-sql' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 5
# A separate job, so that the pull request code in upstream-sql-tests
# never gets a token that can write.
permissions:
pull-requests: write
steps:
- name: Remove the label
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
run: gh api -X DELETE "repos/$REPO/issues/$NUMBER/labels/tests%3Arun-core-sql" || true
4 changes: 4 additions & 0 deletions .github/workflows/upstream-sql-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ name: Upstream SQL tests
# (tests/queries/0_stateless) through clickhouse-java, with the `client`
# (client-v2) and the `jdbc` (jdbc-v2) backend of tests/clickhouse-client.
# See tests/clickhouse-client/README.md.
#
# upstream-sql-tests-label.yml also calls it, for the tests:run-core-sql
# label on a pull request.

permissions:
contents: read

on:
workflow_call:
workflow_dispatch:
inputs:
clickhouse_version:
Expand Down
9 changes: 9 additions & 0 deletions tests/clickhouse-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,15 @@ tests read their own queries from `system.query_log`.
runs the allowlist nightly, manually, and on pushes and pull requests that
change this directory or the workflow.

A pull request that changes only the clients (for example the fix of a
client bug, rule 2 of [`AGENTS.md`](AGENTS.md)) does not start it. To run
it on such a pull request, add the `tests:run-core-sql` label
([`upstream-sql-tests-label.yml`](../../.github/workflows/upstream-sql-tests-label.yml)).
The run tests the pull request as it is when the label is added, and removes
the label when it ends: to test a later push, add the label again. The token
of a pull request from a fork cannot remove the label, so remove it by hand
before you add it again.

- The `build` job builds the shim against the source of the commit, runs its
unit and live tests on the pinned server, and gives the jar to the test
jobs.
Expand Down
Loading