Skip to content

Commit f107b49

Browse files
committed
[optim] workflow
1 parent 10e491f commit f107b49

13 files changed

Lines changed: 187 additions & 95 deletions

‎.github/constraints.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Shared CI pin: setuptools 82 re-enables PEP 639 License-Expression metadata,
2+
# which diverges per OS and broke PyPI uploads (see commit 66de16d).
3+
setuptools<82

‎.github/workflows/build-linux-arm-manylinux.yml‎

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
branches: [ manylinux-arm, build-all ]
88
workflow_dispatch:
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
build-manylinux-arm:
1216
name: Build manylinux wheels (ARM64)
@@ -16,6 +20,16 @@ jobs:
1620

1721
steps:
1822
- uses: actions/checkout@v4
23+
with:
24+
submodules: recursive
25+
26+
- name: Cache Cubism SDK
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
Live2D/V3/Core
31+
Live2D/V3/Framework
32+
key: csmsdk-${{ hashFiles('setup.py') }}
1933

2034
- name: Build wheels in manylinux container
2135
run: |
@@ -28,23 +42,26 @@ jobs:
2842
2943
rm -rf build/
3044
31-
/opt/python/cp310-cp310/bin/pip install cmake
32-
export PATH="/opt/python/cp310-cp310/bin:$PATH"
45+
/opt/python/cp311-cp311/bin/pip install cmake
46+
export PATH="/opt/python/cp311-cp311/bin:$PATH"
3347
3448
export CC=/usr/bin/gcc CXX=/usr/bin/g++
3549
36-
for ver in 10 11 12 13 14; do
37-
PYBIN="/opt/python/cp3${ver}-cp3${ver}/bin"
38-
[ -x "$PYBIN/python" ] || continue
39-
echo "=== Building with $PYBIN/python ==="
40-
"$PYBIN/pip" install "setuptools<82" wheel
41-
"$PYBIN/python" setup.py bdist_wheel
42-
done
50+
# Stable-ABI build: one cp311-abi3 wheel covers Python >= 3.11
51+
PYBIN=/opt/python/cp311-cp311/bin
52+
"$PYBIN/pip" install -c /work/.github/constraints.txt setuptools wheel
53+
"$PYBIN/python" setup.py bdist_wheel
4354
4455
for whl in dist/*.whl; do
4556
auditwheel repair "$whl" -w dist/ || true
4657
done
47-
58+
59+
# Verify: metadata check + install + import with the building interpreter
60+
"$PYBIN/pip" install twine
61+
"$PYBIN/python" -m twine check dist/*.whl
62+
"$PYBIN/pip" install --force-reinstall dist/*.whl
63+
"$PYBIN/python" -c "import live2d.v2cpp, live2d.v3"
64+
4865
chown -R $(stat -c "%u:%g" /work) /work/dist /work/build
4966
5067
echo "=== Built wheels ==="
@@ -55,15 +72,8 @@ jobs:
5572
'
5673
5774
- name: Upload wheels to release
75+
if: startsWith(github.ref, 'refs/tags/v')
5876
uses: softprops/action-gh-release@v2
5977
with:
6078
files: |
6179
dist/*.whl
62-
63-
# - name: Publish to PyPI
64-
# env:
65-
# TWINE_USERNAME: __token__
66-
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
67-
# run: |
68-
# python -m pip install twine
69-
# twine upload dist/*.whl --skip-existing

‎.github/workflows/build-linux-manylinux.yml‎

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
branches: [ manylinux, build-all ]
88
workflow_dispatch:
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
build-manylinux:
1216
name: Build manylinux wheels
@@ -16,6 +20,16 @@ jobs:
1620

1721
steps:
1822
- uses: actions/checkout@v4
23+
with:
24+
submodules: recursive
25+
26+
- name: Cache Cubism SDK
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
Live2D/V3/Core
31+
Live2D/V3/Framework
32+
key: csmsdk-${{ hashFiles('setup.py') }}
1933

2034
- name: Build wheels in manylinux container
2135
run: |
@@ -32,23 +46,26 @@ jobs:
3246
# clear stale cmake cache
3347
rm -rf build/
3448
35-
# Install cmake once (use cp310 as bootstrap)
36-
/opt/python/cp310-cp310/bin/pip install cmake
37-
export PATH="/opt/python/cp310-cp310/bin:$PATH"
49+
# Install cmake once
50+
/opt/python/cp311-cp311/bin/pip install cmake
51+
export PATH="/opt/python/cp311-cp311/bin:$PATH"
3852
39-
for ver in 10 11 12 13 14; do
40-
PYBIN="/opt/python/cp3${ver}-cp3${ver}/bin"
41-
[ -x "$PYBIN/python" ] || continue
42-
echo "=== Building with $PYBIN/python ==="
43-
"$PYBIN/pip" install "setuptools<82" wheel
44-
"$PYBIN/python" setup.py bdist_wheel
45-
done
53+
# Stable-ABI build: one cp311-abi3 wheel covers Python >= 3.11
54+
PYBIN=/opt/python/cp311-cp311/bin
55+
"$PYBIN/pip" install -c /work/.github/constraints.txt setuptools wheel
56+
"$PYBIN/python" setup.py bdist_wheel
4657
47-
# Tag wheels as manylinux (repair then strip invalid PEP 639 fields)
58+
# Tag wheels as manylinux
4859
for whl in dist/*.whl; do
4960
auditwheel repair "$whl" -w dist/ || true
5061
done
5162
63+
# Verify: metadata check + install + import with the building interpreter
64+
"$PYBIN/pip" install twine
65+
"$PYBIN/python" -m twine check dist/*.whl
66+
"$PYBIN/pip" install --force-reinstall dist/*.whl
67+
"$PYBIN/python" -c "import live2d.v2cpp, live2d.v3"
68+
5269
# Fix file ownership for host
5370
chown -R $(stat -c "%u:%g" /work) /work/dist /work/build
5471
@@ -62,15 +79,23 @@ jobs:
6279
'
6380
6481
- name: Upload wheels to release
82+
if: startsWith(github.ref, 'refs/tags/v')
6583
uses: softprops/action-gh-release@v2
6684
with:
6785
files: |
6886
dist/*.whl
6987
70-
# - name: Publish to PyPI
71-
# env:
72-
# TWINE_USERNAME: __token__
73-
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
74-
# run: |
75-
# python -m pip install twine
76-
# twine upload dist/*.whl --skip-existing
88+
- name: Build sdist
89+
if: startsWith(github.ref, 'refs/tags/v')
90+
run: |
91+
python -m pip install -c .github/constraints.txt setuptools wheel
92+
python setup.py sdist
93+
94+
- name: Publish sdist to PyPI
95+
if: startsWith(github.ref, 'refs/tags/v')
96+
env:
97+
TWINE_USERNAME: __token__
98+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
99+
run: |
100+
python -m pip install twine
101+
twine upload dist/*.tar.gz --skip-existing

‎.github/workflows/build-live2dviewer.yml‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,39 @@ on:
88
- "v*.*.*"
99
branches: [ live2d-viewer ]
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
1114

1215
jobs:
1316
build:
14-
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
15-
# You can convert this to a matrix build if you need cross-platform coverage.
16-
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
1717
runs-on: windows-latest
1818
permissions:
1919
contents: write
2020

2121
steps:
2222
- uses: actions/checkout@v4
23+
with:
24+
submodules: recursive
2325

2426
- name: Set up Python
2527
uses: actions/setup-python@v5
2628
with:
2729
python-version: 3.13
2830
architecture: X64
2931
cache: pip
30-
32+
3133
- name: Install build deps
3234
run: |
33-
python -m pip install --upgrade setuptools
35+
python -m pip install -c .github/constraints.txt setuptools
36+
37+
- name: Cache Cubism SDK
38+
uses: actions/cache@v4
39+
with:
40+
path: |
41+
Live2D/V3/Core
42+
Live2D/V3/Framework
43+
key: csmsdk-${{ hashFiles('setup.py') }}
3444

3545
- name: Download CsmNativeSDK
3646
run: python setup.py download
@@ -71,6 +81,7 @@ jobs:
7181
Compress-Archive -Path ${{github.workspace}}/x64 -DestinationPath ${{github.workspace}}/Live2DViewer-win64.zip
7282
7383
- name: Upload Wheel to Release
84+
if: startsWith(github.ref, 'refs/tags/v')
7485
uses: softprops/action-gh-release@v2
7586
with:
7687
files: |

‎.github/workflows/build-macos.yml‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- "v*.*.*"
77
branches: [ macos-workflow, build-all ]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
912

1013
jobs:
1114
build-n-publish:
@@ -14,31 +17,34 @@ jobs:
1417
permissions:
1518
contents: write
1619

17-
strategy:
18-
matrix:
19-
python-version: [ '3.11.0', '3.12.0', '3.13', '3.14' ] # versions under 3.11 are not supported on arm64
20-
fail-fast: false
21-
2220
steps:
2321
- uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
2424

2525
- name: Set up Python
2626
uses: actions/setup-python@v5
2727
with:
28-
python-version: ${{ matrix.python-version }}
28+
# Stable-ABI build: a single cp311-abi3 wheel covers Python >= 3.11
29+
python-version: '3.11'
2930
cache: pip
3031

32+
- name: Cache Cubism SDK
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
Live2D/V3/Core
37+
Live2D/V3/Framework
38+
key: csmsdk-${{ hashFiles('setup.py') }}
39+
3140
- name: Install build deps
3241
run: |
33-
python -m pip install --upgrade setuptools
34-
python -m pip install wheel
42+
python -m pip install -c .github/constraints.txt setuptools wheel
3543
3644
- name: Build a binary wheel
37-
run: |
38-
python setup.py bdist_wheel
45+
run: python setup.py bdist_wheel
3946

4047
- name: Test Run (v2, v2cpp, v3)
41-
if: ${{ matrix.python-version == '3.14' }}
4248
run: |
4349
pip install pyside6 pyopengl numpy pillow
4450
cd package
@@ -47,24 +53,23 @@ jobs:
4753
python test_run_screenshot.py v3 --model haru --output screenshot_v3.png
4854
4955
- name: Upload screenshots
50-
if: ${{ matrix.python-version == '3.14' }}
5156
uses: actions/upload-artifact@v4
5257
with:
5358
name: screenshots-macos
5459
path: package/screenshot_*.png
5560

56-
- name: Install twine
57-
run: python -m pip install twine
58-
5961
- name: Publish distribution to PyPI
62+
if: startsWith(github.ref, 'refs/tags/v')
6063
env:
6164
TWINE_USERNAME: __token__
6265
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
63-
run: twine upload dist/* --skip-existing
66+
run: |
67+
python -m pip install twine
68+
twine upload dist/* --skip-existing
6469
6570
- name: Upload Wheel to Release
71+
if: startsWith(github.ref, 'refs/tags/v')
6672
uses: softprops/action-gh-release@v2
6773
with:
68-
# tag_name: v0.4.3
6974
files: |
7075
dist/*.whl

0 commit comments

Comments
 (0)