-
Notifications
You must be signed in to change notification settings - Fork 52
ci(automation): enhance repository automation and code quality workflows (#320) #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| types: | | ||
| feat | ||
| fix | ||
| docs | ||
| style | ||
| refactor | ||
| perf | ||
| test | ||
| chore | ||
| ci | ||
| build | ||
| requireScope: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: | ||
| - '*.*.*' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GitHub tag filters are globs, not regular expressions, and This is the other side of the - '[0-9]+.[0-9]+.[0-9]+'If you change it, |
||
|
|
||
| jobs: | ||
| generate-release-notes: | ||
| name: Generate Release Draft & Notes | ||
| runs-on: ubuntu-latest | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It also diverges from this repo's convention of explicit least privilege — Please add to this job: permissions:
contents: write(I could not read the repository's effective default workflow permission — the API returns 403 for my token — but declaring it explicitly is correct either way.) |
||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout repository | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 minor: nothing in this job reads the checked-out tree, so this step and its full-history clone can go. The only other step is Please drop the checkout step, or at minimum |
||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Generate Release Notes | ||
| uses: softprops/action-gh-release@v2 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines 28-29 grant This is the first workflow here to grant a third-party action Please pin both new actions to a full commit SHA and keep the readable version in a trailing comment: uses: softprops/action-gh-release@<40-char-sha> # v2.x.y |
||
| with: | ||
| generate_release_notes: true | ||
| draft: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <!-- | ||
| 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. | ||
| --> | ||
|
|
||
| # 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| ### 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 minor: these commands fail as written, because there is no The Maven reactor root is The report path at line 46 has the same dependency. Please state the working directory once at the top of this section, or make the commands self-locating: mvn -f computer/pom.xml 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. | | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 minor: two things in this row will mislead a reader.
"from git history" is not what the workflow does. Line 55 has a smaller version of the same problem: it calls the workflow "Commit Check", while |
||
|
|
||
| --- | ||
|
|
||
| ## PR Title Guidelines | ||
|
|
||
| Pull requests must follow the Conventional Commits specification: | ||
|
|
||
| `<type>(<scope>): <short summary>` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 minor — The guide presents |
||
|
|
||
| - **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` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 minor — This job also declares no
permissions:block, so it inherits the default token scope. It only needs to read the PR title, and the rest of this repo pins least privilege explicitly (stale.yml:11-13,codeql-analysis.yml:23-26,rerun-ci.yml:10).Please add: