这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
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
23 changes: 14 additions & 9 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
# with:
# platforms: all

# this will create a dummy dev version based on the current time to avoid conflicts on test.pypi.org
- name: Create dev version
if: github.event_name != 'push' || startsWith(github.event.ref, 'refs/tags/v') != true
run: cd ./scripts && python3 set_version.py --dev
Expand Down Expand Up @@ -61,10 +62,14 @@ jobs:

CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
CIBW_BEFORE_BUILD_MACOS: ./scripts/ci/setup-macos.sh

- name: reorganize files
run: cp ./scripts/*.version ./wheelhouse && cp ./scripts/test_pypi.sh ./wheelhouse
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
path: |
./wheelhouse/*.whl
./wheelhouse/*.version
./wheelhouse/test_pypi.sh

# cf. https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
# potentially also create a sdist.
Expand All @@ -82,11 +87,13 @@ jobs:
name: artifact
path: dist

- name: remove test files
run: rm dist/*.version && rm dist/*.sh

- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: ${{ secrets.pypi_user }}
password: ${{ secrets.pypi_password }}
# repository_url: https://test.pypi.org/legacy/ # uncomment for test purposes

upload_testpypi:
needs: [ build_wheels ]
Expand All @@ -100,13 +107,11 @@ jobs:
name: artifact
path: dist

- name: reorganize
run: mkdir -p scripts && mv dist/*.sh ./scripts/ && mv dist/*.version ./scripts/ && chmod +x ./scripts/test_pypi.sh

- uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: ${{ secrets.pypi_user }}
password: ${{ secrets.pypi_password }}
repository_url: https://test.pypi.org/legacy/ # uncomment for test purposes

# TODO: add here test checkout using matrix of python versions to validate everything runs...
- name: Pip check
run: python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple tuplex && python3 -c 'import tuplex; c = tuplex.Context()'
shell: bash
repository_url: https://test.pypi.org/legacy/ # uncomment for test purposes
2 changes: 1 addition & 1 deletion scripts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ python_backup/
python_patched/
*.tgz
*.log

*.version
9 changes: 9 additions & 0 deletions scripts/set_version.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import os
import re
import datetime
Expand Down Expand Up @@ -70,9 +71,17 @@ def get_latest_pypi_version(url='https://pypi.org/simple/tuplex/'):
# patch should be dev...
no = int(patch[len('dev'):])
patch = 'dev' + str(no + 1)

# to avoid conflicts use datetime as version!
patch = 'dev' + datetime.datetime.now().strftime("%Y%m%d%H%M%S%f")

dev_version = '{}.{}.{}'.format(major, minor, patch)
version = dev_version
logging.info('creating dev version {}'.format(dev_version))

# write to file
with open('dev.version', 'w') as fp:
fp.write(dev_version)
else:
# skip if requested version is on test pypi
if not args.force and LooseVersion(version) <= LooseVersion(version_pypi):
Expand Down
11 changes: 11 additions & 0 deletions scripts/test_pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# checks out tuplex from test.pypi
python3 --version
cat ./scripts/dev.version
echo "tuplex==$(cat ./scripts/dev.version)"

# version propagation takes a while...
sleep 30s

python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple "tuplex==$(cat ./scripts/dev.version)"
python3 -c 'import tuplex; c = tuplex.Context()'