From ecac47bf4ffff217563249715ac928457f46066c Mon Sep 17 00:00:00 2001 From: Harsha Vardhan Date: Wed, 9 Sep 2026 13:51:08 +0530 Subject: [PATCH] ci(automation): enhance repository automation and code quality workflows (#320) --- .github/workflows/commit-check.yml | 54 ++++++++++++++++++++++ .github/workflows/release-notes.yml | 42 +++++++++++++++++ computer/computer-test/pom.xml | 1 - computer/pom.xml | 9 ++++ docs/automation-guide.md | 72 +++++++++++++++++++++++++++++ 5 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/commit-check.yml create mode 100644 .github/workflows/release-notes.yml create mode 100644 docs/automation-guide.md diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml new file mode 100644 index 000000000..5d5b6d153 --- /dev/null +++ b/.github/workflows/commit-check.yml @@ -0,0 +1,54 @@ +# +# 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: "Commit & PR Title Validation" + +on: + pull_request: + types: + - opened + - edited + - synchronize + - reopened + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + validate-pr-title: + name: Validate PR Title & Format + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - name: Validate PR Title Format + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + feat + fix + docs + style + refactor + perf + test + chore + ci + build + requireScope: false diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 000000000..d68986dd7 --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,42 @@ +# +# 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: "Release Notes Generator" + +on: + push: + tags: + - '*.*.*' + +jobs: + generate-release-notes: + name: Generate Release Draft & Notes + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate Release Notes + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + draft: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/computer/computer-test/pom.xml b/computer/computer-test/pom.xml index 16f17a7fa..9e5abdc30 100644 --- a/computer/computer-test/pom.xml +++ b/computer/computer-test/pom.xml @@ -176,7 +176,6 @@ org.jacoco jacoco-maven-plugin - 0.8.4 pre-test diff --git a/computer/pom.xml b/computer/pom.xml index 05f25583f..570487d5c 100644 --- a/computer/pom.xml +++ b/computer/pom.xml @@ -302,6 +302,15 @@ + + + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + diff --git a/docs/automation-guide.md b/docs/automation-guide.md new file mode 100644 index 000000000..1a45535ff --- /dev/null +++ b/docs/automation-guide.md @@ -0,0 +1,72 @@ + + +# Automation & Code Quality Guide + +This guide details the repository automations and code quality tools configured for **HugeGraph Computer** and **Vermeer** as recommended in Automation Analysis [#320](https://github.com/apache/hugegraph-computer/issues/320). + +--- + +## Code Quality & Formatting Automations + +### 1. Code Style & License Checks +- **Checkstyle (`maven-checkstyle-plugin`):** Enforces Java coding style guidelines defined in `checkstyle.xml`. +- **Apache RAT (`apache-rat-plugin`):** Verifies Apache license headers across all project source files. + +```bash +# Run Checkstyle validation +mvn checkstyle:check + +# Run Apache RAT license validation +mvn apache-rat:check +``` + +### 2. Test Coverage (`jacoco-maven-plugin`) +JaCoCo tracks unit and integration test coverage during build execution. + +```bash +# Run unit tests and generate JaCoCo coverage report +mvn test -P unit-test + +# Inspect generated report at: +# target/site/jacoco/jacoco.xml +``` + +--- + +## CI/CD Workflows + +| Workflow | Path | Trigger | Description | +|----------|------|---------|-------------| +| **Commit Check** | `.github/workflows/commit-check.yml` | Pull Request | Validates PR titles against Conventional Commits formatting rules. | +| **Computer CI** | `.github/workflows/computer-ci.yml` | Push / PR | Compiles, runs RAT, HDFS, K8s, and Java unit/integration tests. | +| **Vermeer CI** | `.github/workflows/vermeer-ci.yml` | Push / PR | Builds Vermeer Go binary, checks UI assets, and tests Docker builds. | +| **Release Notes** | `.github/workflows/release-notes.yml` | Tag Push (`*.*.*`) | Automatically drafts GitHub release notes from git history. | + +--- + +## PR Title Guidelines + +Pull requests must follow the Conventional Commits specification: + +`(): ` + +- **Allowed Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci`, `build` +- **Examples:** + - `feat(computer): support new edge format in 1.7` + - `fix(vermeer): handle timeout during worker registration` + - `ci(automation): add pr title validation and release workflows`