Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build workflow #78

Merged
merged 1 commit into from
Jul 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 7 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,10 @@ jobs:
# dependencies are specified by our setup code.
python -m build --sdist .

# Zip files are not part of PEP 517, so we need to make our own.
- name: Create zipfile from tarball
shell: bash
working-directory: dist
run: |
# First assert that there is exactly one tarball, and find its name.
shopt -s failglob
tarball_pattern="*.tar.gz"
tarballs=($tarball_pattern)
[[ ${#tarballs[@]} == 1 ]]
tarball="${tarballs[0]}"
# Get the stem and make the zipfile name.
stem="${tarball%.tar.gz}"
zipfile="${stem}.zip"
# Extract the tarball and rezip it.
tar -xzf "$tarball"
zip "$zipfile" -r "$stem"
rm -r "$stem"

- uses: actions/upload-artifact@v2
with:
name: sdist
path: |
dist/*.tar.gz
dist/*.zip
path: dist/*.tar.gz
if-no-files-found: error


Expand Down Expand Up @@ -130,6 +109,7 @@ jobs:
with:
name: wheels
path: ./wheelhouse/*.whl
if-no-files-found: error


deploy:
Expand All @@ -141,11 +121,6 @@ jobs:
if: ${{ github.event.inputs.confirm_ref != '' }}
needs: [deploy_test, build_sdist, build_wheels]
runs-on: ubuntu-latest
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: 1
TWINE_REPOSITORY: pypi

steps:
- name: Download build artifacts to local runner
Expand All @@ -162,9 +137,12 @@ jobs:
python -m pip install wheels/*.whl
python -c 'import qutip_qip; print(qutip_qip.__version__); assert "dev" not in qutip_qip.__version__; assert "+" not in qutip_qip.__version__'

# We built the zipfile for convenience distributing to Windows users on
# our end, but PyPI only needs the tarball.
- name: Upload sdist and wheels to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_NON_INTERACTIVE: 1
TWINE_REPOSITORY: pypi
run: |
python -m pip install "twine"
python -m twine upload --verbose wheels/*.whl sdist/*.tar.gz