Skip to content

Commit

Permalink
*: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
phibos committed Sep 16, 2024
0 parents commit ed0c582
Show file tree
Hide file tree
Showing 40 changed files with 2,430 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#.git/
.github/
.venv/
build/
dist/
docs/
LICENSES/
tests/
venv/

.dockerignore
.flake8
.gitignore
.pre-commit-config.yaml

*.license
config.yaml
Dockerfile
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

[flake8]
max-line-length = 120
extend-exclude =
.venv/
venv/
70 changes: 70 additions & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Docker Build

on:
push:
branches: ['**']
tags: ['**']
paths-ignore:
- 'README.md'
- 'LICENSE'
pull_request:
types: [opened, reopened]
branches: [main]
paths-ignore:
- 'README.md'
- 'LICENSE'
release:
types: [published]

jobs:
call-docker-build:
name: Call Docker Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Collect Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=false
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and publish Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: |
linux/amd64
linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha,mode=min
cache-from: type=gha
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

name: Python CI Tests

on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'

jobs:
tests:
name: "Python ${{ matrix.name }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"

strategy:
fail-fast: false
matrix:
include:
- {name: '3.12', python: '3.12', os: ubuntu-latest, tox: py312}
- {name: '3.11', python: '3.11', os: ubuntu-latest, tox: py311}
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
- {name: 'PyPy 3.9', python: pypy3.9, os: ubuntu-latest, tox: pypy39}

steps:
- uses: "actions/checkout@v3"

- uses: "actions/setup-python@v4"
with:
python-version: ${{ matrix.python }}
cache: 'pip' # caching pip dependencies

- name: Install tox and any other packages
run: pip install tox

- name: "Run tox targets for ${{ matrix.python }}"
run: tox -e ${{ matrix.tox }}
27 changes: 27 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

name: docs

on:
push:
branches: [main]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install Python packages
run: pip install -r requirements.txt -r docs/requirements.txt

- name: Build documentation
run: bash -c "PYTHONPATH=$PWD mkdocs build"
50 changes: 50 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

name: pages

on:
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Python packages
run: pip install -r requirements.txt -r docs/requirements.txt
- name: Build documentation
run: bash -c "PYTHONPATH=$PWD mkdocs build"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: './site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
57 changes: 57 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

name: Publish Python distributions to PyPI and TestPyPI

on:
pull_request:
push:
branches:
- main
tags:
- 0.*
- 1.*

jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Install pypa/build
run: python -m pip install build twine --user

- name: Build binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .

- name: Check wheels and source tarballs
run: python -m twine check dist/*

- name: Publish distribution to Test PyPI
if: >-
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip-existing: true

- name: Publish distribution to PyPI
if: >-
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
Loading

0 comments on commit ed0c582

Please sign in to comment.