Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dspitzer authored Jun 6, 2024
0 parents commit bf61d50
Show file tree
Hide file tree
Showing 18 changed files with 2,053 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# default reviewers
* @greenbone/<team>
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "04:00"
allow:
- dependency-type: direct
- dependency-type: indirect
groups:
python-packages:
patterns:
- "*"
commit-message:
prefix: "Deps"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
time: "04:00"
groups:
github-actions:
patterns:
- "*"
commit-message:
prefix: "Deps"
12 changes: 12 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto-merge rebase

on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
uses: greenbone/workflows/.github/workflows/auto-merge.yml@main
secrets: inherit
86 changes: 86 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and test Python package

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
linting:
name: Linting
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Install and check with black, pylint and pontos.version
uses: greenbone/actions/lint-python@v3
with:
packages: <FIXME>
linter: ruff
python-version: ${{ matrix.python-version }}

test:
name: Run all tests
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Install python, poetry and dependencies
uses: greenbone/actions/poetry@v3
with:
python-version: ${{ matrix.python-version }}
- name: Run unit tests
run: poetry run python -m unittest

mypy:
name: Check type hints
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Run mypy
uses: greenbone/actions/mypy-python@v3
with:
python-version: ${{ matrix.python-version }}

codecov:
name: Upload coverage to codecov.io
needs: test
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install and calculate and upload coverage to codecov.io
uses: greenbone/actions/coverage-python@v3
with:
python-version: "3.10"

build-docs:
name: Build the documentation
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install python, poetry and dependencies
uses: greenbone/actions/poetry@v3
with:
python-version: "3.10"
- name: Build docs
run: cd docs && poetry run make html
38 changes: 38 additions & 0 deletions .github/workflows/codeql-analysis-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "CodeQL"

on:
push:
branches: [main]
pull_request:
branches: [main]
paths-ignore:
- "**/*.md"
- "**/*.txt"
schedule:
- cron: "30 5 * * 0" # 5:30h on Sundays

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["python"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
12 changes: 12 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Conventional Commits

on:
pull_request:

jobs:
conventional-commits:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- name: Report Conventional Commits
uses: greenbone/actions/conventional-commits@v3
12 changes: 12 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Dependency Review'
uses: greenbone/actions/dependency-review@v3
20 changes: 20 additions & 0 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy on PyPI

# uploads the Python package via trusted publisher (OIDC) https://docs.pypi.org/trusted-publishers/

on:
release:
types: [created]

jobs:
deploy:
permissions:
id-token: write
runs-on: ubuntu-latest
environment:
# requires to create a GitHub environment named pypi
name: pypi
url: https://pypi.org/project/example/ # FIXME
steps:
- name: Build and publish to PyPI
uses: greenbone/actions/pypi-upload@v3
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release Python package

on:
pull_request:
types: [closed]
workflow_dispatch:
inputs:
release-type:
type: choice
description: What kind of release do you want to do?
options:
- calendar
- patch
- minor
- major
release-version:
type: string
description: Set an explicit version, that will overwrite release-type. Fails if version is not compliant.

# don't run two release processes at the same time
# but also don't cancel already running workflow because it might already be to late
concurrency:
group: ${{ github.workflow }}

jobs:
build-and-release:
name: Create a new release
uses: greenbone/workflows/.github/workflows/release-python.yml@main
secrets: inherit
with:
release-version: ${{ inputs.release-version }}
release-type: ${{ inputs.release-type }}
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# 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/

# vscode settings
.vscode

# IntelliJ settings
.idea
Loading

0 comments on commit bf61d50

Please sign in to comment.