Skip to content

Commit 5bb8d3d

Browse files
authored
Add workflow for building wheels (#96)
Closes #70
1 parent 2748442 commit 5bb8d3d

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/build.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,109 @@ jobs:
6464
run: pytest -v --pyargs xtb
6565
env:
6666
OMP_NUM_THREADS: 2,1
67+
68+
manylinux:
69+
needs:
70+
- sdist
71+
runs-on: ubuntu-latest
72+
container: condaforge/linux-anvil-cos7-x86_64
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
77+
78+
defaults:
79+
run:
80+
shell: ${{ matrix.shell || 'bash -l {0}' }}
81+
82+
steps:
83+
- name: Create environment
84+
run: >-
85+
mamba create -n wheel
86+
--yes
87+
c-compiler
88+
fortran-compiler
89+
python=${{ matrix.python }}
90+
auditwheel
91+
git
92+
python-build
93+
pkg-config
94+
patchelf
95+
cffi
96+
numpy
97+
meson
98+
unzip
99+
wheel
100+
xtb
101+
- name: Download sdist
102+
uses: actions/download-artifact@v2
103+
with:
104+
name: xtb-python-sdist
105+
- name: Build wheel
106+
run: |
107+
conda activate wheel
108+
set -ex
109+
tar xvf xtb-*.tar.gz
110+
python -m build xtb-*/ --wheel ${{ env.SETUP_ARGS }}
111+
auditwheel show xtb-*/dist/*.whl
112+
auditwheel repair -w . xtb-*/dist/*.whl --plat ${{ env.plat }}
113+
env:
114+
plat: manylinux${{ matrix.python == '3.6' && '2010' || '_2_12' }}_x86_64
115+
SETUP_ARGS: >-
116+
-Csetup-args=-Dxtb-6.5.1:la_backend=netlib
117+
-Csetup-args=-Dmctc-lib:json=disabled
118+
- uses: actions/upload-artifact@v3
119+
with:
120+
name: xtb-python-${{ matrix.python }}
121+
path: ./*.whl
122+
retention-days: 5
123+
124+
release:
125+
needs:
126+
- sdist
127+
- manylinux
128+
runs-on: ubuntu-latest
129+
steps:
130+
- name: Download artifacts
131+
uses: actions/download-artifact@v2
132+
with:
133+
path: ${{ github.workspace }} # This will download all files
134+
135+
- name: Create SHA256 checksums
136+
run: |
137+
set -ex
138+
for output in xtb*/xtb*; do
139+
pushd $(dirname "$output")
140+
sha256sum $(basename "$output") | tee $(basename "$output").sha256
141+
popd
142+
done
143+
144+
- name: Copy release artifacts
145+
run: |
146+
mkdir dist/
147+
cp -v xtb*/xtb*.whl xtb*/xtb*.tar.gz dist/
148+
149+
# - name: Publish to Test PyPI
150+
# if: ${{ github.event_name == 'release' }}
151+
# uses: pypa/gh-action-pypi-publish@release/v1
152+
# with:
153+
# user: __token__
154+
# password: ${{ secrets.TEST_PYPI_TOKEN }}
155+
# repository_url: https://test.pypi.org/legacy/
156+
157+
- name: Upload assets
158+
uses: svenstaro/upload-release-action@v2
159+
if: ${{ github.event_name == 'release' }}
160+
with:
161+
repo_token: ${{ secrets.GITHUB_TOKEN }}
162+
file: xtb*/xtb*
163+
file_glob: true
164+
tag: ${{ github.ref }}
165+
overwrite: true
166+
167+
# - name: Publish to PyPI
168+
# if: ${{ github.event_name == 'release' }}
169+
# uses: pypa/gh-action-pypi-publish@release/v1
170+
# with:
171+
# user: __token__
172+
# password: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)