Skip to content

Publish

Publish #7

Workflow file for this run

name: Publish
on:
release:
types:
# Note: editing the prerelease then marking as release does not trigger
# this pipeline
# - prereleased
- released
workflow_dispatch:
jobs:
release-pypi-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build wheels
run: |
docker run --rm -v ${{ github.workspace }}:/src/pyscf pyscf/pyscf-pypa-env:latest \
bash /src/pyscf/docker/pypa-env/build-wheels.sh
- name: List available wheels
run: |
ls ${{ github.workspace }}/linux-wheels
- name: Publish to PyPI
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
#password: ${{ secrets.PYPI_TEST_API_TOKEN }}
#repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ${{ github.workspace }}/linux-wheels
verbose: true
release-pypi-aarch64:
runs-on: ubuntu-latest
strategy:
matrix:
pyver: [cp39-cp39]
fail-fast: false
env:
img: quay.io/pypa/manylinux2014_aarch64:2023-03-12-25fd859
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
- name: Build Wheel
run: |
docker run --rm -v ${{ github.workspace }}:/src/pyscf:rw --workdir=/src/pyscf \
${{ env.img }} \
bash -exc '/opt/python/${{ matrix.pyver }}/bin/pip install --upgrade pip setuptools && \
yum install -y epel-release && \
yum-config-manager --enable epel && \
yum install -y openblas-devel gcc && \
export src=${GITHUB_WORKSPACE:-/src/pyscf} && \
export dst=${GITHUB_WORKSPACE:-/src/pyscf}/linux-wheels && \
export CMAKE_CONFIGURE_ARGS="-DWITH_F12=OFF" && \
mkdir -p /root/wheelhouse $src/linux-wheels && \
sed -i "/ if basename(fn) not in needed_libs:/s/basename.*libs/1/" /opt/_internal/pipx/venvs/auditwheel/lib/python*/site-packages/auditwheel/wheel_abi.py && \
/opt/python/${{ matrix.pyver }}/bin/pip wheel -v --no-deps --no-clean -w /root/wheelhouse $src && \
export whl=`ls /root/wheelhouse/pyscf-*-linux_*.whl` && \
auditwheel -v repair "$whl" --lib-sdir /lib -w $dst'
- name: List available wheels
run: |
ls ${{ github.workspace }}/linux-wheels
- name: Publish to PyPI
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
#password: ${{ secrets.PYPI_TEST_API_TOKEN }}
#repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ${{ github.workspace }}/linux-wheels
verbose: true
release-pypi-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: |
python3 setup.py sdist
- name: List available sdist
run: |
ls ${{ github.workspace }}/dist
- name: Publish to PyPI
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
#password: ${{ secrets.PYPI_TEST_API_TOKEN }}
#repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ${{ github.workspace }}/dist
verbose: true
release-pypi-macos-x86:
name: Build wheels for macos
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp311-macosx_x86_64
CIBW_BUILD_VERBOSITY: "1"
CMAKE_CONFIGURE_ARGS: "-DWITH_F12=OFF"
with:
output-dir: mac-wheels
- name: List available wheels
run: |
ls mac-wheels
- name: Publish to PyPI
run: |
pip3 install twine
export TWINE_USERNAME=__token__
export TWINE_PASSWORD="${{ secrets.PYPI_API_TOKEN }}"
twine upload --verbose mac-wheels/*
release-pypi-macos-arm64:
name: Build wheels for Apple M chips
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp311-macosx_arm64
CIBW_BUILD_VERBOSITY: "1"
# Cross-platform build for arm64 wheels on x86 platform
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CMAKE_CONFIGURE_ARGS: "-DWITH_F12=OFF"
CMAKE_OSX_ARCHITECTURES: arm64
with:
output-dir: mac-wheels
- name: List available wheels
run: |
ls mac-wheels
- name: Publish to PyPI
run: |
pip3 install twine
export TWINE_USERNAME=__token__
export TWINE_PASSWORD="${{ secrets.PYPI_API_TOKEN }}"
twine upload --verbose mac-wheels/*
release-conda-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
conda-channels: anaconda, conda-forge
- run: conda --version
- run: which python
- name: Publish to conda
run: |
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
conda install -y anaconda-client conda-build
conda config --set anaconda_upload yes
conda build --output-folder . conda
# Disable macos conda release for Error during compling:
# MACOSX_DEPLOYMENT_TARGET mismatch: now "10.9" but "10.15" during configure
#release-conda-macos:
# runs-on: macos-latest
# strategy:
# matrix:
# python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
# fail-fast: false
# steps:
# - uses: actions/checkout@v3
# - name: Setup conda
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Publish to conda
# run: |
# $CONDA/bin/conda install -y anaconda-client conda-build
# $CONDA/bin/conda build --output-folder . conda
# export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
# $CONDA/bin/conda config --set anaconda_upload yes
# $CONDA/bin/anaconda upload linux-64/*.tar.bz2
release-docker:
runs-on: ubuntu-latest
needs: release-pypi-linux
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: pyscf
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: docker-tag
uses: battila7/get-version-action@v2
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
file: docker/Dockerfile
push: true
tags: pyscf/pyscf:${{ steps.docker-tag.outputs.version-without-v }}
#cache-from: type=local,src=/tmp/.buildx-cache
#cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}