Skip to content

feat: Support storage index framework in AP and TP mode #2686

feat: Support storage index framework in AP and TP mode

feat: Support storage index framework in AP and TP mode #2686

Workflow file for this run

name: Format Check
on:
workflow_call:
inputs:
is_pull_request:
type: boolean
default: false
workflow_dispatch:
pull_request:
branches:
- main
concurrency:
group: ${{ github.repository }}-format-check-${{ github.event.number || github.head_ref || github.sha }}-${{ github.run_id }}
cancel-in-progress: true
jobs:
check-format:
# Run on the self-hosted pool whenever the workflow is executing in
# alibaba/neug (push, workflow_dispatch, and any pull_request including
# those from forks). Fork PRs are intentionally included to avoid the
# GitHub-hosted runner queue. Other repositories (e.g. user forks running
# this workflow on their own branches) fall back to ubuntu-22.04.
runs-on: ${{ github.repository == 'alibaba/neug' && fromJSON('["self-hosted"]') || 'ubuntu-22.04' }}
steps:
- uses: actions/checkout@v4
- name: Conventional PR Check
if: inputs.is_pull_request || github.event_name == 'pull_request'
uses: amannn/action-semantic-pull-request@v5
id: pr-convention
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Types allowed (newline-delimited).
# Default: https://github.com/commitizen/conventional-commit-types
types: |
build
ci
docs
feat
fix
perf
refactor
test
chore
# Scopes allowed (newline-delimited).
scopes: |
core
python
nodejs
src
# A scope can be not provided.
requireScope: false
disallowScopes: |
release
[A-Z]+
# If the PR contains one of these newline-delimited labels, the
# validation is skipped.
ignoreLabels: |
bot
ignore-semantic-pull-request
- name: Comments if PR Title is not conventional
id: lint_pr_title
uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: (inputs.is_pull_request || github.event_name == 'pull_request') && always() && (steps.pr-convention.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) \
and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.pr-convention.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- name: Delete Comment if PR Title is conventional
if: (inputs.is_pull_request || github.event_name == 'pull_request') && steps.lint_pr_title.outputs.error_message == null
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
- name: Set up Python
# Skip on self-hosted ARM runners (Python is preinstalled there);
# all other runners (github-hosted, self-hosted x64, etc.) still run setup.
if: ${{ !(runner.environment == 'self-hosted' && (runner.arch == 'ARM64' || runner.arch == 'ARM')) }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup Java and Maven
if: ${{ runner.environment != 'self-hosted' }}
uses: s4u/setup-maven-action@v1.19.0
with:
java-version: '17'
maven-version: '3.9.6'
- name: Get PR Changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
docs:
- 'docs/**'
- name: Cpp Format and Lint Check
run: |
# Install pinned clang-format from PyPI (cross-platform: Linux, macOS, Windows)
python3 -m pip install 'clang-format==10.0.1'
# validate format
function prepend() { while read line; do echo "${1}${line}"; done; }
# except for files generated by protobuf
find ./include ./src ./tests ./tools ./extension \( -name "*.h" -o -name "*.cc" -o -name "*.cpp" \) ! -name "*pb.h" ! -name "*pb.cc" | xargs clang-format -i --style=file
GIT_DIFF=$(git diff --ignore-submodules)
if [[ -n $GIT_DIFF ]]; then
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| clang-format failures found!"
echo "|"
echo "$GIT_DIFF" | prepend "| "
echo "|"
echo "| Run: "
echo "| mkdir build && cd build && cmake .."
echo "| make neug_clformat"
echo "|"
echo "| to fix this error."
echo "|"
echo "| Ensure you are working with clang-format 10.0.1, install with:"
echo "| python3 -m pip install 'clang-format==10.0.1'"
echo "|"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit 1
fi
- name: Python Format and Lint Check
run: |
pushd ${GITHUB_WORKSPACE}/tools/python_bind
python3 -m pip install -r requirements_dev.txt
python3 -m pip install -r requirements.txt
function print_error() {
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| $1"
echo "|"
echo "| Please cd into $2 and run 'python3 -m $3 .' to fix it"
echo "|"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}
(python3 -m isort --check --diff .) || (print_error "isort check failed" "tools/python_bind" "isort" && exit 1)
(python3 -m black --check --diff .) || (print_error "black check failed" "tools/python_bind" "black" && exit 1)
(python3 -m flake8 .) || (print_error "flake8 check failed" "tools/python_bind" "flake8" && exit 1)
popd
pushd ${GITHUB_WORKSPACE}/tests/e2e
(python3 -m isort --check --diff .) || (print_error "isort check failed" "tests/e2e" "isort" && exit 1)
(python3 -m black --check --diff .) || (print_error "black check failed" "tests/e2e" "black" && exit 1)
(python3 -m flake8 .) || (print_error "flake8 check failed" "tests/e2e" "flake8" && exit 1)
popd
- name: Java Format Check
run: |
pushd ${GITHUB_WORKSPACE}/tools/java_driver
mvn spotless:check
popd