From 176ccf4dd97fc5c35c3a9f21cfad00703c8a32a3 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Wed, 2 Dec 2026 00:05:08 +0800 Subject: [PATCH 1/4] ci: run module tests on relevant changes or PR commands --- .github/workflows/aws_test.yml | 64 ++++++++---- .github/workflows/hive_test.yml | 124 ++++++++++++++++++++++++ .github/workflows/module_ci_comment.yml | 116 ++++++++++++++++++++++ .github/workflows/sql_catalog_test.yml | 48 +++++---- .github/workflows/test.yml | 59 ----------- mkdocs/docs/contributing.md | 18 ++++ 6 files changed, 336 insertions(+), 93 deletions(-) create mode 100644 .github/workflows/hive_test.yml create mode 100644 .github/workflows/module_ci_comment.yml diff --git a/.github/workflows/aws_test.yml b/.github/workflows/aws_test.yml index 81df15a5bb..4a7bc46e6e 100644 --- a/.github/workflows/aws_test.yml +++ b/.github/workflows/aws_test.yml @@ -19,26 +19,55 @@ name: AWS Tests on: push: - branches: - - main - tags: - - '**' + branches: [main] + paths: &module_paths + - 'src/iceberg/arrow/CMakeLists.txt' + - 'src/iceberg/arrow/arrow_io*' + - 'src/iceberg/arrow/arrow_register.*' + - 'src/iceberg/arrow/s3/**' + - 'src/iceberg/catalog/rest/CMakeLists.txt' + - 'src/iceberg/catalog/rest/auth/CMakeLists.txt' + - 'src/iceberg/catalog/rest/auth/auth_manager*' + - 'src/iceberg/catalog/rest/auth/auth_properties.*' + - 'src/iceberg/catalog/rest/auth/auth_session.*' + - 'src/iceberg/catalog/rest/auth/sigv4*' + - 'src/iceberg/catalog/rest/http_client.*' + - 'src/iceberg/catalog/rest/http_request.*' + - 'src/iceberg/catalog/rest/rest_file_io.*' + - 'src/iceberg/file_io_registry.*' + - 'src/iceberg/resolving_file_io.*' + - 'src/iceberg/storage_credential.h' + - 'src/iceberg/test/arrow_io_test.cc' + - 'src/iceberg/test/arrow_s3*' + - 'src/iceberg/test/rest_arrow_file_io_test.cc' + - 'src/iceberg/test/sigv4*' + - 'ci/scripts/build_iceberg.sh' + - 'ci/scripts/start_object_store.sh' + - '.github/actions/*-sccache/**' + # Shared build configuration used by this suite. + - 'CMakeLists.txt' + - 'src/CMakeLists.txt' + - 'src/iceberg/CMakeLists.txt' + - 'src/iceberg/catalog/CMakeLists.txt' + - 'src/iceberg/test/CMakeLists.txt' + - 'src/iceberg/iceberg-config.cmake.in' + - 'cmake_modules/IcebergBuildUtils.cmake' + - 'cmake_modules/IcebergThirdpartyToolchain.cmake' + - 'cmake_modules/arrow-thirdparty-dir.patch' + - '.github/workflows/aws_test.yml' + - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] - paths: - # Run for code/build changes and this suite's workflow dependencies. - - '**' - - '!.asf.yaml' - - '!.devcontainer/**' - - '!.github/**' - - '!**/*.md' - - '!dev/**' - - '!mkdocs/**' - - '.github/workflows/aws_test.yml' - - '.github/actions/**' + paths: *module_paths + workflow_call: + inputs: + pr_head_sha: + description: PR head commit selected by the comment command + type: string + required: true concurrency: - group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} + group: aws-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.issue.number || github.sha }} cancel-in-progress: true permissions: @@ -88,6 +117,7 @@ jobs: - name: Checkout iceberg-cpp uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ inputs.pr_head_sha }} persist-credentials: false - name: Install dependencies on Ubuntu if: ${{ startsWith(matrix.runs-on, 'ubuntu') }} @@ -151,7 +181,7 @@ jobs: --sigv4 ${{ matrix.sigv4 }} \ --bundle-awssdk ${{ matrix.bundle_awssdk }} - name: Save sccache - if: always() + if: always() && github.event_name != 'issue_comment' uses: ./.github/actions/save-sccache with: key-prefix: sccache-aws-${{ matrix.runs-on }}-bundle${{ matrix.bundle_awssdk }}-s3${{ matrix.s3 }}-sigv4${{ matrix.sigv4 }} diff --git a/.github/workflows/hive_test.yml b/.github/workflows/hive_test.yml new file mode 100644 index 0000000000..c59da128e1 --- /dev/null +++ b/.github/workflows/hive_test.yml @@ -0,0 +1,124 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Hive Tests + +on: + push: + branches: [main] + paths: &module_paths + - 'src/iceberg/catalog.h' + - 'src/iceberg/catalog/hive/**' + - 'src/iceberg/test/hive_*' + - 'src/iceberg/test/hms_*' + - 'thirdparty/hive_metastore/**' + - 'dev/update_hive_thrift.sh' + - 'cmake_modules/FindThriftAlt.cmake' + - 'ci/scripts/build_iceberg.sh' + # Shared build configuration used by this suite. + - 'CMakeLists.txt' + - 'src/CMakeLists.txt' + - 'src/iceberg/CMakeLists.txt' + - 'src/iceberg/catalog/CMakeLists.txt' + - 'src/iceberg/test/CMakeLists.txt' + - 'src/iceberg/iceberg-config.cmake.in' + - 'cmake_modules/IcebergBuildUtils.cmake' + - 'cmake_modules/IcebergThirdpartyToolchain.cmake' + - 'cmake_modules/arrow-thirdparty-dir.patch' + - '.github/workflows/hive_test.yml' + - '!**/*.md' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: *module_paths + workflow_call: + inputs: + pr_head_sha: + description: PR head commit selected by the comment command + type: string + required: true + +concurrency: + group: hive-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.issue.number || github.sha }} + cancel-in-progress: true + +permissions: + contents: read + +env: + ICEBERG_HOME: /tmp/iceberg + +jobs: + hive: + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} + name: AMD64 Ubuntu 26.04 Hive (C++23) + runs-on: ubuntu-26.04 + timeout-minutes: 45 + strategy: + fail-fast: false + env: + SCCACHE_DIR: ${{ github.workspace }}/.sccache + SCCACHE_CACHE_SIZE: "2G" + ICEBERG_EXTRA_CMAKE_ARGS: "-DICEBERG_BUILD_HIVE=ON" + steps: + - name: Checkout iceberg-cpp + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.pr_head_sha }} + persist-credentials: false + - name: Install dependencies + shell: bash + run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.13' + # Arrow's bundled Boost.Locale 1.88.0 is incompatible with CMake 4.5. + - name: Pin CMake to 4.4.5 + shell: bash + run: | + python -m pip install "cmake==4.4.5" + cmake --version + test "$(cmake --version | head -n 1)" = "cmake version 4.4.5" + - name: Restore sccache cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ github.workspace }}/.sccache + key: sccache-test-hive-${{ github.run_id }} + restore-keys: | + sccache-test-hive- + sccache-test-ubuntu- + - name: Setup sccache + uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 + - name: Build and test Iceberg with Hive + shell: bash + env: + CC: gcc-14 + CXX: g++-14 + run: | + ci/scripts/build_iceberg.sh \ + --source-dir "$(pwd)" \ + --build-type Debug \ + --sccache ON + - name: Show sccache stats + shell: bash + run: sccache --show-stats + - name: Save sccache cache + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ github.workspace }}/.sccache + key: sccache-test-hive-${{ github.run_id }} diff --git a/.github/workflows/module_ci_comment.yml b/.github/workflows/module_ci_comment.yml new file mode 100644 index 0000000000..eafaf43d23 --- /dev/null +++ b/.github/workflows/module_ci_comment.yml @@ -0,0 +1,116 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: PR Module CI + +on: + # Trusted jobs authorize and report. Only the read-only, cache-read-only test job runs PR code. + issue_comment: # zizmor: ignore[dangerous-triggers] + types: [created] + +permissions: {} + +jobs: + authorize: + if: >- + github.event.issue.pull_request && github.event.issue.state == 'open' && + contains(fromJSON('["/ci aws", "/ci hive", "/ci sql"]'), github.event.comment.body) + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + pull-requests: read + outputs: + module: ${{ steps.request.outputs.module }} + pr_head_sha: ${{ steps.request.outputs.pr_head_sha }} + steps: + - name: Verify command and resolve PR head + id: request + env: + GH_TOKEN: ${{ github.token }} + COMMAND: ${{ github.event.comment.body }} + COMMENT_AUTHOR: ${{ github.event.comment.user.login }} + PR_NUMBER: ${{ github.event.issue.number }} + shell: bash + run: | + # GitHub expression comparisons are case-insensitive. + case "$COMMAND" in + '/ci aws'|'/ci hive'|'/ci sql') ;; + *) exit 0 ;; + esac + + permission=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$COMMENT_AUTHOR/permission" --jq '.permission') + case "$permission" in + write|maintain|admin) ;; + *) exit 0 ;; + esac + + sha=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq 'select(.state == "open") | .head.sha') + if [[ -n "$sha" ]]; then + echo "module=${COMMAND#/ci }" >> "$GITHUB_OUTPUT" + echo "pr_head_sha=$sha" >> "$GITHUB_OUTPUT" + fi + + aws: + needs: authorize + if: needs.authorize.outputs.module == 'aws' + permissions: + contents: read + cache-mode: read + uses: ./.github/workflows/aws_test.yml + with: + pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} + + hive: + needs: authorize + if: needs.authorize.outputs.module == 'hive' + permissions: + contents: read + cache-mode: read + uses: ./.github/workflows/hive_test.yml + with: + pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} + + sql: + needs: authorize + if: needs.authorize.outputs.module == 'sql' + permissions: + contents: read + cache-mode: read + uses: ./.github/workflows/sql_catalog_test.yml + with: + pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} + + report: + needs: [authorize, aws, hive, sql] + if: always() && needs.authorize.outputs.module != '' + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + pull-requests: write + steps: + - name: Post test result to the PR + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.issue.number }} + MODULE: ${{ needs.authorize.outputs.module }} + SHA: ${{ needs.authorize.outputs.pr_head_sha }} + RESULT: ${{ needs[needs.authorize.outputs.module].result }} + shell: bash + run: | + run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/attempts/$GITHUB_RUN_ATTEMPT" + gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" --silent \ + -f "body=Module CI for $MODULE at $SHA finished with **$RESULT**. [View run]($run_url)" diff --git a/.github/workflows/sql_catalog_test.yml b/.github/workflows/sql_catalog_test.yml index c932afefed..8a5a5cb3bd 100644 --- a/.github/workflows/sql_catalog_test.yml +++ b/.github/workflows/sql_catalog_test.yml @@ -19,26 +19,39 @@ name: SQL Catalog Tests on: push: - branches: - - main - tags: - - '**' + branches: [main] + paths: &module_paths + - 'src/iceberg/catalog.h' + - 'src/iceberg/catalog/catalog_util.*' + - 'src/iceberg/catalog/sql/**' + - 'src/iceberg/test/sql_catalog_*' + - '.github/actions/*-sccache/**' + - '.github/actions/sccache/**' + # Shared build configuration used by this suite. + - 'CMakeLists.txt' + - 'src/CMakeLists.txt' + - 'src/iceberg/CMakeLists.txt' + - 'src/iceberg/catalog/CMakeLists.txt' + - 'src/iceberg/test/CMakeLists.txt' + - 'src/iceberg/iceberg-config.cmake.in' + - 'cmake_modules/IcebergBuildUtils.cmake' + - 'cmake_modules/IcebergSccache.cmake' + - 'cmake_modules/IcebergThirdpartyToolchain.cmake' + - 'cmake_modules/arrow-thirdparty-dir.patch' + - '.github/workflows/sql_catalog_test.yml' + - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] - paths: - # Run for code/build changes and this suite's workflow dependencies. - - '**' - - '!.asf.yaml' - - '!.devcontainer/**' - - '!.github/**' - - '!**/*.md' - - '!dev/**' - - '!mkdocs/**' - - '.github/workflows/sql_catalog_test.yml' - - '.github/actions/**' + paths: *module_paths + workflow_call: + inputs: + pr_head_sha: + description: PR head commit selected by the comment command + type: string + required: true concurrency: - group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} + group: sql-catalog-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.issue.number || github.sha }} cancel-in-progress: true permissions: @@ -75,6 +88,7 @@ jobs: - name: Checkout iceberg-cpp uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ inputs.pr_head_sha }} persist-credentials: false - name: Set up MSVC Developer Command Prompt if: ${{ startsWith(matrix.runs-on, 'windows') }} @@ -135,7 +149,7 @@ jobs: shell: bash run: cmake --build build --target sql_catalog_test - name: Save sccache - if: always() + if: always() && github.event_name != 'issue_comment' uses: ./.github/actions/save-sccache with: key-prefix: sccache-sqlcatalog-${{ matrix.runs-on }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41b567af4b..2ccc699344 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -128,65 +128,6 @@ jobs: with: key-prefix: sccache-test-ubuntu-${{ matrix.cmake_build_type }} job-status: ${{ job.status }} - hive: - if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} - name: AMD64 Ubuntu 26.04 Hive (C++23) - runs-on: ubuntu-26.04 - timeout-minutes: 45 - strategy: - fail-fast: false - env: - SCCACHE_DIR: ${{ github.workspace }}/.sccache - SCCACHE_CACHE_SIZE: "2G" - ICEBERG_EXTRA_CMAKE_ARGS: "-DICEBERG_BUILD_HIVE=ON" - steps: - - name: Checkout iceberg-cpp - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - name: Install dependencies - shell: bash - run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev - - name: Set up Python - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 - with: - python-version: '3.13' - # Arrow's bundled Boost.Locale 1.88.0 is incompatible with CMake 4.5. - - name: Pin CMake to 4.4.5 - shell: bash - run: | - python -m pip install "cmake==4.4.5" - cmake --version - test "$(cmake --version | head -n 1)" = "cmake version 4.4.5" - - name: Restore sccache cache - uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-hive-${{ github.run_id }} - restore-keys: | - sccache-test-hive- - sccache-test-ubuntu- - - name: Setup sccache - uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 - - name: Build and test Iceberg with Hive - shell: bash - env: - CC: gcc-14 - CXX: g++-14 - run: | - ci/scripts/build_iceberg.sh \ - --source-dir "$(pwd)" \ - --build-type Debug \ - --sccache ON - - name: Show sccache stats - shell: bash - run: sccache --show-stats - - name: Save sccache cache - if: github.ref == 'refs/heads/main' - uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ github.workspace }}/.sccache - key: sccache-test-hive-${{ github.run_id }} macos: if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} name: AArch64 macOS 26 (C++20 Compat) diff --git a/mkdocs/docs/contributing.md b/mkdocs/docs/contributing.md index 009c995546..07163b5cc2 100644 --- a/mkdocs/docs/contributing.md +++ b/mkdocs/docs/contributing.md @@ -107,6 +107,24 @@ Then select `Dev Containers: Reopen in Container` from the Command Palette. 5. Ensure all tests pass and `pre-commit run -a` is clean 6. Push to your fork and open a Pull Request +### Running module tests + +The AWS, Hive, and SQL Catalog test suites run automatically on pull requests +and pushes to `main` that change the corresponding module, its tests, or its +build and CI dependencies. + +To request a suite for any open pull request, a contributor with write access +can post the corresponding command as a separate PR comment. + +| Comment | Test suite | +|---------|------------| +| `/ci aws` | AWS S3 and SigV4 | +| `/ci hive` | Hive Catalog | +| `/ci sql` | SQL Catalog | + +The workflow tests the PR head commit and posts the result, commit SHA, and +run link on the PR. To test a later commit, post the command again. + ### Commit Messages Follow [Conventional Commits](https://www.conventionalcommits.org/): From 9ef9b931d7933fd2c73a65c548b467dd2eefbb1f Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Wed, 2 Dec 2026 00:13:13 +0800 Subject: [PATCH 2/4] ci: simplify module paths and skip workflow-only changes --- .github/workflows/aws_test.yml | 33 +++++++------------------- .github/workflows/hive_test.yml | 13 ++++------ .github/workflows/sql_catalog_test.yml | 14 +++-------- mkdocs/docs/contributing.md | 10 ++++---- 4 files changed, 21 insertions(+), 49 deletions(-) diff --git a/.github/workflows/aws_test.yml b/.github/workflows/aws_test.yml index 4a7bc46e6e..a5cf3ab5a7 100644 --- a/.github/workflows/aws_test.yml +++ b/.github/workflows/aws_test.yml @@ -21,40 +21,23 @@ on: push: branches: [main] paths: &module_paths - - 'src/iceberg/arrow/CMakeLists.txt' - - 'src/iceberg/arrow/arrow_io*' - - 'src/iceberg/arrow/arrow_register.*' - - 'src/iceberg/arrow/s3/**' - - 'src/iceberg/catalog/rest/CMakeLists.txt' - - 'src/iceberg/catalog/rest/auth/CMakeLists.txt' - - 'src/iceberg/catalog/rest/auth/auth_manager*' - - 'src/iceberg/catalog/rest/auth/auth_properties.*' - - 'src/iceberg/catalog/rest/auth/auth_session.*' - - 'src/iceberg/catalog/rest/auth/sigv4*' - - 'src/iceberg/catalog/rest/http_client.*' - - 'src/iceberg/catalog/rest/http_request.*' + - 'src/iceberg/arrow/**' + - 'src/iceberg/catalog/rest/auth/**' + - 'src/iceberg/catalog/rest/http_*' - 'src/iceberg/catalog/rest/rest_file_io.*' - - 'src/iceberg/file_io_registry.*' - - 'src/iceberg/resolving_file_io.*' - - 'src/iceberg/storage_credential.h' - - 'src/iceberg/test/arrow_io_test.cc' - - 'src/iceberg/test/arrow_s3*' - - 'src/iceberg/test/rest_arrow_file_io_test.cc' + - 'src/iceberg/catalog/rest/CMakeLists.txt' + - 'src/iceberg/test/*arrow*io*' - 'src/iceberg/test/sigv4*' - 'ci/scripts/build_iceberg.sh' - 'ci/scripts/start_object_store.sh' - - '.github/actions/*-sccache/**' - # Shared build configuration used by this suite. + # Build files shared by the module suites. - 'CMakeLists.txt' - 'src/CMakeLists.txt' - 'src/iceberg/CMakeLists.txt' - 'src/iceberg/catalog/CMakeLists.txt' - 'src/iceberg/test/CMakeLists.txt' - - 'src/iceberg/iceberg-config.cmake.in' - - 'cmake_modules/IcebergBuildUtils.cmake' - - 'cmake_modules/IcebergThirdpartyToolchain.cmake' - - 'cmake_modules/arrow-thirdparty-dir.patch' - - '.github/workflows/aws_test.yml' + - 'src/iceberg/*.cmake.in' + - 'cmake_modules/**' - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/hive_test.yml b/.github/workflows/hive_test.yml index c59da128e1..1d1c143eeb 100644 --- a/.github/workflows/hive_test.yml +++ b/.github/workflows/hive_test.yml @@ -21,25 +21,20 @@ on: push: branches: [main] paths: &module_paths - - 'src/iceberg/catalog.h' - 'src/iceberg/catalog/hive/**' + - 'thirdparty/hive_metastore/**' - 'src/iceberg/test/hive_*' - 'src/iceberg/test/hms_*' - - 'thirdparty/hive_metastore/**' - 'dev/update_hive_thrift.sh' - - 'cmake_modules/FindThriftAlt.cmake' - 'ci/scripts/build_iceberg.sh' - # Shared build configuration used by this suite. + # Build files shared by the module suites. - 'CMakeLists.txt' - 'src/CMakeLists.txt' - 'src/iceberg/CMakeLists.txt' - 'src/iceberg/catalog/CMakeLists.txt' - 'src/iceberg/test/CMakeLists.txt' - - 'src/iceberg/iceberg-config.cmake.in' - - 'cmake_modules/IcebergBuildUtils.cmake' - - 'cmake_modules/IcebergThirdpartyToolchain.cmake' - - 'cmake_modules/arrow-thirdparty-dir.patch' - - '.github/workflows/hive_test.yml' + - 'src/iceberg/*.cmake.in' + - 'cmake_modules/**' - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/sql_catalog_test.yml b/.github/workflows/sql_catalog_test.yml index 8a5a5cb3bd..c9a0de30de 100644 --- a/.github/workflows/sql_catalog_test.yml +++ b/.github/workflows/sql_catalog_test.yml @@ -21,24 +21,16 @@ on: push: branches: [main] paths: &module_paths - - 'src/iceberg/catalog.h' - - 'src/iceberg/catalog/catalog_util.*' - 'src/iceberg/catalog/sql/**' - 'src/iceberg/test/sql_catalog_*' - - '.github/actions/*-sccache/**' - - '.github/actions/sccache/**' - # Shared build configuration used by this suite. + # Build files shared by the module suites. - 'CMakeLists.txt' - 'src/CMakeLists.txt' - 'src/iceberg/CMakeLists.txt' - 'src/iceberg/catalog/CMakeLists.txt' - 'src/iceberg/test/CMakeLists.txt' - - 'src/iceberg/iceberg-config.cmake.in' - - 'cmake_modules/IcebergBuildUtils.cmake' - - 'cmake_modules/IcebergSccache.cmake' - - 'cmake_modules/IcebergThirdpartyToolchain.cmake' - - 'cmake_modules/arrow-thirdparty-dir.patch' - - '.github/workflows/sql_catalog_test.yml' + - 'src/iceberg/*.cmake.in' + - 'cmake_modules/**' - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/mkdocs/docs/contributing.md b/mkdocs/docs/contributing.md index 07163b5cc2..dab694f9cc 100644 --- a/mkdocs/docs/contributing.md +++ b/mkdocs/docs/contributing.md @@ -110,8 +110,9 @@ Then select `Dev Containers: Reopen in Container` from the Command Palette. ### Running module tests The AWS, Hive, and SQL Catalog test suites run automatically on pull requests -and pushes to `main` that change the corresponding module, its tests, or its -build and CI dependencies. +and pushes to `main` that change a module's source directories, tests, or +build files. Changes to shared CMake configuration can trigger all three suites. +Workflow-only changes skip all three suites by default. To request a suite for any open pull request, a contributor with write access can post the corresponding command as a separate PR comment. @@ -122,8 +123,9 @@ can post the corresponding command as a separate PR comment. | `/ci hive` | Hive Catalog | | `/ci sql` | SQL Catalog | -The workflow tests the PR head commit and posts the result, commit SHA, and -run link on the PR. To test a later commit, post the command again. +The command uses the workflow definition from the default branch to test the +PR head commit. It posts the result, commit SHA, and run link on the PR. To +test a later commit, post the command again. ### Commit Messages From 4334ab1c683ad2c332af4d49acfeca47c4594e55 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Wed, 2 Dec 2026 00:19:43 +0800 Subject: [PATCH 3/4] ci: skip module suites for shared CMake changes --- .github/workflows/aws_test.yml | 8 -------- .github/workflows/hive_test.yml | 8 -------- .github/workflows/sql_catalog_test.yml | 8 -------- mkdocs/docs/contributing.md | 4 ++-- 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/aws_test.yml b/.github/workflows/aws_test.yml index a5cf3ab5a7..d13fb6100d 100644 --- a/.github/workflows/aws_test.yml +++ b/.github/workflows/aws_test.yml @@ -30,14 +30,6 @@ on: - 'src/iceberg/test/sigv4*' - 'ci/scripts/build_iceberg.sh' - 'ci/scripts/start_object_store.sh' - # Build files shared by the module suites. - - 'CMakeLists.txt' - - 'src/CMakeLists.txt' - - 'src/iceberg/CMakeLists.txt' - - 'src/iceberg/catalog/CMakeLists.txt' - - 'src/iceberg/test/CMakeLists.txt' - - 'src/iceberg/*.cmake.in' - - 'cmake_modules/**' - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/hive_test.yml b/.github/workflows/hive_test.yml index 1d1c143eeb..bb0a8c45fb 100644 --- a/.github/workflows/hive_test.yml +++ b/.github/workflows/hive_test.yml @@ -27,14 +27,6 @@ on: - 'src/iceberg/test/hms_*' - 'dev/update_hive_thrift.sh' - 'ci/scripts/build_iceberg.sh' - # Build files shared by the module suites. - - 'CMakeLists.txt' - - 'src/CMakeLists.txt' - - 'src/iceberg/CMakeLists.txt' - - 'src/iceberg/catalog/CMakeLists.txt' - - 'src/iceberg/test/CMakeLists.txt' - - 'src/iceberg/*.cmake.in' - - 'cmake_modules/**' - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/.github/workflows/sql_catalog_test.yml b/.github/workflows/sql_catalog_test.yml index c9a0de30de..f0e2549d6a 100644 --- a/.github/workflows/sql_catalog_test.yml +++ b/.github/workflows/sql_catalog_test.yml @@ -23,14 +23,6 @@ on: paths: &module_paths - 'src/iceberg/catalog/sql/**' - 'src/iceberg/test/sql_catalog_*' - # Build files shared by the module suites. - - 'CMakeLists.txt' - - 'src/CMakeLists.txt' - - 'src/iceberg/CMakeLists.txt' - - 'src/iceberg/catalog/CMakeLists.txt' - - 'src/iceberg/test/CMakeLists.txt' - - 'src/iceberg/*.cmake.in' - - 'cmake_modules/**' - '!**/*.md' pull_request: types: [opened, synchronize, reopened, ready_for_review] diff --git a/mkdocs/docs/contributing.md b/mkdocs/docs/contributing.md index dab694f9cc..5fb0148c9e 100644 --- a/mkdocs/docs/contributing.md +++ b/mkdocs/docs/contributing.md @@ -111,8 +111,8 @@ Then select `Dev Containers: Reopen in Container` from the Command Palette. The AWS, Hive, and SQL Catalog test suites run automatically on pull requests and pushes to `main` that change a module's source directories, tests, or -build files. Changes to shared CMake configuration can trigger all three suites. -Workflow-only changes skip all three suites by default. +build files. Changes limited to shared CMake configuration or workflow files +skip all three suites by default. To request a suite for any open pull request, a contributor with write access can post the corresponding command as a separate PR comment. From 5022c10f64216b5292215e6fa6eed63f3dced8d3 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Wed, 2 Dec 2026 00:35:55 +0800 Subject: [PATCH 4/4] ci: simplify PR comment dispatch for module tests --- .github/workflows/module_ci_comment.yml | 49 +++++++++---------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/.github/workflows/module_ci_comment.yml b/.github/workflows/module_ci_comment.yml index eafaf43d23..8b4b6e954a 100644 --- a/.github/workflows/module_ci_comment.yml +++ b/.github/workflows/module_ci_comment.yml @@ -22,13 +22,18 @@ on: issue_comment: # zizmor: ignore[dangerous-triggers] types: [created] -permissions: {} +permissions: + contents: read +cache-mode: read + +env: + PR_NUMBER: ${{ github.event.issue.number }} jobs: authorize: if: >- github.event.issue.pull_request && github.event.issue.state == 'open' && - contains(fromJSON('["/ci aws", "/ci hive", "/ci sql"]'), github.event.comment.body) + startsWith(github.event.comment.body, '/ci ') runs-on: ubuntu-24.04 timeout-minutes: 5 permissions: @@ -43,56 +48,38 @@ jobs: GH_TOKEN: ${{ github.token }} COMMAND: ${{ github.event.comment.body }} COMMENT_AUTHOR: ${{ github.event.comment.user.login }} - PR_NUMBER: ${{ github.event.issue.number }} - shell: bash run: | - # GitHub expression comparisons are case-insensitive. case "$COMMAND" in - '/ci aws'|'/ci hive'|'/ci sql') ;; + '/ci aws'|'/ci hive'|'/ci sql') module=${COMMAND#/ci } ;; *) exit 0 ;; esac permission=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$COMMENT_AUTHOR/permission" --jq '.permission') - case "$permission" in - write|maintain|admin) ;; - *) exit 0 ;; - esac + [[ "$permission" =~ ^(write|maintain|admin)$ ]] || exit 0 sha=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq 'select(.state == "open") | .head.sha') - if [[ -n "$sha" ]]; then - echo "module=${COMMAND#/ci }" >> "$GITHUB_OUTPUT" - echo "pr_head_sha=$sha" >> "$GITHUB_OUTPUT" - fi + [[ -n "$sha" ]] || exit 0 + echo "module=$module" >> "$GITHUB_OUTPUT" + echo "pr_head_sha=$sha" >> "$GITHUB_OUTPUT" aws: needs: authorize if: needs.authorize.outputs.module == 'aws' - permissions: - contents: read - cache-mode: read uses: ./.github/workflows/aws_test.yml - with: + with: &pr_head pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} hive: needs: authorize if: needs.authorize.outputs.module == 'hive' - permissions: - contents: read - cache-mode: read uses: ./.github/workflows/hive_test.yml - with: - pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} + with: *pr_head sql: needs: authorize if: needs.authorize.outputs.module == 'sql' - permissions: - contents: read - cache-mode: read uses: ./.github/workflows/sql_catalog_test.yml - with: - pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} + with: *pr_head report: needs: [authorize, aws, hive, sql] @@ -105,12 +92,10 @@ jobs: - name: Post test result to the PR env: GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.issue.number }} MODULE: ${{ needs.authorize.outputs.module }} SHA: ${{ needs.authorize.outputs.pr_head_sha }} RESULT: ${{ needs[needs.authorize.outputs.module].result }} - shell: bash run: | run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/attempts/$GITHUB_RUN_ATTEMPT" - gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" --silent \ - -f "body=Module CI for $MODULE at $SHA finished with **$RESULT**. [View run]($run_url)" + gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" \ + --body "Module CI for $MODULE at $SHA finished with **$RESULT**. [View run]($run_url)"