Update for Python 3.13 (#260) #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: wheel | |
on: [push, workflow_dispatch] | |
env: | |
# https://github.com/actions/checkout/issues/1809 | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
jobs: | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Reorganize repository | |
run: | | |
git config user.email "" | |
git config user.name "dummy" | |
git subtree add --prefix python/subprojects/dftd4 . HEAD | |
git mv {assets,python/dftd4}/parameters.toml | |
git commit -m "Python dist" | |
- run: | | |
pipx run build python/ --sdist --outdir . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dftd4-python-sdist | |
path: ./*.tar.gz | |
retention-days: 5 | |
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 | |
pip | |
python-build | |
pkgconfig | |
patchelf | |
cffi | |
numpy | |
meson | |
unzip | |
wheel | |
- name: Download sdist | |
uses: actions/download-artifact@v2 | |
with: | |
name: dftd4-python-sdist | |
- name: Build wheel | |
run: | | |
conda activate wheel | |
set -ex | |
tar xvf dftd4-*.tar.gz | |
python -m build dftd4-*/ --wheel | |
auditwheel show dftd4-*/dist/*.whl | |
auditwheel repair -w . dftd4-*/dist/*.whl --plat ${{ env.plat }} | |
env: | |
plat: manylinux2014_x86_64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dftd4-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 dftd4*/dftd4*; do | |
pushd $(dirname "$output") | |
sha256sum $(basename "$output") | tee $(basename "$output").sha256 | |
popd | |
done | |
- name: Copy release artifacts | |
run: | | |
mkdir dist/ | |
cp -v dftd4*/dftd4*.whl dftd4*/dftd4*.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: dftd4*/dftd4* | |
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 }} |