forked from KanuaK/triton-ascend
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (126 loc) · 5.44 KB
/
Copy pathwheels.yml
File metadata and controls
142 lines (126 loc) · 5.44 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
name: Wheels
on:
workflow_dispatch:
push:
branches: [release/**]
pull_request:
paths:
- .github/workflows/wheels.yml
- .github/workflows/build/wheels.Dockerfile
- setup.py
- pyproject.toml
- version.txt
- cmake/llvm-hash.txt
- cmake/json-version.txt
schedule:
- cron: "0 8 * * *"
concurrency:
group: wheels-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
Build-Wheels:
name: Build wheels for ${{ matrix.config.arch }}-${{ matrix.python }}-${{ matrix.branch.tag }}
runs-on: ${{ matrix.config.runs_on }}
container:
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:9.0.0-a3-ubuntu22.04-py3.12
timeout-minutes: 360
strategy:
fail-fast: false
# Limit parallelism: wheel builds compile hundreds of C++ files on
# memory-constrained workers; too many at once causes OOM kills and
# buildkitd/SWR auth timeouts.
max-parallel: 6
matrix:
config:
- {runs_on: 'linux-amd64-cpu-4', arch: 'x86_64'}
- {runs_on: 'linux-aarch64-cpu-4', arch: 'aarch64'}
python: ["cp310", "cp311", "cp312", "cp313"]
branch:
- {ref: 'main', tag: 'main', local: 'dev'}
- {ref: 'release/3.2.2', tag: 'release-3.2.2', local: 'release'}
permissions:
id-token: write
contents: read
steps:
- name: Check for new commits
if: github.event_name == 'push'
id: new-commits
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LAST_SHA=$(gh api \
"/repos/${{ github.repository }}/actions/workflows/wheels.yml/runs?branch=${{ github.ref_name }}&status=success&per_page=1" \
--jq '.workflow_runs[0].head_sha // empty')
if [ "$LAST_SHA" = "${{ github.sha }}" ]; then
echo "Current commit already has a successful wheel build. Skipping."
echo "has_new_commits=false" >> $GITHUB_OUTPUT
else
echo "New commits detected. Proceeding with wheel build."
echo "has_new_commits=true" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@v5
with:
# PR: checkout the PR head, not the matrix.branch ref (main).
# push/workflow_dispatch/schedule: use the matrix branch ref.
ref: ${{ github.event_name != 'pull_request' && matrix.branch.ref || '' }}
- name: Compute build variables
id: vars
shell: bash
run: |
NUM_PROCS=$(( $(nproc) / 6 ))
if [ "$NUM_PROCS" -lt 1 ]; then NUM_PROCS=1; fi
# Hard-cap at 8 to avoid OOM on memory-constrained buildkitd workers.
if [ "$NUM_PROCS" -gt 8 ]; then NUM_PROCS=8; fi
echo "max_jobs=${NUM_PROCS}" >> $GITHUB_OUTPUT
BUILD_DATE=$(date -u +%Y%m%d)
echo "build_date=${BUILD_DATE}" >> $GITHUB_OUTPUT
- name: Build wheels
if: github.event_name != 'push' || steps.new-commits.outputs.has_new_commits != 'false'
uses: docker/build-push-action@v7
with:
context: .
file: .github/workflows/build/wheels.Dockerfile
build-args: |
MANYLINUX_IMAGE=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/pypa/manylinux_2_28_${{ matrix.config.arch }}:latest
PYTHON_VERSION=${{ matrix.python }}
MAX_JOBS=${{ steps.vars.outputs.max_jobs }}
TRITON_WHEEL_VERSION_SUFFIX=+${{ matrix.branch.local }}
BUILD_DATE=${{ steps.vars.outputs.build_date }}
outputs: type=local,dest=./wheelhouse
- uses: actions/upload-artifact@v4
if: github.event_name != 'push' || steps.new-commits.outputs.has_new_commits != 'false'
with:
name: cibw-wheels-manylinux_2_28_${{ matrix.config.arch }}-${{ matrix.python }}-${{ matrix.branch.tag }}-wheels-upload
path: ./wheelhouse/*.whl
- name: Setup obsutil and upload to OBS
if: github.event_name != 'pull_request' && (github.event_name != 'push' || steps.new-commits.outputs.has_new_commits != 'false')
shell: bash
env:
AK: ${{ secrets.NIGHTLY_OBS_AK }}
SK: ${{ secrets.NIGHTLY_OBS_SK }}
ARCH: ${{ matrix.config.arch == 'x86_64' && 'amd64' || 'arm64' }}
run: |
set -eu
if [ -z "${AK}" ] || [ -z "${SK}" ]; then
echo "OBS credentials are empty."
exit 1
fi
curl -fL "https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_${ARCH}.tar.gz" -o obsutil.tar.gz
gzip -t obsutil.tar.gz || { echo "obsutil.tar.gz is not a valid gzip"; exit 1; }
tar xzf obsutil.tar.gz
rm -f obsutil.tar.gz
mv obsutil_linux_* obsutil
obsutil/obsutil config -i="${AK}" -k="${SK}" -e=https://obs.cn-north-4.myhuaweicloud.com
OBS_DIR="obs://ascend-artifcat-packages/pypi/packages/ascend/repos/pypi/nightly/triton-ascend/"
obsutil/obsutil cp -u wheelhouse/*.whl "${OBS_DIR}"
# Regenerate index.html from every .whl currently in the directory
# (non-recursive, short format), keeping only the basenames.
obsutil/obsutil ls "${OBS_DIR}" -d -s -limit=0 \
| grep -oE '[^/]+\.whl$' \
| sort -u > files.txt
while IFS= read -r f; do
printf "<a href='%s'>%s</a><br />\n" "$f" "$f"
done < files.txt > index.html
obsutil/obsutil cp index.html "${OBS_DIR}"