chore: android ci needs lint first (#240)

This commit is contained in:
feihongxu0824 2026-03-18 16:16:49 +08:00 committed by GitHub
parent e7c4a2f2b8
commit 363f970da8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 125 additions and 90 deletions

55
.github/workflows/01-ci-pipeline.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: Main
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Code quality checks (fast, run first)
lint:
uses: ./.github/workflows/02-lint-check.yml
# Main build and test matrix
build-and-test-macos-arm64:
name: Build & Test (macos-arm64)
needs: lint
uses: ./.github/workflows/03-macos-linux-build.yml
with:
platform: macos-arm64
os: macos-15
build-and-test-linux-arm64:
name: Build & Test (linux-arm64)
needs: lint
uses: ./.github/workflows/03-macos-linux-build.yml
with:
platform: linux-arm64
os: ubuntu-24.04-arm
build-and-test-linux-x64:
name: Build & Test (linux-x64)
needs: lint
uses: ./.github/workflows/03-macos-linux-build.yml
with:
platform: linux-x64
os: ubuntu-24.04
build-android:
name: Build & Test (android)
needs: lint
uses: ./.github/workflows/04-android-build.yml

52
.github/workflows/02-lint-check.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Lint
on:
workflow_call:
jobs:
lint:
name: Code Quality Checks
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install linting tools
run: |
python -m pip install --upgrade pip \
ruff==v0.14.4 \
clang-format==18.1.8
shell: bash
- name: Run Ruff Linter
run: python -m ruff check .
shell: bash
- name: Run Ruff Formatter Check
run: python -m ruff format --check .
shell: bash
- name: Run clang-format Check
run: |
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
! -path "./scripts/*" \
! -path "./python/*" \
! -path "./thirdparty/*" \
! -path "./.git/*")
if [ -z "$CPP_FILES" ]; then
echo "No C++ files found to check."
exit 0
fi
clang-format --dry-run --Werror $CPP_FILES
shell: bash

View File

@ -1,92 +1,33 @@
name: Main
name: MacOS & Linux Build
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
workflow_call:
inputs:
platform:
description: 'Platform identifier'
required: true
type: string
os:
description: 'GitHub Actions runner OS'
required: true
type: string
permissions:
contents: read
jobs:
# Code quality checks (fast, run first)
lint:
name: Code Quality Checks
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install linting tools
run: |
python -m pip install --upgrade pip \
ruff==v0.14.4 \
clang-format==18.1.8
shell: bash
- name: Run Ruff Linter
run: python -m ruff check .
shell: bash
- name: Run Ruff Formatter Check
run: python -m ruff format --check .
shell: bash
- name: Run clang-format Check
run: |
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
! -path "./scripts/*" \
! -path "./python/*" \
! -path "./thirdparty/*" \
! -path "./.git/*")
if [ -z "$CPP_FILES" ]; then
echo "No C++ files found to check."
exit 0
fi
clang-format --dry-run --Werror $CPP_FILES
shell: bash
# Build and test matrix (parallel execution)
build-and-test:
name: Build & Test (${{ matrix.platform }})
needs: lint
runs-on: ${{ matrix.os }}
name: Build & Test (${{ inputs.platform }})
runs-on: ${{ inputs.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
platform: macos-arm64
arch_flag: "" # ARM64 uses auto-detection
- os: ubuntu-24.04-arm
platform: linux-arm64
arch_flag: "" # ARM64 uses auto-detection
- os: ubuntu-24.04
platform: linux-x64
arch_flag: "" # Use native CPU microarchitecture
- os: ${{ inputs.os }}
platform: ${{ inputs.platform }}
arch_flag: "" # Use appropriate architecture
steps:
- name: Checkout code

View File

@ -1,20 +1,7 @@
name: android-cross-build
name: Android Cross Build
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
workflow_call:
permissions:
contents: read