Skip to content

Commit e214bdd

Browse files
authored
refactor: Optimize trigger conditions for CI workflows (#711)
Fixes #710
1 parent 02b9a50 commit e214bdd

12 files changed

Lines changed: 71 additions & 194 deletions

.github/workflows/Linux.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
# Trigger the workflow on push or pull request,
55
# but only for the main branch
66
workflow_dispatch:
7+
release:
8+
types:
9+
- created
710
pull_request:
811
branches:
912
- main
@@ -53,11 +56,11 @@ jobs:
5356
is_pull_request: ${{ github.event_name == 'pull_request' }}
5457

5558
# ============================================================
56-
# Unified Jobs: Build NeuG + run C++, Python, and E2E tests
59+
# Push / workflow_dispatch: build both x86_64 and arm64
5760
# ============================================================
5861
build_and_test_linux_x86_64:
5962
needs: format_check
60-
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && (github.event_name != 'push' || github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main') }}
63+
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && (github.event_name != 'push' || github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main') && contains(fromJSON('["push", "workflow_dispatch", "release"]'), github.event_name) }}
6164
uses: ./.github/workflows/build-and-test-common.yml
6265
with:
6366
runs-on: ${{ github.repository == 'alibaba/neug' && '["self-hosted", "daily", "linux", "x64"]' || '["ubuntu-22.04"]' }}
@@ -70,7 +73,7 @@ jobs:
7073

7174
build_and_test_linux_arm64:
7275
needs: format_check
73-
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && (github.event_name != 'push' || github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main') }}
76+
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && (github.event_name != 'push' || github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main') && contains(fromJSON('["push", "workflow_dispatch", "release"]'), github.event_name) }}
7477
uses: ./.github/workflows/build-and-test-common.yml
7578
with:
7679
runs-on: ${{ github.repository == 'alibaba/neug' && '["self-hosted", "daily", "linux", "arm64"]' || '["ubuntu-22.04-arm"]' }}
@@ -80,3 +83,22 @@ jobs:
8083
enable-coverage: true
8184
enable-gopt-test: true
8285
event-name: ${{ github.event_name }}
86+
87+
# ============================================================
88+
# Pull Request: run a single random architecture
89+
# - self-hosted: omit arch label to let the runner pool pick randomly
90+
# - GitHub-hosted: fallback to x86_64 (ubuntu-22.04)
91+
# ============================================================
92+
build_and_test_linux_pr:
93+
name: Build and test Linux (PR random arch)
94+
needs: format_check
95+
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && github.event_name == 'pull_request' }}
96+
uses: ./.github/workflows/build-and-test-common.yml
97+
with:
98+
runs-on: ${{ github.repository == 'alibaba/neug' && '["self-hosted", "daily", "linux"]' || '["ubuntu-22.04"]' }}
99+
container-json: '{"image":"neug-registry.cn-hongkong.cr.aliyuncs.com/neug/neug-dev:v0.1.3"}'
100+
os-type: linux
101+
enable-java-test: true
102+
enable-coverage: true
103+
enable-gopt-test: true
104+
event-name: ${{ github.event_name }}

.github/workflows/OSX.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,9 @@ name: NeuG Test (macOS arm64)
22

33
on:
44
workflow_dispatch:
5-
pull_request:
6-
paths:
7-
- 'cmake/**'
8-
- 'src/**'
9-
- 'bin/**'
10-
- 'proto/**'
11-
- 'third_party/**'
12-
- 'tools/python_bind/**'
13-
- 'tools/utils/**'
14-
- 'tests/**'
15-
- '.github/workflows/OSX.yml'
16-
- '.github/workflows/build-and-test-common.yml'
17-
- 'scripts/install_deps.sh'
18-
- 'include/**'
19-
- 'CMakeLists.txt'
20-
- 'doc/source/tutorials/**'
5+
release:
6+
types:
7+
- created
218
push:
229
paths:
2310
- 'cmake/**'
@@ -42,8 +29,8 @@ concurrency:
4229
jobs:
4330
format_check:
4431
if: |
45-
github.event_name == 'pull_request' ||
4632
github.event_name == 'workflow_dispatch' ||
33+
github.event_name == 'release' ||
4734
(github.event_name == 'push' && (github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main'))
4835
uses: ./.github/workflows/format-check.yml
4936
with:
@@ -55,7 +42,7 @@ jobs:
5542
# ============================================================
5643
build_and_test_macos_arm64:
5744
needs: format_check
58-
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main'))) }}
45+
if: ${{ (needs.format_check.result == 'success' || needs.format_check.result == 'skipped') && (github.event_name == 'workflow_dispatch' || github.event_name == 'release' || (github.event_name == 'push' && (github.repository != 'alibaba/neug' || github.ref == 'refs/heads/main'))) }}
5946
uses: ./.github/workflows/build-and-test-common.yml
6047
with:
6148
runs-on: '["macos-14"]'

.github/workflows/benchmark.yml

Lines changed: 0 additions & 115 deletions
This file was deleted.

.github/workflows/nightly-npm-package-test.yml renamed to .github/workflows/npm-package-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Nightly NPM Package Test
1+
name: NPM Package Test
22

33
on:
44
schedule:
@@ -9,14 +9,14 @@ on:
99
branches:
1010
- main
1111
paths:
12-
- '.github/workflows/nightly-npm-package-test.yml'
12+
- '.github/workflows/npm-package-test.yml'
1313

1414
concurrency:
1515
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
1616
cancel-in-progress: true
1717

1818
jobs:
19-
nightly-test:
19+
package-test:
2020
runs-on: ${{ matrix.os }}
2121
strategy:
2222
fail-fast: false

.github/workflows/nightly-pypi-package-test.yml renamed to .github/workflows/pypi-package-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Nightly PyPI Package Test
1+
name: PyPI Package Test
22

33
on:
44
schedule:
@@ -9,14 +9,14 @@ on:
99
branches:
1010
- main
1111
paths:
12-
- '.github/workflows/nightly-pypi-package-test.yml'
12+
- '.github/workflows/pypi-package-test.yml'
1313

1414
concurrency:
1515
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
1616
cancel-in-progress: true
1717

1818
jobs:
19-
nightly-test:
19+
package-test:
2020
runs-on: ${{ matrix.os }}
2121
strategy:
2222
fail-fast: false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: NPM Publish
1+
name: Release NPM Packages
22

33
# Published GitHub releases drive npm publishing.
44
on:
Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
name: Build Wheels
1+
name: Release Wheels
22

33
on:
4-
# Trigger the workflow on push or pull request,
5-
# but only for the main branch
64
workflow_dispatch:
75
inputs:
86
python_versions:
@@ -12,38 +10,24 @@ on:
1210
release:
1311
types:
1412
- created
15-
push:
16-
branches:
17-
- main
18-
tags:
19-
- 'v*'
20-
paths: &wheel_paths
21-
- 'cmake/**'
22-
- 'src/**'
23-
- 'include/**'
24-
- 'proto/**'
25-
- 'third_party/**'
26-
- 'tools/python_bind/**'
27-
- '!tools/python_bind/tests/**'
28-
- '!tools/python_bind/example/**'
29-
- 'tools/shell/**'
30-
- '.github/workflows/build-wheel.yml'
31-
- '.github/workflows/wheels-common.yml'
32-
- 'scripts/install_deps.sh'
33-
- 'CMakeLists.txt'
34-
- 'NEUG_VERSION'
3513
pull_request:
3614
branches:
3715
- main
38-
paths: *wheel_paths
16+
paths:
17+
- '.github/workflows/release-wheel.yml'
18+
- '.github/workflows/wheels-common.yml'
19+
- 'tools/python_bind/setup.py'
20+
- 'tools/python_bind/pyproject.toml'
21+
- 'tools/python_bind/Makefile'
22+
- 'tools/python_bind/README.md'
3923

4024
concurrency:
4125
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
4226
cancel-in-progress: true
4327

4428
jobs:
4529
format_check:
46-
if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
30+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || github.event_name == 'release'
4731
uses: ./.github/workflows/format-check.yml
4832
with:
4933
is_pull_request: ${{ github.event_name == 'pull_request' }}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build NeuG image
1+
name: Weekly Build NeuG image
22

33
on:
44
# Trigger the workflow on push or pull request,
@@ -7,16 +7,16 @@ on:
77
schedule:
88
# The notifications for scheduled workflows are sent to the user who
99
# last modified the cron syntax in the workflow file.
10-
# Trigger the workflow at 22:00(CST) every day.
11-
- cron: '0 14 * * *'
10+
# Trigger the workflow at 22:00(CST) every Monday.
11+
- cron: '0 14 * * 1'
1212
push:
1313
tags:
1414
- "v*"
1515
pull_request:
1616
branches:
1717
- main
1818
paths:
19-
- '.github/workflows/build-image.yml'
19+
- '.github/workflows/weekly-build-image.yml'
2020

2121
concurrency:
2222
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
@@ -43,4 +43,4 @@ jobs:
4343
- name: Remove Image
4444
run: |
4545
ARCH=$(uname -m)
46-
docker rmi neug/neug:${ARCH}
46+
docker rmi neug/neug:${ARCH}

0 commit comments

Comments
 (0)