generated from jacobtomlinson/python-container-action
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: initial commit of move to poetry * fix: fix all ruff issues Also splits the INPUTS dict into its own file that has line length ignored * docs: automated doc update * fix: fix pre-commit and ci * fix: update action.yml and remove old integration * ci: move codeql to run on main only * ci: update noxfile * docs: doc cleanup * docs: automated doc update
- Loading branch information
1 parent
82d2207
commit 2f41b7b
Showing
39 changed files
with
2,444 additions
and
280 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 |
---|---|---|
@@ -1,17 +1,114 @@ | ||
.mypy_cache/ | ||
/.coverage | ||
/.coverage.* | ||
|
||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
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 | ||
/.nox/ | ||
/.python-version | ||
/.pytype/ | ||
/dist/ | ||
/docs/_build/ | ||
/src/*.egg-info/ | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
.ruff_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Sphinx documentation | ||
docs/ | ||
# 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__/ | ||
|
||
# Pycache | ||
__pycache__/ | ||
.idea | ||
requirements-dev.txt | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
Docker/Dockerfile | ||
Docker/ActionDockerfile.j2 | ||
noxfile.py | ||
action.yml | ||
.prettierignore | ||
.pre-commit-config.yaml | ||
.git | ||
.github | ||
.gitignore | ||
tests/ | ||
|
||
Makefile | ||
DEVELOPER.md | ||
LICENSE | ||
README.md | ||
.pre-commit-config.yaml |
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
16 changes: 9 additions & 7 deletions
16
.github/workflows/integration.yml → .github/workflows/action-integration.yml
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: "CodeQL" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * 1" | ||
workflow_dispatch: | ||
|
This file was deleted.
Oops, something went wrong.
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,110 @@ | ||
name: Python CI | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
python-ci: | ||
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" } | ||
- { python: "3.11", os: "ubuntu-latest", session: "safety" } | ||
# - { python: "3.11", os: "ubuntu-latest", session: "mypy" } | ||
- { python: "3.11", os: "ubuntu-latest", session: "tests" } | ||
|
||
env: | ||
NOXSESSION: ${{ matrix.session }} | ||
FORCE_COLOR: "1" | ||
PRE_COMMIT_COLOR: "always" | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --constraint=package-requirements.txt pip | ||
pip --version | ||
- name: Upgrade pip in virtual environments | ||
shell: python | ||
run: | | ||
import os | ||
import pip | ||
with open(os.environ["GITHUB_ENV"], mode="a") as io: | ||
print(f"VIRTUALENV_PIP={pip.__version__}", file=io) | ||
- name: Install package-requirements | ||
run: | | ||
pip install --upgrade -r package-requirements.txt | ||
poetry --version | ||
nox --version | ||
- name: Compute pre-commit cache key | ||
if: matrix.session == 'pre-commit' | ||
id: pre-commit-cache | ||
shell: python | ||
run: | | ||
import hashlib | ||
import sys | ||
import os | ||
python = "py{}.{}".format(*sys.version_info[:2]) | ||
payload = sys.version.encode() + sys.executable.encode() | ||
digest = hashlib.sha256(payload).hexdigest() | ||
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) | ||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | ||
fh.write(f"result={result}\n") | ||
- name: Restore pre-commit cache | ||
uses: actions/[email protected] | ||
if: matrix.session == 'pre-commit' | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }} | ||
restore-keys: | | ||
${{ steps.pre-commit-cache.outputs.result }}- | ||
- name: Run Nox | ||
run: | | ||
nox --force-color --python=${{ matrix.python }} | ||
- name: Upload coverage data | ||
if: always() && matrix.session == 'tests' | ||
uses: "actions/[email protected]" | ||
with: | ||
name: coverage-data | ||
path: ".coverage.*" | ||
|
||
- name: Upload documentation | ||
if: matrix.session == 'docs-build' | ||
uses: actions/[email protected] | ||
with: | ||
name: docs | ||
path: docs/_build | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
needs: python-ci | ||
steps: | ||
- name: Download coverage data | ||
uses: actions/[email protected] | ||
with: | ||
name: coverage-data | ||
|
||
- name: Upload coverage report | ||
uses: codecov/[email protected] | ||
with: | ||
files: .coverage.xml | ||
verbose: true |
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,54 @@ | ||
# Runs after release-please creates a new release | ||
# Builds and pushes the docker images for the release | ||
name: Release Docker Images | ||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
build-and-push-dockerimage: | ||
name: Buld and push dockerimage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.THIS_PAT }} | ||
- name: Docker metadata | ||
uses: docker/metadata-action@v4 | ||
id: meta | ||
with: | ||
images: | | ||
${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=raw,value=${{ github.ref_name }} | ||
# minimal (short sha) | ||
type=sha,prefix= | ||
# full length sha | ||
type=sha,format=long,prefix= | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#registry-cache | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,14 @@ | ||
# Updates major version tag for GHA ease of use | ||
name: Update Major Version Tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
update-majorver: | ||
name: Update Major Version Tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: nowactions/update-majorver@v1 |
Oops, something went wrong.