-
Notifications
You must be signed in to change notification settings - Fork 29
163 lines (151 loc) · 5.64 KB
/
Copy pathbase_ci.yml
File metadata and controls
163 lines (151 loc) · 5.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Base CI
on:
pull_request:
branches: [main]
release:
types: [published, prereleased]
permissions:
contents: read
# Prevent duplicate runs for the same release tag when GitHub
# fires both 'published' and 'prereleased' events concurrently.
# PRs use the PR number as the concurrency key so each PR is
# independent; releases use the git ref (tag).
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# ============================================================
# Format check (PR only, runs in parallel with no dependencies)
# ============================================================
format:
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # need history to diff against base
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install pre-commit
run: pip install pre-commit
- name: Get PR changed files
run: |
git diff --name-only --diff-filter=ACMR \
'${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}' \
> /tmp/changed_files.txt
echo "Files to check:"
cat /tmp/changed_files.txt
- name: Run format check (incremental)
run: |
if [ ! -s /tmp/changed_files.txt ]; then
echo "No source files changed, skipping format check"
exit 0
fi
python -m pre_commit run --files $(tr '\n' ' ' < /tmp/changed_files.txt)
# ============================================================
# Doc link check (PR only, runs regardless of format result)
# ============================================================
doc-link-check:
if: always() && github.event_name == 'pull_request'
needs: format
uses: ./.github/workflows/doc-link-check.yml
# ============================================================
# Prebuild: AscendNPU-IR (x64 + arm64)
# ============================================================
prebuild-npuir:
uses: ./.github/workflows/build_ascend_npuir.yml
with:
checkout-ref: ${{ github.ref }}
# ============================================================
# Prebuild: TVM (x64 + arm64)
# ============================================================
prebuild-tvm:
uses: ./.github/workflows/build-tvm.yml
with:
checkout-ref: ${{ github.ref }}
# ============================================================
# Build wheel (x64 + arm64)
# ============================================================
build-wheel:
needs: [prebuild-npuir, prebuild-tvm]
uses: ./.github/workflows/build_tilelang_wheel.yml
with:
npuir-commit: ${{ needs.prebuild-npuir.outputs.npuir-commit }}
tvm-commit: ${{ needs.prebuild-tvm.outputs.tvm-commit }}
checkout-ref: ${{ github.ref }}
# ============================================================
# Test on NPU hardware (shared by all scenarios)
# ============================================================
test:
needs: build-wheel
uses: ./.github/workflows/test_npuir_wheel.yml
with:
checkout-ref: ${{ github.ref }}
report-name: ${{ github.event_name == 'pull_request' && 'npuir-test-report' || 'npuir-release-test-report' }}
# ============================================================
# Scenario 2: Pre-release — upload wheel assets after test
# ============================================================
upload-prerelease-assets:
if: github.event_name == 'release' && github.event.release.prerelease
needs: test
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download x64 wheel
uses: actions/download-artifact@v4
with:
name: tilelang-npuir-py3.11-x64
path: release-wheels
- name: Download arm64 wheel
uses: actions/download-artifact@v4
with:
name: tilelang-npuir-py3.11-arm64
path: release-wheels
- name: Upload to Pre-release
uses: softprops/action-gh-release@v2
with:
files: release-wheels/*.whl
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ============================================================
# Scenario 3: Release — upload wheel assets after test
# ============================================================
upload-release-assets:
if: github.event_name == 'release' && !github.event.release.prerelease
needs: test
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download x64 wheel
uses: actions/download-artifact@v4
with:
name: tilelang-npuir-py3.11-x64
path: release-wheels
- name: Download arm64 wheel
uses: actions/download-artifact@v4
with:
name: tilelang-npuir-py3.11-arm64
path: release-wheels
- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
files: release-wheels/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ============================================================
# Scenario 3: Release — Docker build & push after test
# ============================================================
docker-build:
if: github.event_name == 'release' && !github.event.release.prerelease
needs: test
uses: ./.github/workflows/build_docker.yml
with:
cann_version: '8.5.0'
checkout-ref: ${{ github.ref }}
secrets: inherit