Skip to content

Stubs upload actions #4861

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

Merged
merged 4 commits into from
Jun 21, 2021
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
30 changes: 24 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
run: |
gcc --version
python3 --version
- name: Check For setup.py
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
- name: New boards check
run: python3 -u ci_new_boards_check.py
working-directory: tools
Expand All @@ -54,6 +58,11 @@ jobs:
with:
name: stubs
path: circuitpython-stubs*
- name: Install pypi dependencies
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Test Documentation Build (HTML)
run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -108,20 +117,29 @@ jobs:
with:
name: mpy-cross.static-x64-windows
path: mpy-cross/mpy-cross.static.exe
- name: Upload stubs and mpy-cross builds to S3
- name: Upload mpy-cross builds to S3
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
env:
AWS_PAGER: ''
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-aarch64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-aarch64-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
zip -9r circuitpython-stubs.zip circuitpython-stubs
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1
env:
AWS_PAGER: ''
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))

- name: Upload stubs to PyPi
if: github.event_name == 'push'
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
echo "Uploading dev release to PyPi"
python setup.py sdist
twine upload dist/*

mpy-cross-mac:
runs-on: macos-10.15
Expand Down
23 changes: 6 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,16 @@

from setuptools import setup
from pathlib import Path
import subprocess
import re

STD_PACKAGES = set(('array', 'math', 'os', 'random', 'struct', 'sys', 'ssl', 'time'))

STD_PACKAGES = set(('array', 'math', 'os', 'random', 'struct', 'sys', 'ssl', 'time'))
Comment on lines +12 to 14
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks funky

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yep I think this got doubled up, it's likely I misclicked it while working through changes to merge from main. I'll make a new PR to remove the dupe


stub_root = Path("circuitpython-stubs")
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]

git_out = subprocess.check_output(["git", "describe", "--tags"])
version = git_out.strip().decode("utf-8")

# Detect a development build and mutate it to be valid semver and valid python version.
pieces = version.split("-")
if len(pieces) > 2:
# Merge the commit portion onto the commit count since the tag.
pieces[-2] += "+" + pieces[-1]
pieces.pop()
# Merge the commit count and build to the pre-release identifier.
pieces[-2] += ".dev." + pieces[-1]
pieces.pop()
version = "-".join(pieces)
def local_scheme(version):
return ""

packages = set(os.listdir("circuitpython-stubs")) - STD_PACKAGES
package_dir = dict((f"{package}-stubs", f"circuitpython-stubs/{package}")
Expand All @@ -49,11 +38,11 @@ def build_package_data() -> Dict[str, List[str]]:
maintainer="CircuitPythonistas",
maintainer_email="[email protected]",
author_email="[email protected]",
version=version,
license="MIT",
packages=list(package_data.keys()),
package_data=package_data,
package_dir = package_dir,
setup_requires=["setuptools>=38.6.0"],
setup_requires=["setuptools_scm", "setuptools>=38.6.0"],
use_scm_version={"local_scheme": local_scheme},
zip_safe=False,
)