-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a template repository for python manager plugins. This should drastically cut down the work required to startup a new python manager, and avoid re-arbitrating lint/CI/deployment paradigms. Signed-off-by: Elliot Morris <[email protected]>
- Loading branch information
0 parents
commit 274c194
Showing
16 changed files
with
1,157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" # See docs, they say not to use '.github' | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: "[CI]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build Wheels | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
concurrency: | ||
# Shared with `deploy-pypi`. | ||
group: wheel-${{ github.ref }} | ||
# Cancel any in-progress build or publish. | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheel | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel | ||
- name: Build wheels | ||
run: pip wheel --no-deps --wheel-dir wheelhouse . | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: my_asset_manager_wheels | ||
path: ./wheelhouse/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Code quality | ||
on: pull_request | ||
|
||
jobs: | ||
pylint: | ||
runs-on: ubuntu-latest | ||
name: Pylint | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install . | ||
python -m pip install -r tests/requirements.txt | ||
- name: Lint | ||
uses: TheFoundryVisionmongers/[email protected] | ||
with: | ||
pylint-rcfile: "./pyproject.toml" | ||
pylint-paths: > | ||
plugin | ||
tests | ||
black: | ||
runs-on: ubuntu-latest | ||
name: Python formatting | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install black | ||
- name: Check Python formatting | ||
run: black --check . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy PyPI | ||
|
||
concurrency: | ||
# Shared with `build-wheels`. | ||
group: wheel-${{ github.ref }} | ||
# Allow `build-wheels` to finish. | ||
cancel-in-progress: false | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish_testpypi: | ||
name: Publish distribution 📦 to TestPyPI | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Download wheels from commit ${{ github.sha }} | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: build-wheels.yml | ||
workflow_conclusion: success | ||
commit: ${{ github.sha }} | ||
name: my_asset_manager_wheels | ||
path: dist | ||
|
||
- name: Upload to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_ACCESS_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
publish_pypi: | ||
name: Publish distribution 📦 to PyPI | ||
needs: publish_testpypi | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Download wheels from commit ${{ github.sha }} | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: build-wheels.yml | ||
workflow_conclusion: success | ||
commit: ${{ github.sha }} | ||
name: my_asset_manager_wheels | ||
path: dist | ||
|
||
- name: Upload to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Runs pytest on the matrix of supported platforms any Python versions. | ||
name: Test | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
# You may remove this test, this merely assures that the template | ||
# works when you find-and-replace the MyAssetManager strings. | ||
test_project_rename: | ||
name: Project Rename | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- run: | | ||
grep -RIl 'MyAssetManager' | xargs sed -i 's/MyAssetManager/RenamedAssetManager/g' | ||
grep -RIl 'my_asset_manager' | xargs sed -i 's/my_asset_manager/renamed_asset_manager/g' | ||
grep -RIl 'My Asset Manager' | xargs sed -i 's/My Asset Manager/Renamed Asset Manager/g' | ||
grep -RIl 'myorg' | xargs sed -i 's/myorg/renamedorg/g' | ||
mv plugin/my_asset_manager/MyAssetManagerInterface.py \ | ||
plugin/my_asset_manager/RenamedAssetManagerInterface.py | ||
mv plugin/my_asset_manager plugin/renamed_asset_manager | ||
python -m pip install . | ||
python -m pip install -r tests/requirements.txt | ||
python -m pytest -v ./tests | ||
test: | ||
name: ${{ matrix.os }} ${{ matrix.python }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["windows-latest", "ubuntu-latest", "macos-latest"] | ||
python: ["3.7", "3.9", "3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- run: | | ||
python -m pip install . | ||
python -m pip install -r tests/requirements.txt | ||
python -m pytest -v ./tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
Oops, something went wrong.