diff --git a/.github/workflows/aws_test.yml b/.github/workflows/aws_test.yml index 81df15a5b..d13fb6100 100644 --- a/.github/workflows/aws_test.yml +++ b/.github/workflows/aws_test.yml @@ -19,26 +19,30 @@ name: AWS Tests on: push: - branches: - - main - tags: - - '**' + branches: [main] + paths: &module_paths + - 'src/iceberg/arrow/**' + - 'src/iceberg/catalog/rest/auth/**' + - 'src/iceberg/catalog/rest/http_*' + - 'src/iceberg/catalog/rest/rest_file_io.*' + - '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' + - '!**/*.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 +92,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 +156,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 000000000..bb0a8c45f --- /dev/null +++ b/.github/workflows/hive_test.yml @@ -0,0 +1,111 @@ +# 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/hive/**' + - 'thirdparty/hive_metastore/**' + - 'src/iceberg/test/hive_*' + - 'src/iceberg/test/hms_*' + - 'dev/update_hive_thrift.sh' + - 'ci/scripts/build_iceberg.sh' + - '!**/*.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 000000000..8b4b6e954 --- /dev/null +++ b/.github/workflows/module_ci_comment.yml @@ -0,0 +1,101 @@ +# 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: + 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' && + startsWith(github.event.comment.body, '/ci ') + 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 }} + run: | + case "$COMMAND" in + '/ci aws'|'/ci hive'|'/ci sql') module=${COMMAND#/ci } ;; + *) exit 0 ;; + esac + + permission=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$COMMENT_AUTHOR/permission" --jq '.permission') + [[ "$permission" =~ ^(write|maintain|admin)$ ]] || exit 0 + + sha=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq 'select(.state == "open") | .head.sha') + [[ -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' + uses: ./.github/workflows/aws_test.yml + with: &pr_head + pr_head_sha: ${{ needs.authorize.outputs.pr_head_sha }} + + hive: + needs: authorize + if: needs.authorize.outputs.module == 'hive' + uses: ./.github/workflows/hive_test.yml + with: *pr_head + + sql: + needs: authorize + if: needs.authorize.outputs.module == 'sql' + uses: ./.github/workflows/sql_catalog_test.yml + with: *pr_head + + 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 }} + MODULE: ${{ needs.authorize.outputs.module }} + SHA: ${{ needs.authorize.outputs.pr_head_sha }} + RESULT: ${{ needs[needs.authorize.outputs.module].result }} + run: | + run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/attempts/$GITHUB_RUN_ATTEMPT" + gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" \ + --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 c932afefe..f0e2549d6 100644 --- a/.github/workflows/sql_catalog_test.yml +++ b/.github/workflows/sql_catalog_test.yml @@ -19,26 +19,23 @@ name: SQL Catalog Tests on: push: - branches: - - main - tags: - - '**' + branches: [main] + paths: &module_paths + - 'src/iceberg/catalog/sql/**' + - 'src/iceberg/test/sql_catalog_*' + - '!**/*.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 +72,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 +133,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 41b567af4..2ccc69934 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 009c99554..5fb0148c9 100644 --- a/mkdocs/docs/contributing.md +++ b/mkdocs/docs/contributing.md @@ -107,6 +107,26 @@ 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 a module's source directories, tests, or +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. + +| Comment | Test suite | +|---------|------------| +| `/ci aws` | AWS S3 and SigV4 | +| `/ci hive` | Hive Catalog | +| `/ci sql` | SQL Catalog | + +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 Follow [Conventional Commits](https://www.conventionalcommits.org/):