@@ -14,19 +14,127 @@ concurrency:
1414 cancel-in-progress : false
1515
1616jobs :
17+ build-wheels :
18+ name : Build wheels for ${{ matrix.os }}
19+ runs-on : ${{ matrix.os }}
20+ strategy :
21+ matrix :
22+ os : [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest]
23+ steps :
24+ # Note: we need to checkout the repository at the workflow sha in case during the workflow
25+ # the branch was updated. To keep PSR working with the configured release branches,
26+ # we force a checkout of the desired release branch but at the workflow sha HEAD.
27+ - name : Check out repository at workflow sha
28+ uses : actions/checkout@v6
29+ with :
30+ fetch-depth : 0
31+ ref : ${{ github.sha }}
32+ - name : Force correct release branch on workflow sha
33+ run : git checkout -B ${{ github.ref_name }} ${{ github.sha }}
34+ # to build the package, a preview of the released version is created but not committed
35+ - name : Create release preview
36+ run : |
37+ python -m pip install --upgrade pip
38+ pip install build wheel python-semantic-release
39+ semantic-release version --no-commit --skip-build --no-vcs-release --no-tag
40+ - name : Install OpenMP on MacOS
41+ if : ${{ startsWith(matrix.os, 'macos') }}
42+ run : |
43+ git clone --depth 1 https://github.com/llvm/llvm-project.git
44+
45+ cmake -S llvm-project/runtimes -B llvm-project/build-openmp \
46+ -DLLVM_ENABLE_RUNTIMES=openmp \
47+ -DCMAKE_BUILD_TYPE=Release \
48+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/llvm-project/openmp/install" \
49+ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
50+ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
51+ -DLIBOMP_ENABLE_SHARED=ON
52+
53+ cmake --build llvm-project/build-openmp -j
54+ cmake --install llvm-project/build-openmp
55+ - name : Build wheels
56+ uses : pypa/cibuildwheel@v3.3.0
57+ env :
58+ CIBW_SKIP : " *-win32 cp314t-* *-musllinux_*"
59+ CIBW_CONFIG_SETTINGS_MACOS : >
60+ cmake.args=-DOPENMP_ROOT=${{ github.workspace }}/llvm-project/openmp/install
61+ CIBW_ENVIRONMENT_MACOS : >
62+ MACOSX_DEPLOYMENT_TARGET=10.15
63+ DYLD_LIBRARY_PATH="${{ github.workspace }}/llvm-project/openmp/install/lib"
64+ CIBW_BEFORE_BUILD_WINDOWS : " pip install delvewheel"
65+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : " delvewheel repair -w {dest_dir} {wheel}"
66+ CIBW_TEST_COMMAND : pytest {package}/test
67+ CIBW_TEST_REQUIRES : pytest
68+ CIBW_BEFORE_TEST_LINUX : >
69+ ARCH=$(python -c "import platform; print(platform.machine())") &&
70+ if [ "$ARCH" = "aarch64" ]; then
71+ python -m pip install --upgrade pip setuptools wheel ninja build meson-python &&
72+ python -m pip install torch==2.10.0 &&
73+ python -m pip install --no-build-isolation --no-binary=torch-scatter torch-scatter -f https://data.pyg.org/whl/torch-2.10.0+cpu.html &&
74+ python -m pip install --no-build-isolation --no-binary=torch-cluster torch-cluster -f https://data.pyg.org/whl/torch-2.10.0+cpu.html;
75+ else
76+ python -m pip install --upgrade pip setuptools wheel build;
77+ python -m pip install torch==2.10.0 &&
78+ python -m pip install --no-build-isolation --no-binary=torch-scatter torch-scatter -f https://data.pyg.org/whl/torch-2.10.0+cpu.html &&
79+ python -m pip install --no-build-isolation --no-binary=torch-cluster torch-cluster -f https://data.pyg.org/whl/torch-2.10.0+cpu.html;
80+ fi
81+ CIBW_BEFORE_TEST_MACOS : >
82+ python -m pip install --upgrade pip "setuptools<81" &&
83+ python -m pip install torch==2.10.0 &&
84+ python -m pip install --no-build-isolation torch-scatter -f https://data.pyg.org/whl/torch-2.10.0+cpu.html &&
85+ python -m pip install --no-build-isolation torch-cluster -f https://data.pyg.org/whl/torch-2.10.0+cpu.html
86+ CIBW_BEFORE_TEST_WINDOWS : >
87+ python -m pip install --upgrade pip &&
88+ python -m pip install torch==2.10.0 &&
89+ python -m pip install --no-build-isolation torch-scatter -f https://data.pyg.org/whl/torch-2.10.0+cpu.html &&
90+ python -m pip install --no-build-isolation torch-cluster -f https://data.pyg.org/whl/torch-2.10.0+cpu.html
91+ - uses : actions/upload-artifact@v6
92+ with :
93+ name : cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
94+ path : ./wheelhouse/*.whl
95+
96+ build-sdist :
97+ name : Build source distribution
98+ runs-on : ubuntu-latest
99+ steps :
100+ - name : Check out repository at workflow sha
101+ uses : actions/checkout@v6
102+ with :
103+ fetch-depth : 0
104+ ref : ${{ github.sha }}
105+ - name : Force correct release branch on workflow sha
106+ run : git checkout -B ${{ github.ref_name }} ${{ github.sha }}
107+ - name : Setup up Python
108+ uses : actions/setup-python@v6
109+ with :
110+ python-version : ' 3.14'
111+ # to build the package, a preview of the released version is created but not committed
112+ - name : Create release preview
113+ run : |
114+ python -m pip install --upgrade pip
115+ pip install build wheel python-semantic-release
116+ semantic-release version --no-commit --skip-build --no-vcs-release --no-tag
117+ - name : Install build dependencies
118+ run : |
119+ python -m pip install --upgrade pip
120+ pip install build
121+ - name : Build sdist
122+ run : python -m build --sdist
123+ - uses : actions/upload-artifact@v6
124+ with :
125+ name : cibw-sdist
126+ path : dist/*.tar.gz
127+
17128 release-package :
129+ needs : [build-wheels, build-sdist]
18130 if : github.repository == 'ai4trees/pointtree' && github.ref_name == 'main'
19- runs-on : ubuntu-latest
131+ runs-on : ' ubuntu-latest'
20132 steps :
21133 - name : Clean up potential remnants of past jobs
22134 uses : AutoModality/action-clean@v1.1.0
23- # Note: we need to checkout the repository at the workflow sha in case during the workflow
24- # the branch was updated. To keep PSR working with the configured release branches,
25- # we force a checkout of the desired release branch but at the workflow sha HEAD.
26135 - name : Check out repository at workflow sha
27- uses : actions/checkout@v4
136+ uses : actions/checkout@v6
28137 with :
29- token : ${{ secrets.RELEASE_TOKEN }}
30138 fetch-depth : 0
31139 ref : ${{ github.sha }}
32140 - name : Force correct release branch on workflow sha
@@ -35,26 +143,33 @@ jobs:
35143 git config --global user.email "github-actions[bot]@users.noreply.github.com"
36144 git config --global user.name "github-actions[bot]"
37145 git checkout -B ${{ github.ref_name }} ${{ github.sha }}
38- - name : Install build and package dependencies
146+ - uses : actions/download-artifact@v4
147+ with :
148+ # unpacks all CIBW artifacts into dist/
149+ pattern : cibw-*
150+ path : dist
151+ merge-multiple : true
152+ - name : Setup up Python
153+ uses : actions/setup-python@v6
154+ with :
155+ python-version : ' 3.14'
156+ - name : Install build dependencies
39157 run : |
40158 python -m pip install --upgrade pip
41- pip install build wheel python-semantic-release setuptools
42- pip install torch==2.4.0
43- pip install torch-scatter -f https://data.pyg.org/whl/torch-2.4.0+cpu.html
44- pip install torch-cluster -f https://data.pyg.org/whl/torch-2.4.0+cpu.html
45- python -m pip install .
159+ pip install build wheel python-semantic-release
46160 - name : Create release
47161 id : release
48162 run : |
49- semantic-release version
163+ git config --global --add safe.directory $(realpath .)
164+ semantic-release version --skip-build
50165 env :
51- PSR_DOCKER_GITHUB_ACTION : true
52- GH_TOKEN : ${{ secrets.RELEASE_TOKEN }}
166+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53167 - name : Publish package to TestPyPI
54168 uses : pypa/gh-action-pypi-publish@release/v1
55169 if : steps.release.outputs.released == 'true'
56170 with :
57171 repository-url : https://test.pypi.org/legacy/
172+ user : __token__
58173 password : ${{ secrets.TEST_PYPI_API_TOKEN }}
59174 - name : Test install from TestPyPI
60175 run : |
66181 uses : pypa/gh-action-pypi-publish@release/v1
67182 if : steps.release.outputs.released == 'true'
68183 with :
184+ user : __token__
69185 password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments