From 97e9245c05377ffca50f9ed1e3d9d07e19b16db1 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 13:20:07 -0500 Subject: [PATCH 01/18] cirrus: Copy upload code from gqlmod Co-authored-by: Nicolas Braud-Santoni --- .ci/upload.xsh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ .cirrus.yml | 36 ++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 .ci/upload.xsh diff --git a/.ci/upload.xsh b/.ci/upload.xsh new file mode 100644 index 00000000..6cddf7c7 --- /dev/null +++ b/.ci/upload.xsh @@ -0,0 +1,65 @@ +#!/usr/bin/xonsh +import io +import sys +import tempfile +from urllib.request import urlopen, Request +from urllib.error import HTTPError +import zipfile + +$RAISE_SUBPROC_ERROR = True + +ARTIFACTS_URL = f"https://api.cirrus-ci.com/v1/artifact/build/{$CIRRUS_BUILD_ID}/build/dist.zip" +PYPI_TEST_REPO = "https://test.pypi.org/legacy/" + + +with tempfile.TemporaryDirectory() as td: + cd @(td) + + with urlopen(ARTIFACTS_URL) as resp: + zipdata = resp.read() + + with zipfile.ZipFile(io.BytesIO(zipdata)) as zf: + # nl = zf.namelist() + # print(f"Found {len(nl)} files from build:", *nl) + zf.extractall() + + dists = [f for f in pg`**` if '+' not in f.name and f.is_file()] + + if not dists: + print("No uploadable dists found, skipping upload") + sys.exit(0) + else: + print("Found dists:", *dists) + + print("Uploading to test repo...") + + twine upload --repository-url @(PYPI_TEST_REPO) --username __token__ --password $TWINE_TEST_TOKEN @(dists) + + print("") + + if 'CIRRUS_RELEASE' in ${...}: + print("Uploading to GitHub...") + for dist in dists: + print(f"\t{dist.name}...") + dest_url = f"https://uploads.github.com/repos/{$CIRRUS_REPO_FULL_NAME}/releases/{$CIRRUS_RELEASE}/assets?name={dist.name}" + with dist.open('rb') as fobj: + buff = fobj.read() + try: + resp = urlopen(Request( + url=dest_url, + method='POST', + data=buff, + headers={ + "Authorization": f"token {$GITHUB_TOKEN}", + "Content-Type": "application/octet-stream", + }, + )) + except HTTPError as exc: + print(exc.headers) + print(exc.read()) + raise + + print("") + + print("Uploading to PyPI...") + twine upload --username __token__ --password $TWINE_PROD_TOKEN @(dists) diff --git a/.cirrus.yml b/.cirrus.yml index 9c8056bd..f1ff62e1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -26,6 +26,7 @@ pep517_task: task: name: "Linux $IMAGE" + alias: Tests skip: $CIRRUS_BRANCH =~ '.*\.tmp' allow_failures: $IMAGE =~ '.*-rc-.*' env: @@ -54,6 +55,7 @@ task: - pytest macOS_task: + alias: Tests skip: $CIRRUS_BRANCH =~ '.*\.tmp' osx_instance: image: catalina-base @@ -80,6 +82,7 @@ macOS_task: task: name: "Windows $IMAGE" + alias: Tests skip: $CIRRUS_BRANCH =~ '.*\.tmp' allow_failures: $IMAGE =~ '.*-rc-.*' windows_container: @@ -99,3 +102,36 @@ task: - C:\Python\python.exe --version - C:\Python\python.exe -m pip list - C:\Python\python.exe -m pytest + + +build_task: + container: + image: python:3 + setup_script: + - pip install bork + script: + - bork build + dist_artifacts: + path: "dist/**" + + +upload_task: + only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_RELEASE != '' + depends_on: + - build + - docs + - pep517 + - Tests + env: + TWINE_TEST_TOKEN: "..." + TWINE_PROD_TOKEN: "..." + GITHUB_TOKEN: "..." + + container: + image: xonsh/xonsh:slim + + install_script: + - pip install twine + + script: + - xonsh .ci/upload.xsh From 689e4fc8ff5fc70b56f365d0aab800d8f575282f Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 13:24:39 -0500 Subject: [PATCH 02/18] setup: Use setuptools_scm to pull version Co-authored-by: Nicolas Braud-Santoni --- pyproject.toml | 2 +- setup.cfg | 3 ++- setup.py | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a313f45d..356c295e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] # Minimum requirements for the build system to execute. -requires = ["setuptools", "wheel"] # PEP 508 specifications. +requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"] # Actually tell PEP517 tools to call setuptools build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 30f77a42..b674413d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,6 @@ test = pytest [metadata] name = ppb -version = 0.7.0 author = Piper Thunstrom author_email = pathunstrom@gmail.com description = An Event Driven Python Game Engine @@ -32,5 +31,7 @@ packages = setup_requires = pytest-runner + wheel + setuptools_scm python_requires = >= 3.6, < 3.8 diff --git a/setup.py b/setup.py index ce402e03..5e5912fa 100755 --- a/setup.py +++ b/setup.py @@ -15,6 +15,9 @@ def requirements(section=None): # See setup.cfg for the actual configuration. setup( + use_scm_version={ + 'local_scheme': 'dirty-tag', + }, install_requires=requirements(), tests_require=requirements('tests'), ) From 75d4456b58f40352f2bee0b224a29e3d8e105f18 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 13:36:58 -0500 Subject: [PATCH 03/18] Cirrus: Don't use -slim containers Need the `git` command with setuptools_scm Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index f1ff62e1..fee233fa 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ docs_task: skip: $CIRRUS_BRANCH =~ '.*\.tmp' container: - image: python:3.7-slim + image: python:3.7 install_script: - apt update || true ; apt install -qq -y make @@ -15,7 +15,7 @@ docs_task: pep517_task: skip: $CIRRUS_BRANCH =~ '.*\.tmp' container: - image: python:3.7-slim + image: python:3.7 install_script: - pip install --upgrade-strategy eager -U pep517 @@ -31,10 +31,10 @@ task: allow_failures: $IMAGE =~ '.*-rc-.*' env: matrix: - - IMAGE: python:3.6-slim - - IMAGE: python:3.7-slim - # - IMAGE: python:3.8-rc-slim - - IMAGE: pypy:3.6-slim + - IMAGE: python:3.6 + - IMAGE: python:3.7 + # - IMAGE: python:3.8 + - IMAGE: pypy:3.6 container: image: $IMAGE From feb2353840ed239c0406c908465c459bd9785fc9 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 14:00:15 -0500 Subject: [PATCH 04/18] cirrus: Use built wheel in all tasks Can't easily install git into the windows container, so just use the built wheel Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 67 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index fee233fa..86d10e12 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,28 +1,42 @@ -docs_task: +pep517_task: skip: $CIRRUS_BRANCH =~ '.*\.tmp' container: image: python:3.7 install_script: - - apt update || true ; apt install -qq -y make - - pip install --upgrade-strategy eager -U -r requirements-docs.txt - - pip install . + - pip install --upgrade-strategy eager -U pep517 script: - - make -C docs/ linkcheck - - make -C docs/ html + - python3 -m pep517.check . -pep517_task: + +build_task: + container: + image: python:3 + setup_script: + - pip install bork + script: + - bork build + dist_artifacts: + path: "dist/**" + + +docs_task: skip: $CIRRUS_BRANCH =~ '.*\.tmp' container: - image: python:3.7 + image: python:3.7-slim + + depends_on: + - build install_script: - - pip install --upgrade-strategy eager -U pep517 + - apt update || true ; apt install -qq -y make + - pip install --upgrade-strategy eager -U -r requirements-docs.txt + - pip install dist/ppb-*.whl script: - - python3 -m pep517.check . - + - make -C docs/ linkcheck + - make -C docs/ html task: name: "Linux $IMAGE" @@ -31,14 +45,17 @@ task: allow_failures: $IMAGE =~ '.*-rc-.*' env: matrix: - - IMAGE: python:3.6 - - IMAGE: python:3.7 - # - IMAGE: python:3.8 + - IMAGE: python:3.6-slim + - IMAGE: python:3.7-slim + # - IMAGE: python:3.8-slim - IMAGE: pypy:3.6 container: image: $IMAGE + depends_on: + - build + install_script: - >- if command -v pypy3 >/dev/null || python3 -c 'import sys; exit(sys.implementation.version.releaselevel == "final")'; then @@ -46,7 +63,7 @@ task: apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc fi - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - pip install . + - pip install dist/ppb-*.whl script: - command -v pypy3 >/dev/null && export PY=pypy3 @@ -64,6 +81,8 @@ macOS_task: matrix: - PYTHON: 3.6.8 - PYTHON: 3.7.2 + depends_on: + - build install_script: # Per the pyenv homebrew recommendations. # https://github.com/pyenv/pyenv/wiki#suggested-build-environment @@ -73,7 +92,7 @@ macOS_task: - pyenv global ${PYTHON} - pyenv rehash - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - pip install . + - pip install dist/ppb-*.whl script: - python3 --version @@ -91,12 +110,12 @@ task: env: matrix: - - IMAGE: python:3.6-windowsservercore-1809 - - IMAGE: python:3.7-windowsservercore-1809 + - IMAGE: python:3.6-windowsservercore + - IMAGE: python:3.7-windowsservercore install_script: - C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements-tests.txt - - C:\Python\python.exe -m pip install . + - C:\Python\python.exe -m pip install dist/ppb-*.whl script: - C:\Python\python.exe --version @@ -104,16 +123,6 @@ task: - C:\Python\python.exe -m pytest -build_task: - container: - image: python:3 - setup_script: - - pip install bork - script: - - bork build - dist_artifacts: - path: "dist/**" - upload_task: only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_RELEASE != '' From 2dadc9ec5e8fe76aebf3e6c03da61ab75fc43743 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 14:12:24 -0500 Subject: [PATCH 05/18] cirrus: Cirrus doesn't do wildcard expansion, apparently. Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 86d10e12..831df0b1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -63,7 +63,7 @@ task: apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc fi - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - pip install dist/ppb-*.whl + - sh -c "pip install dist/ppb-*.whl" script: - command -v pypy3 >/dev/null && export PY=pypy3 @@ -92,7 +92,7 @@ macOS_task: - pyenv global ${PYTHON} - pyenv rehash - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - pip install dist/ppb-*.whl + - sh -c "pip install dist/ppb-*.whl" script: - python3 --version From 2c3b16c4257a772d43ac56ba8d9c5ca391bc435d Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 14:17:29 -0500 Subject: [PATCH 06/18] cirrus: Wildcards just don't work at all?? Try this version Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 831df0b1..425a881a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -63,7 +63,7 @@ task: apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc fi - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - sh -c "pip install dist/ppb-*.whl" + - pip install $(find dist -name ppb-*.whl) script: - command -v pypy3 >/dev/null && export PY=pypy3 @@ -92,7 +92,7 @@ macOS_task: - pyenv global ${PYTHON} - pyenv rehash - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - sh -c "pip install dist/ppb-*.whl" + - pip install $(find dist -name ppb-*.whl) script: - python3 --version From e2a1f5689dfbcd2b2fa06da6f4ecc38088a6fc9f Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 16:31:28 -0500 Subject: [PATCH 07/18] Cirrus: Use Python script to download & install wheels Co-authored-by: Nicolas Braud-Santoni --- .ci/install-wheels.py | 20 ++++++++++++++++++++ .cirrus.yml | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .ci/install-wheels.py diff --git a/.ci/install-wheels.py b/.ci/install-wheels.py new file mode 100644 index 00000000..71661eba --- /dev/null +++ b/.ci/install-wheels.py @@ -0,0 +1,20 @@ +import glob +import io +import os +import subprocess +from urllib.request import urlopen +import zipfile + +CIRRUS_BUILD_ID = os.environ['CIRRUS_BUILD_ID'] +ARTIFACTS_URL = f"https://api.cirrus-ci.com/v1/artifact/build/{CIRRUS_BUILD_ID}/build/dist.zip" + +with urlopen(ARTIFACTS_URL) as resp: + zipdata = resp.read() + +with zipfile.ZipFile(io.BytesIO(zipdata)) as zf: + zf.extractall() + +subprocess.run( + ['pip', 'install', *glob.glob('dist/*.whl')], + check=True +) diff --git a/.cirrus.yml b/.cirrus.yml index 425a881a..9d73cd06 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -32,7 +32,7 @@ docs_task: install_script: - apt update || true ; apt install -qq -y make - pip install --upgrade-strategy eager -U -r requirements-docs.txt - - pip install dist/ppb-*.whl + - python .ci/install-wheels.py script: - make -C docs/ linkcheck @@ -63,7 +63,7 @@ task: apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc fi - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - pip install $(find dist -name ppb-*.whl) + - python .ci/install-wheels.py script: - command -v pypy3 >/dev/null && export PY=pypy3 @@ -92,7 +92,7 @@ macOS_task: - pyenv global ${PYTHON} - pyenv rehash - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - pip install $(find dist -name ppb-*.whl) + - python .ci/install-wheels.py script: - python3 --version @@ -115,7 +115,7 @@ task: install_script: - C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements-tests.txt - - C:\Python\python.exe -m pip install dist/ppb-*.whl + - C:\Python\python.exe .ci/install-wheels.py script: - C:\Python\python.exe --version From 91ba8d8185f3a9286318373778b10bd1260856bc Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 16:38:42 -0500 Subject: [PATCH 08/18] .ci/install-wheels: No f-strings in pypy Co-authored-by: Nicolas Braud-Santoni --- .ci/install-wheels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/install-wheels.py b/.ci/install-wheels.py index 71661eba..9b3dbe73 100644 --- a/.ci/install-wheels.py +++ b/.ci/install-wheels.py @@ -6,7 +6,7 @@ import zipfile CIRRUS_BUILD_ID = os.environ['CIRRUS_BUILD_ID'] -ARTIFACTS_URL = f"https://api.cirrus-ci.com/v1/artifact/build/{CIRRUS_BUILD_ID}/build/dist.zip" +ARTIFACTS_URL = "https://api.cirrus-ci.com/v1/artifact/build/{}/build/dist.zip".format(CIRRUS_BUILD_ID) with urlopen(ARTIFACTS_URL) as resp: zipdata = resp.read() From 6ed8abe7ac53dd024eb8aa2d16292dcdd7652a00 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 16:42:15 -0500 Subject: [PATCH 09/18] .ci/install-wheels: No list-literall-stars, either Co-authored-by: Nicolas Braud-Santoni --- .ci/install-wheels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/install-wheels.py b/.ci/install-wheels.py index 9b3dbe73..e08b1519 100644 --- a/.ci/install-wheels.py +++ b/.ci/install-wheels.py @@ -15,6 +15,6 @@ zf.extractall() subprocess.run( - ['pip', 'install', *glob.glob('dist/*.whl')], + ['pip', 'install'] + glob.glob('dist/*.whl'), check=True ) From 8eb591c5feebf65726b6ba62ca4dfca7d419935a Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 16:56:03 -0500 Subject: [PATCH 10/18] cirrus: do the command juggling Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9d73cd06..ba1dcfe9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -48,7 +48,7 @@ task: - IMAGE: python:3.6-slim - IMAGE: python:3.7-slim # - IMAGE: python:3.8-slim - - IMAGE: pypy:3.6 + - IMAGE: pypy:3.6-slim container: image: $IMAGE @@ -63,7 +63,12 @@ task: apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc fi - pip install --upgrade-strategy eager -U -r requirements-tests.txt - - python .ci/install-wheels.py + - >- + if command -v pypy3 >/dev/null; then + pypy3 .ci/install-wheels.py + else + python .ci/install-wheels.py + fi script: - command -v pypy3 >/dev/null && export PY=pypy3 From 324de9e31e208534f3b3f2f6bbd3ae5f5b864f32 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 17:21:54 -0500 Subject: [PATCH 11/18] .ci/install-wheels: Disable SSL validation because windows Co-authored-by: Nicolas Braud-Santoni --- .ci/install-wheels.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/install-wheels.py b/.ci/install-wheels.py index e08b1519..dd92cb89 100644 --- a/.ci/install-wheels.py +++ b/.ci/install-wheels.py @@ -1,6 +1,7 @@ import glob import io import os +import ssl import subprocess from urllib.request import urlopen import zipfile @@ -8,7 +9,8 @@ CIRRUS_BUILD_ID = os.environ['CIRRUS_BUILD_ID'] ARTIFACTS_URL = "https://api.cirrus-ci.com/v1/artifact/build/{}/build/dist.zip".format(CIRRUS_BUILD_ID) -with urlopen(ARTIFACTS_URL) as resp: +# Windows certificate validation fails. This is per PEP476 +with urlopen(ARTIFACTS_URL, context=ssl._create_unverified_context()) as resp: zipdata = resp.read() with zipfile.ZipFile(io.BytesIO(zipdata)) as zf: From eb375157e7858b54351beb4dfaf080ec3fd98be5 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 19:23:19 -0500 Subject: [PATCH 12/18] cirrus: add deploy keys Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ba1dcfe9..c1a9519d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -137,9 +137,9 @@ upload_task: - pep517 - Tests env: - TWINE_TEST_TOKEN: "..." - TWINE_PROD_TOKEN: "..." - GITHUB_TOKEN: "..." + TWINE_TEST_TOKEN: "ENCRYPTED[4df6a9281bcbab67052d63d8ba4f5ee404d57fd95158e0e6e8693ac6b6ae0e2f2ec0ae8ac09a1fe9998b4675d6ccd7c2]" + TWINE_PROD_TOKEN: "ENCRYPTED[7ea667df4087e85f59575b59f07b2ef8da992831d45e0a0c60869aed64be252e4373b45b6a9f323a6a6365337bac0a7e]" + GITHUB_TOKEN: "ENCRYPTED[42fb2ca52f26c65b254620ce05eea27925844c034a0f73ca96f3fd4c80530a595e3c7dccda51df22b144a16673393704]" container: image: xonsh/xonsh:slim From 35569d4a8248b517bc087ca49073cc12907f5ec7 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 19:27:25 -0500 Subject: [PATCH 13/18] Cirrus: Test upload --- .ci/upload.xsh | 50 +++++++++++++++++++++++++------------------------- .cirrus.yml | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.ci/upload.xsh b/.ci/upload.xsh index 6cddf7c7..e956f908 100644 --- a/.ci/upload.xsh +++ b/.ci/upload.xsh @@ -35,31 +35,31 @@ with tempfile.TemporaryDirectory() as td: twine upload --repository-url @(PYPI_TEST_REPO) --username __token__ --password $TWINE_TEST_TOKEN @(dists) - print("") + # print("") - if 'CIRRUS_RELEASE' in ${...}: - print("Uploading to GitHub...") - for dist in dists: - print(f"\t{dist.name}...") - dest_url = f"https://uploads.github.com/repos/{$CIRRUS_REPO_FULL_NAME}/releases/{$CIRRUS_RELEASE}/assets?name={dist.name}" - with dist.open('rb') as fobj: - buff = fobj.read() - try: - resp = urlopen(Request( - url=dest_url, - method='POST', - data=buff, - headers={ - "Authorization": f"token {$GITHUB_TOKEN}", - "Content-Type": "application/octet-stream", - }, - )) - except HTTPError as exc: - print(exc.headers) - print(exc.read()) - raise + # if 'CIRRUS_RELEASE' in ${...}: + # print("Uploading to GitHub...") + # for dist in dists: + # print(f"\t{dist.name}...") + # dest_url = f"https://uploads.github.com/repos/{$CIRRUS_REPO_FULL_NAME}/releases/{$CIRRUS_RELEASE}/assets?name={dist.name}" + # with dist.open('rb') as fobj: + # buff = fobj.read() + # try: + # resp = urlopen(Request( + # url=dest_url, + # method='POST', + # data=buff, + # headers={ + # "Authorization": f"token {$GITHUB_TOKEN}", + # "Content-Type": "application/octet-stream", + # }, + # )) + # except HTTPError as exc: + # print(exc.headers) + # print(exc.read()) + # raise - print("") + # print("") - print("Uploading to PyPI...") - twine upload --username __token__ --password $TWINE_PROD_TOKEN @(dists) + # print("Uploading to PyPI...") + # twine upload --username __token__ --password $TWINE_PROD_TOKEN @(dists) diff --git a/.cirrus.yml b/.cirrus.yml index c1a9519d..c09af324 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -130,7 +130,7 @@ task: upload_task: - only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_RELEASE != '' + # only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_RELEASE != '' depends_on: - build - docs From 405d38b8388d9ffc348ad38ef5bf5cee8f2047bf Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 19:41:04 -0500 Subject: [PATCH 14/18] Revert "Cirrus: Test upload" This reverts commit 35569d4a8248b517bc087ca49073cc12907f5ec7. --- .ci/upload.xsh | 50 +++++++++++++++++++++++++------------------------- .cirrus.yml | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.ci/upload.xsh b/.ci/upload.xsh index e956f908..6cddf7c7 100644 --- a/.ci/upload.xsh +++ b/.ci/upload.xsh @@ -35,31 +35,31 @@ with tempfile.TemporaryDirectory() as td: twine upload --repository-url @(PYPI_TEST_REPO) --username __token__ --password $TWINE_TEST_TOKEN @(dists) - # print("") + print("") - # if 'CIRRUS_RELEASE' in ${...}: - # print("Uploading to GitHub...") - # for dist in dists: - # print(f"\t{dist.name}...") - # dest_url = f"https://uploads.github.com/repos/{$CIRRUS_REPO_FULL_NAME}/releases/{$CIRRUS_RELEASE}/assets?name={dist.name}" - # with dist.open('rb') as fobj: - # buff = fobj.read() - # try: - # resp = urlopen(Request( - # url=dest_url, - # method='POST', - # data=buff, - # headers={ - # "Authorization": f"token {$GITHUB_TOKEN}", - # "Content-Type": "application/octet-stream", - # }, - # )) - # except HTTPError as exc: - # print(exc.headers) - # print(exc.read()) - # raise + if 'CIRRUS_RELEASE' in ${...}: + print("Uploading to GitHub...") + for dist in dists: + print(f"\t{dist.name}...") + dest_url = f"https://uploads.github.com/repos/{$CIRRUS_REPO_FULL_NAME}/releases/{$CIRRUS_RELEASE}/assets?name={dist.name}" + with dist.open('rb') as fobj: + buff = fobj.read() + try: + resp = urlopen(Request( + url=dest_url, + method='POST', + data=buff, + headers={ + "Authorization": f"token {$GITHUB_TOKEN}", + "Content-Type": "application/octet-stream", + }, + )) + except HTTPError as exc: + print(exc.headers) + print(exc.read()) + raise - # print("") + print("") - # print("Uploading to PyPI...") - # twine upload --username __token__ --password $TWINE_PROD_TOKEN @(dists) + print("Uploading to PyPI...") + twine upload --username __token__ --password $TWINE_PROD_TOKEN @(dists) diff --git a/.cirrus.yml b/.cirrus.yml index c09af324..c1a9519d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -130,7 +130,7 @@ task: upload_task: - # only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_RELEASE != '' + only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH || $CIRRUS_RELEASE != '' depends_on: - build - docs From 90c30a12124a2ee0b01d9c23d04ef564482d0088 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 19:42:26 -0500 Subject: [PATCH 15/18] debug: list tags --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index c1a9519d..451b1a57 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,6 +13,8 @@ pep517_task: build_task: container: image: python:3 + debug_script: + - git tag setup_script: - pip install bork script: From a68bf80c1a643eb96e8bc6cb7ae87286c31e3d74 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 19:43:54 -0500 Subject: [PATCH 16/18] debug: try that --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 451b1a57..e5e3f39b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,7 @@ build_task: container: image: python:3 debug_script: - - git tag + - git tag --list setup_script: - pip install bork script: From 42606b95904ef58eefc22f4ca31114509a9ea393 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 19:45:12 -0500 Subject: [PATCH 17/18] Cirrus: Fetch tags before build Co-authored-by: Nicolas Braud-Santoni --- .cirrus.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e5e3f39b..2f07fa6c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,9 +13,8 @@ pep517_task: build_task: container: image: python:3 - debug_script: - - git tag --list setup_script: + - git fetch --tags - pip install bork script: - bork build From a6fcef4d0b0e83d9f38d4b37b8757e25468b7e4a Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Wed, 19 Feb 2020 23:05:40 -0500 Subject: [PATCH 18/18] bors.toml: Update for changed images --- bors.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bors.toml b/bors.toml index 08953c27..17937420 100644 --- a/bors.toml +++ b/bors.toml @@ -2,8 +2,8 @@ status = [ "docs", "Linux python:3.6-slim", "Linux python:3.7-slim", - "Windows python:3.6-windowsservercore-1809", - "Windows python:3.7-windowsservercore-1809", + "Windows python:3.6-windowsservercore", + "Windows python:3.7-windowsservercore", "macOS PYTHON:3.6.8", "macOS PYTHON:3.7.2", "pep517",