Skip to content

Commit 09b631c

Browse files
authored
update publish workflow (#70)
1 parent 0466eb8 commit 09b631c

File tree

1 file changed

+68
-22
lines changed

1 file changed

+68
-22
lines changed

.github/workflows/publish_cuda_plugin.yml

Lines changed: 68 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,84 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build_wheel_linux_x86:
11-
name: Build wheels on ${{ matrix.os }}
12-
runs-on: ${{ matrix.os }}
13-
strategy:
14-
matrix:
15-
os: [ubuntu-22.04]
16-
python-version: ["3.10", "3.11", "3.12", "3.13"]
10+
build_wheel_linux:
11+
runs-on: ubuntu-latest
1712

1813
steps:
1914
- uses: actions/checkout@v4
2015

21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
2318
with:
24-
python-version: ${{ matrix.python-version }}
19+
platforms: all
2520

26-
- name: Install Bazel
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Build wheel for x86_64
2725
run: |
28-
sudo apt install apt-transport-https curl gnupg -y
29-
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
30-
sudo mv bazel-archive-keyring.gpg /usr/share/keyrings
31-
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
32-
sudo apt update && sudo apt install bazel-7.4.1
26+
docker run --rm -v ${{ github.workspace }}:/project -w /project quay.io/pypa/manylinux2014_x86_64 bash -c "
27+
yum install -y curl && \
28+
curl -Lo /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 && \
29+
chmod +x /usr/local/bin/bazel && \
30+
/opt/python/cp311-cp311/bin/pip install --upgrade pip setuptools wheel auditwheel && \
31+
ln -s /opt/python/cp311-cp311/bin/python3 /usr/local/bin/python3 && \
32+
cd pyscfadlib && \
33+
python3 build/build.py build --python_version=3.10 && \
34+
python3 build/build.py build --python_version=3.11 && \
35+
python3 build/build.py build --python_version=3.12 && \
36+
python3 build/build.py build --python_version=3.13 && \
37+
auditwheel repair dist/*.whl -w wheelhouse_x86_64/ && \
38+
rm -rf dist/
39+
"
40+
41+
- name: Upload x86_64 wheel
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: cuda_plugin_wheels_x86_64
45+
path: pyscfadlib/wheelhouse_x86_64/*.whl
46+
overwrite: true
3347

34-
- name: Build wheels
48+
- name: Build wheel for aarch64
3549
run: |
36-
cd pyscfadlib
37-
python build/build.py build
50+
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}:/project -w /project quay.io/pypa/manylinux2014_aarch64 bash -c "
51+
yum install -y curl && \
52+
curl -Lo /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-arm64 && \
53+
chmod +x /usr/local/bin/bazel && \
54+
/opt/python/cp311-cp311/bin/pip install --upgrade pip setuptools wheel auditwheel && \
55+
ln -s /opt/python/cp311-cp311/bin/python3 /usr/local/bin/python3 && \
56+
cd pyscfadlib && \
57+
python3 build/build.py build --python_version=3.10 --target_cpu=aarch64 && \
58+
python3 build/build.py build --python_version=3.11 --target_cpu=aarch64 && \
59+
python3 build/build.py build --python_version=3.12 --target_cpu=aarch64 && \
60+
python3 build/build.py build --python_version=3.13 --target_cpu=aarch64 && \
61+
auditwheel repair dist/*.whl -w wheelhouse_aarch64/
62+
"
3863
39-
- name: Upload wheels
64+
- name: Upload aarch64 wheel
4065
uses: actions/upload-artifact@v4
4166
with:
42-
name: cuda_plugin_wheels
43-
path: pyscfadlib/dist/*.whl
67+
name: cuda_plugin_wheels_aarch64
68+
path: pyscfadlib/wheelhouse_aarch64/*.whl
4469
overwrite: true
70+
71+
publish_pypi_linux:
72+
name: publish linux wheels to pypi
73+
needs: build_wheel_linux
74+
runs-on: ubuntu-latest
75+
76+
environment: release
77+
permissions:
78+
id-token: write
79+
80+
steps:
81+
- name: Download wheels
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: dist
85+
merge-multiple: true
86+
87+
- run: ls -R dist
88+
89+
- name: Publish to PyPI
90+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)