Skip to content
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

build: scaffold development environment using tox #1

Merged
merged 3 commits into from
Dec 2, 2024
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
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "build(deps): "
reviewers:
- "OLILHR"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "build(deps): "
reviewers:
- "OLILHR"
15 changes: 15 additions & 0 deletions .github/workflows/byte_order_marks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Prevent byte order marks."

on:
push:
branches:
- main
pull_request: {}

jobs:
bom-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arma-actions/bom-check@v1
name: Check for BOM
27 changes: 27 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Coverage."

on:
push:
branches:
- main
pull_request: {}
jobs:
coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tests and determine coverage
run: |
tox -e coverage
19 changes: 19 additions & 0 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Dependabot auto-approve/-merge."

on: pull_request

jobs:
dependabot:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Approve pull request
run: gh pr review --approve "$PR_URL"
- name: Enable auto-merge
run: gh pr merge --auto --squash "$PR_URL"
27 changes: 27 additions & 0 deletions .github/workflows/dev_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Test dev environment."

on:
push:
branches:
- main
pull_request: {}
jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Create dev environment
run: |
tox -e dev
28 changes: 28 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Formatting."

on:
push:
branches:
- main
pull_request: {}
jobs:
black:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
tool: ["black", "isort"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[formatting]
- name: ${{ matrix.tool }} Code Formatter
run: |
${{ matrix.tool }} . --check
29 changes: 29 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Linting."

on:
push:
branches:
- main
pull_request: {}
jobs:
pylint:
name: Maintain code quality
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
linter-env: ["linting", "typechecking", "spellchecking"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run ${{ matrix.linter-env }} via tox
run: |
tox -e ${{ matrix.linter-env }}
38 changes: 38 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Packaging."

on: [pull_request]

jobs:
packaging:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox

- name: Create temporary version tag
run: |
if [ -z "$(git tag)" ]; then
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git tag -a v0.0.0 -m "temporary tag"
fi

- name: Run packaging test
run: |
tox -e packaging
57 changes: 57 additions & 0 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Publishing to PyPI."

on:
release:
types: [created, edited]

jobs:
testing:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tests
run: |
tox

deploying:
name: Build and deploy package to PyPI
runs-on: ubuntu-latest
# GitHub repository settings/environments/create "release" environment
# set up trusted publishing on https://pypi.org/ @ settings/manage/publishing
environment: release
permissions:
id-token: write
needs: testing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[packaging]
- name: Build wheel and source distributions
run: |
pdm build
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
27 changes: 27 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Unittests."

on:
push:
branches:
- main
pull_request: {}
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run unittests via tox
run: |
tox -e testing
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.env*
!*.example

.coverage
.idea/
.pdm-build/
.pytest_cache/
.tox/
.venv

__pycache__/
dist/
htmlcov/

# OS
.DS_Store
Thumbs.db
11 changes: 11 additions & 0 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading