forked from pyscf/pyscf
-
Notifications
You must be signed in to change notification settings - Fork 20
210 lines (201 loc) · 7.21 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
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: macosx_x86_64
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: |
pip 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: macosx_x86_64
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp311-macosx_arm64
CIBW_BUILD_VERBOSITY: "1"
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: |
pip 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 }}