Skip to content

Commit

Permalink
Add workflow for building wheels (#96)
Browse files Browse the repository at this point in the history
Closes #70
  • Loading branch information
awvwgk authored Dec 31, 2022
1 parent 2748442 commit 5bb8d3d
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,109 @@ jobs:
run: pytest -v --pyargs xtb
env:
OMP_NUM_THREADS: 2,1

manylinux:
needs:
- sdist
runs-on: ubuntu-latest
container: condaforge/linux-anvil-cos7-x86_64
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']

defaults:
run:
shell: ${{ matrix.shell || 'bash -l {0}' }}

steps:
- name: Create environment
run: >-
mamba create -n wheel
--yes
c-compiler
fortran-compiler
python=${{ matrix.python }}
auditwheel
git
python-build
pkg-config
patchelf
cffi
numpy
meson
unzip
wheel
xtb
- name: Download sdist
uses: actions/download-artifact@v2
with:
name: xtb-python-sdist
- name: Build wheel
run: |
conda activate wheel
set -ex
tar xvf xtb-*.tar.gz
python -m build xtb-*/ --wheel ${{ env.SETUP_ARGS }}
auditwheel show xtb-*/dist/*.whl
auditwheel repair -w . xtb-*/dist/*.whl --plat ${{ env.plat }}
env:
plat: manylinux${{ matrix.python == '3.6' && '2010' || '_2_12' }}_x86_64
SETUP_ARGS: >-
-Csetup-args=-Dxtb-6.5.1:la_backend=netlib
-Csetup-args=-Dmctc-lib:json=disabled
- uses: actions/upload-artifact@v3
with:
name: xtb-python-${{ matrix.python }}
path: ./*.whl
retention-days: 5

release:
needs:
- sdist
- manylinux
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: ${{ github.workspace }} # This will download all files

- name: Create SHA256 checksums
run: |
set -ex
for output in xtb*/xtb*; do
pushd $(dirname "$output")
sha256sum $(basename "$output") | tee $(basename "$output").sha256
popd
done
- name: Copy release artifacts
run: |
mkdir dist/
cp -v xtb*/xtb*.whl xtb*/xtb*.tar.gz dist/
# - name: Publish to Test PyPI
# if: ${{ github.event_name == 'release' }}
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_TOKEN }}
# repository_url: https://test.pypi.org/legacy/

- name: Upload assets
uses: svenstaro/upload-release-action@v2
if: ${{ github.event_name == 'release' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: xtb*/xtb*
file_glob: true
tag: ${{ github.ref }}
overwrite: true

# - name: Publish to PyPI
# if: ${{ github.event_name == 'release' }}
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_TOKEN }}

0 comments on commit 5bb8d3d

Please sign in to comment.