Skip to content

Commit 363f970

Browse files
chore: android ci needs lint first (alibaba#240)
1 parent e7c4a2f commit 363f970

File tree

4 files changed

+125
-90
lines changed

4 files changed

+125
-90
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths-ignore:
7+
- '**.md'
8+
merge_group:
9+
pull_request:
10+
branches: [ "main" ]
11+
paths-ignore:
12+
- '**.md'
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
# Code quality checks (fast, run first)
24+
lint:
25+
uses: ./.github/workflows/02-lint-check.yml
26+
27+
# Main build and test matrix
28+
build-and-test-macos-arm64:
29+
name: Build & Test (macos-arm64)
30+
needs: lint
31+
uses: ./.github/workflows/03-macos-linux-build.yml
32+
with:
33+
platform: macos-arm64
34+
os: macos-15
35+
36+
build-and-test-linux-arm64:
37+
name: Build & Test (linux-arm64)
38+
needs: lint
39+
uses: ./.github/workflows/03-macos-linux-build.yml
40+
with:
41+
platform: linux-arm64
42+
os: ubuntu-24.04-arm
43+
44+
build-and-test-linux-x64:
45+
name: Build & Test (linux-x64)
46+
needs: lint
47+
uses: ./.github/workflows/03-macos-linux-build.yml
48+
with:
49+
platform: linux-x64
50+
os: ubuntu-24.04
51+
52+
build-android:
53+
name: Build & Test (android)
54+
needs: lint
55+
uses: ./.github/workflows/04-android-build.yml
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
name: Code Quality Checks
9+
runs-on: ubuntu-24.04
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v6
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v6
16+
with:
17+
python-version: '3.10'
18+
cache: 'pip'
19+
cache-dependency-path: 'pyproject.toml'
20+
21+
- name: Install linting tools
22+
run: |
23+
python -m pip install --upgrade pip \
24+
ruff==v0.14.4 \
25+
clang-format==18.1.8
26+
shell: bash
27+
28+
- name: Run Ruff Linter
29+
run: python -m ruff check .
30+
shell: bash
31+
32+
- name: Run Ruff Formatter Check
33+
run: python -m ruff format --check .
34+
shell: bash
35+
36+
- name: Run clang-format Check
37+
run: |
38+
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
39+
! -path "./build/*" \
40+
! -path "./tests/*" \
41+
! -path "./scripts/*" \
42+
! -path "./python/*" \
43+
! -path "./thirdparty/*" \
44+
! -path "./.git/*")
45+
46+
if [ -z "$CPP_FILES" ]; then
47+
echo "No C++ files found to check."
48+
exit 0
49+
fi
50+
51+
clang-format --dry-run --Werror $CPP_FILES
52+
shell: bash

.github/workflows/main.yml renamed to .github/workflows/03-macos-linux-build.yml

Lines changed: 16 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,33 @@
1-
name: Main
1+
name: MacOS & Linux Build
22

33
on:
4-
push:
5-
branches: [ "main" ]
6-
paths-ignore:
7-
- '**.md'
8-
merge_group:
9-
pull_request:
10-
branches: [ "main" ]
11-
paths-ignore:
12-
- '**.md'
13-
workflow_dispatch:
14-
15-
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
17-
cancel-in-progress: true
4+
workflow_call:
5+
inputs:
6+
platform:
7+
description: 'Platform identifier'
8+
required: true
9+
type: string
10+
os:
11+
description: 'GitHub Actions runner OS'
12+
required: true
13+
type: string
1814

1915
permissions:
2016
contents: read
2117

2218
jobs:
23-
# Code quality checks (fast, run first)
24-
lint:
25-
name: Code Quality Checks
26-
runs-on: ubuntu-24.04
27-
steps:
28-
- name: Checkout code
29-
uses: actions/checkout@v6
30-
31-
- name: Set up Python
32-
uses: actions/setup-python@v6
33-
with:
34-
python-version: '3.10'
35-
cache: 'pip'
36-
cache-dependency-path: 'pyproject.toml'
37-
38-
- name: Install linting tools
39-
run: |
40-
python -m pip install --upgrade pip \
41-
ruff==v0.14.4 \
42-
clang-format==18.1.8
43-
shell: bash
44-
45-
- name: Run Ruff Linter
46-
run: python -m ruff check .
47-
shell: bash
48-
49-
- name: Run Ruff Formatter Check
50-
run: python -m ruff format --check .
51-
shell: bash
52-
53-
- name: Run clang-format Check
54-
run: |
55-
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
56-
! -path "./build/*" \
57-
! -path "./tests/*" \
58-
! -path "./scripts/*" \
59-
! -path "./python/*" \
60-
! -path "./thirdparty/*" \
61-
! -path "./.git/*")
62-
63-
if [ -z "$CPP_FILES" ]; then
64-
echo "No C++ files found to check."
65-
exit 0
66-
fi
67-
68-
clang-format --dry-run --Werror $CPP_FILES
69-
shell: bash
70-
7119
# Build and test matrix (parallel execution)
7220
build-and-test:
73-
name: Build & Test (${{ matrix.platform }})
74-
needs: lint
75-
runs-on: ${{ matrix.os }}
21+
name: Build & Test (${{ inputs.platform }})
22+
runs-on: ${{ inputs.os }}
7623

7724
strategy:
7825
fail-fast: false
7926
matrix:
8027
include:
81-
- os: macos-15
82-
platform: macos-arm64
83-
arch_flag: "" # ARM64 uses auto-detection
84-
- os: ubuntu-24.04-arm
85-
platform: linux-arm64
86-
arch_flag: "" # ARM64 uses auto-detection
87-
- os: ubuntu-24.04
88-
platform: linux-x64
89-
arch_flag: "" # Use native CPU microarchitecture
28+
- os: ${{ inputs.os }}
29+
platform: ${{ inputs.platform }}
30+
arch_flag: "" # Use appropriate architecture
9031

9132
steps:
9233
- name: Checkout code
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
name: android-cross-build
1+
name: Android Cross Build
22

33
on:
4-
push:
5-
branches: [ "main" ]
6-
paths-ignore:
7-
- '**.md'
8-
merge_group:
9-
pull_request:
10-
branches: [ "main" ]
11-
paths-ignore:
12-
- '**.md'
13-
workflow_dispatch:
14-
15-
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
17-
cancel-in-progress: true
4+
workflow_call:
185

196
permissions:
207
contents: read

0 commit comments

Comments
 (0)