Skip to content

Commit

Permalink
tweaks (#2)
Browse files Browse the repository at this point in the history
- add type hinting
- ran black
- adjust CI
- upgrade docs theme and move all docstrings into glidepoint.py src
- ran spell check
- update docs' ToC for API reference and landing page
- `report()` converted to `read()` in favor of using the new `available()` - all of which only relate to Relative or Absolute modes (not AnyMeas mode)
- `clear_flags()` renamed to `clear_status_flags()`
- switch to `pre-commit` for linting tools (mypy pylint, black)
- switch to pyproject.toml instead of setup.py; the setup.py module still exists (as a proxy to pyproject.toml) until it is no longer needed.
  • Loading branch information
2bndy5 committed Feb 3, 2023
1 parent db0e24d commit a5c8c9f
Show file tree
Hide file tree
Showing 26 changed files with 2,326 additions and 2,186 deletions.
187 changes: 135 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,141 @@
name: Build CI

on: [pull_request, push]
on:
pull_request:
types: [opened, reopened]
push:

jobs:
test:
build-wheel:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Pip install pylint & Sphinx
run: |
pip install --force-reinstall pylint==2.4.1 Sphinx sphinx-rtd-theme
- name: Library version
run: git describe --dirty --always --tags
- name: PyLint
run: |
pylint --disable=too-many-arguments circuitpython_cirque_pinnacle/*.py
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace,too-few-public-methods $( find . -path "./examples/*.py" ))
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . --package_folder_prefix circuitpython_cirque_pinnacle
- name: Archive bundles
uses: actions/upload-artifact@v2
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: actions/checkout@v3

- name: Build wheel
run: pip wheel -w dist --no-deps .

- name: check dist
run: pipx run twine check dist/*

- name: Archive wheel
uses: actions/upload-artifact@v3
with:
name: wheel
path: ${{ github.workspace }}/dist/

linters:
runs-on: ubuntu-latest
steps:

- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: actions/checkout@v3

- name: Install pre-commit and deps
run: pip install pre-commit -r requirements.txt

- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1

- name: Pre-commit hooks
run: pre-commit run --all-files

# test-coverage:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3

# - uses: actions/setup-python@v4
# with:
# python-version: "3.x"

# - name: Install testing tools
# run: pip install -r requirements.txt -r tests/requirements.txt

# - name: Collect coverage
# run: |
# coverage run -m pytest
# coverage report
# coverage xml

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: ./coverage.xml
# verbose: true # optional (default = false)

build-bundles:
runs-on: ubuntu-latest
steps:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
) >> $GITHUB_OUTPUT
- name: Translate Repo Name For Build Tools package_prefix
id: pkg-name
run: |
echo pkg-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }'
) >> $GITHUB_OUTPUT
- uses: actions/checkout@v3

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci

- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix ${{ steps.pkg-name.outputs.pkg-name }} --library_location .

- name: Archive bundles
uses: actions/upload-artifact@v3
with:
name: bundles
path: ${{ github.workspace }}/bundles/

build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install deps
run: |
pip install -r docs/requirements.txt -r requirements.txt
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html

- name: Archive docs
uses: actions/upload-artifact@v3
with:
name: docs
path: ${{ github.workspace }}/docs/_build/html
153 changes: 86 additions & 67 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,98 @@ name: Release Actions
on:
release:
types: [published]
workflow_dispatch:

jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . --package_folder_prefix circuitpython_cirque_pinnacle
- name: Upload Release Assets
# the 'official' actions version does not yet support dynamically
# supplying asset names to upload. @csexton's version chosen based on
# discussion in the issue below, as its the simplest to implement and
# allows for selecting files with a pattern.
# https://github.com/actions/upload-release-asset/issues/4
#uses: actions/upload-release-asset@v1.0.1
uses: csexton/release-asset-action@master
with:
pattern: "bundles/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
) >> $GITHUB_OUTPUT
- name: Translate Repo Name For Build Tools package_prefix
id: pkg-name
run: |
echo pkg-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }'
) >> $GITHUB_OUTPUT
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Checkout Current Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Checkout tools repo
uses: actions/checkout@v3
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci

- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --package_folder_prefix ${{ steps.pkg-name.outputs.pkg-name }} --library_location .

- name: Archive bundles
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v3
with:
name: bundles
path: ${{ github.workspace }}/bundles/

- name: Upload Release Assets
if: github.event_name == 'release'
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "bundles/*"

upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check For setup.py
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
- name: Set up Python
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python setup.py sdist
twine upload dist/*
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build distributions
run: python -m build

- name: Check distributions
run: twine check dist/*

- name: Publish package (to TestPyPI)
if: github.event_name == 'workflow_dispatch' && github.repository == '2bndy5/CircuitPython_Cirque_Pinnacle'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: twine upload --repository testpypi dist/*

- name: Publish package (to PyPI)
if: github.event_name != 'workflow_dispatch' && github.repository == '2bndy5/CircuitPython_Cirque_Pinnacle'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*

0 comments on commit a5c8c9f

Please sign in to comment.