blob: bfc05f548816f3b92f6934a04ca9f82834b731a9 [file]
# 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.
# yamllint disable rule:line-length
---
name: Yetus Precommit Check
"on":
pull_request:
types: [opened, synchronize, reopened]
permissions: {}
jobs:
precommit-check:
runs-on: ubuntu-latest
timeout-minutes: 120
permissions:
contents: read
statuses: write
env:
YETUS_VERSION: '0.15.0'
steps:
- name: Checkout hbase-thirdparty
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: src
fetch-depth: 0
persist-credentials: false
- name: Set up JDK 17
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
java-version: '17'
distribution: 'temurin'
- name: Maven cache
uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0
with:
# With --mvn-custom-repos (see the driver script) Yetus keeps its
# Maven repository under ~/yetus-m2, not ~/.m2. The key is namespaced
# to this workflow so it does not race over the same cache entry with
# noop-htrace-dropin-check.yml, which really does use ~/.m2.
path: ~/yetus-m2
key: yetus-m2-${{ hashFiles('src/**/pom.xml') }}
restore-keys: |
yetus-m2-
- name: Download Yetus (pinned release)
run: |
mkdir -p yetus
cd yetus
bash "${{ github.workspace }}/src/dev-support/jenkins-scripts/cache-apache-project-artifact.sh" \
--keys 'https://downloads.apache.org/yetus/KEYS' \
--verify-tar-gz \
./apache-yetus-${{ env.YETUS_VERSION }}-bin.tar.gz \
yetus/${{ env.YETUS_VERSION }}/apache-yetus-${{ env.YETUS_VERSION }}-bin.tar.gz
tar --strip-components=1 -xzf apache-yetus-${{ env.YETUS_VERSION }}-bin.tar.gz
rm apache-yetus-${{ env.YETUS_VERSION }}-bin.tar.gz
- name: Run Yetus Precommit Check
env:
ARCHIVE_PATTERN_LIST: "TEST-*.xml,org.apache.h*.txt,*.dumpstream,*.dump"
DOCKERFILE: "${{ github.workspace }}/src/dev-support/jenkins/Dockerfile"
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USER: ${{ github.actor }}
PATCHDIR: "${{ github.workspace }}/yetus-precommit-check/output"
# the jira plugin treats the GH:NNN issue key as a JIRA key and hard
# exits in robot mode even though the github plugin already located
# the patch; hbase's workflows never enable it either.
PLUGINS: "all,-jira"
SET_JAVA_HOME: "/usr/lib/jvm/java-17"
SOURCEDIR: "${{ github.workspace }}/src"
YETUSDIR: "${{ github.workspace }}/yetus"
DEBUG: 'true'
run: |
cd "${{ github.workspace }}"
bash src/dev-support/jenkins/jenkins_precommit_github_yetus.sh
- name: Publish Job Summary
if: always()
run: |
cd "${{ github.workspace }}"
python3 src/dev-support/yetus_console_to_md.py yetus-precommit-check/output >> "$GITHUB_STEP_SUMMARY"
- name: Publish Results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: yetus-precommit-check-output
path: ${{ github.workspace }}/yetus-precommit-check/output
retention-days: 7
zizmor:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Check for workflow changes
id: changes
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh pr diff "${{ github.event.pull_request.number }}" --repo "${{ github.repository }}" --name-only | grep -q '^\.github/workflows/'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Checkout hbase-thirdparty
if: steps.changes.outputs.changed == 'true'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Run zizmor
if: steps.changes.outputs.changed == 'true'
run: pipx run zizmor --min-severity=medium .github/workflows/