Skip to content

Commit cc4b97c

Browse files
committed
[infra] Update python packaging workflow
This commit updates python packaging workflow - Use uv for building wheels instead of setup.py bdist_wheel - Replace virtual environment setup with uv venv command - Set platform-specific environment variables (PLATFORM, GLIBC_VERSION) - Set dev version by using uv version command ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
1 parent 0e11e59 commit cc4b97c

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

.github/workflows/pub-onert-pypi.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
if: github.repository_owner == 'Samsung'
2121
strategy:
2222
matrix:
23-
python-version: [ 'python3.10', 'python3.11', 'python3.12' ]
23+
python-version: [ '3.10', '3.11', '3.12' ]
2424
arch: [ 'x86_64', 'aarch64' ]
2525
include:
2626
- arch: x86_64
@@ -36,7 +36,6 @@ jobs:
3636
env:
3737
BUILD_TYPE: release
3838
OPTIONS: "-DENABLE_TEST=OFF -DBUILD_ARMCOMPUTE=OFF"
39-
DEV_TAG: ""
4039

4140
steps:
4241
- name: Checkout
@@ -50,11 +49,12 @@ jobs:
5049
restore-keys: |
5150
external-onert-jammy-
5251
53-
- name: Install venv for python version
54-
run: |
55-
${{ matrix.python-version }} -m venv ./venv
56-
source ./venv/bin/activate
57-
pip3 install -U setuptools wheel
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v7
54+
with:
55+
version: "0.9.10"
56+
python-version: "${{ matrix.python-version }}"
57+
activate-environment: "true"
5858

5959
# For flatc build
6060
- name: Install glibc-static
@@ -63,7 +63,7 @@ jobs:
6363
6464
- name: Build
6565
run: |
66-
source ./venv/bin/activate
66+
source .venv/bin/activate
6767
make -f Makefile.template configure build install
6868
6969
# Pre-release build
@@ -73,23 +73,21 @@ jobs:
7373
- name: Pre-release packaging
7474
if: github.event.inputs.official == 'false' || github.event_name == 'pull_request' || github.ref_name == 'master'
7575
run: |
76-
source ./venv/bin/activate
77-
cd runtime/infra/python
78-
python3 setup.py bdist_wheel --plat-name manylinux_2_28_${{ matrix.arch }} egg_info --tag-build "dev$(date -u "+%y%m%d")"
76+
uv version "$(uv version --short --project runtime)-dev$(date -u "+%y%m%d")" --project runtime --python "${{ matrix.python-version }}"
7977
80-
# Allow official release on release branch only
81-
- name: Release packaging
82-
if: github.event.inputs.official == 'true' && startsWith(github.ref_name, 'release/')
78+
- name: Build package
79+
# Set env to decide package name: refer runtime/infra/python/wheel_target_hook.py
80+
env:
81+
PLATFORM: ${{ matrix.arch }}
82+
GLIBC_VERSION: "2.28"
8383
run: |
84-
source ./venv/bin/activate
85-
cd runtime/infra/python
86-
python3 setup.py bdist_wheel --plat-name manylinux_2_28_${{ matrix.arch }} egg_info
84+
uv build --wheel --project runtime --python "${{ matrix.python-version }}"
8785
8886
- name: Upload artifacts
8987
uses: actions/upload-artifact@v4
9088
with:
91-
name: onert-wheel-${{ matrix.python-version }}-${{ matrix.arch }}
92-
path: runtime/infra/python/dist/*.whl
89+
name: onert-wheel-python${{ matrix.python-version }}-${{ matrix.arch }}
90+
path: runtime/dist/*.whl
9391

9492
publish-to-pypi:
9593
needs: [ build ]

0 commit comments

Comments
 (0)