Skip to content

Validate Patch

Validate Patch #18

Workflow file for this run

# 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: Validate Patch
on:
pull_request:
types: [ opened, synchronize, ready_for_review, reopened ]
branches: ["main"]
merge_group:
types: [checks_requested]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
validate-patch:
runs-on: ubuntu-latest
steps:
- name: Env
run: printenv
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Setup Gradle
uses: ./.github/actions/setup-gradle
with:
java-version: 23
gradle-cache-read-only: true
gradle-cache-write-only: false
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: Compile and validate
env:
SCAN_ARG: '--no-scan'
# Gradle flags
# --build-cache: Let Gradle restore the build cache
# --info: For now, we'll generate lots of logs while setting up the GH Actions
# --scan: Publish the build scan. This will only work on PRs from apache/kafka and trunk
# --no-scan: For public fork PRs, we won't attempt to publish the scan
run: |
./gradlew --build-cache --info $SCAN_ARG check siteDocTar -x test
- name: Annotate checkstyle errors
if: failure()
run: python .github/scripts/checkstyle.py
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
- name: Annotate Rat errors
if: failure()
run: python .github/scripts/rat.py
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
- name: Check generated documentation
# Check if there are any empty files under ./site-docs/generated, If any empty files are found, print an error
# message and list the empty files
run: |
tar zxvf core/build/distributions/kafka_2.13-$(./gradlew properties | grep version: | awk '{print $NF}' | head -n 1)-site-docs.tgz
if find ./site-docs/generated -type f -exec grep -L "." {} \; | grep -q "."; then
echo "One or more documentation files are empty!" >&2
find ./site-docs/generated -type f -exec grep -L "." {} \; >&2
exit 1
fi
build:
uses: ./.github/workflows/build.yml
with:
is-trunk: ${{ github.ref == 'refs/heads/trunk' }}
is-public-fork: ${{ github.event.pull_request.head.repo.fork || false }}
run-tests: false
secrets:
inherit