Initial commit

This commit is contained in:
2022-07-10 18:57:28 +01:00
commit dc7bc829b9
11 changed files with 262 additions and 0 deletions

34
.github/workflows/merge-to-main.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Merge to main
on:
push:
branches:
- main
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r requirements.txt && pip install -r requirements-dev.txt
- name: Lint
run: pylint --recursive=yes --output-format=parseable --output=lintreport.txt .
- name: Unit Test
run: |
coverage run -m py.test -v
coverage xml
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

39
.github/workflows/pull-request.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: CI
on:
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE.md'
- '.gitignore'
- 'CODEOWNERS'
- 'renovate.json'
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r requirements.txt && pip install -r requirements-dev.txt
- name: Lint
run: pylint --recursive=yes --output-format=parseable --output=lintreport.txt .
- name: Unit Test
run: |
coverage run -m py.test -v --junitxml=testresults.xml
coverage xml
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

135
.gitignore vendored Normal file
View File

@ -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
lintreport.txt
testresults.xml
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/
# IDE
.vscode
.idea

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
* @luketainton

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# template
## Description
## How to install
## How to use

8
app/main.py Normal file
View File

@ -0,0 +1,8 @@
#!/usr/local/bin/python3
def main():
# Commands here
if __name__ == "__main__":
main()

26
renovate.json Normal file
View File

@ -0,0 +1,26 @@
{
"extends": ["config:base"],
"platformCommit": true,
"dependencyDashboardAutoclose": true,
"assignAutomerge": true,
"assigneesFromCodeOwners": true,
"rebaseWhen": "behind-base-branch",
"rollbackPrs": true,
"labels": ["dependencies"],
"packageRules": [
{
"matchPackagePatterns": ["black", "pylint"],
"labels": ["linting"]
},
{
"matchPackagePatterns": ["coverage", "pytest"],
"labels": ["unit-tests"]
}
],
"vulnerabilityAlerts": {
"enabled": true,
"labels": ["security"],
"commitMessagePrefix": "[SECURITY] ",
"prCreation": "immediate"
}
}

4
requirements-dev.txt Normal file
View File

@ -0,0 +1,4 @@
black
coverage
pylint
pytest

0
requirements.txt Normal file
View File

8
sonar-project.properties Normal file
View File

@ -0,0 +1,8 @@
sonar.projectKey=luketainton_
sonar.python.version=3.10
sonar.python.coverage.reportPaths=coverage.xml
sonar.python.pylint.reportPaths=lintreport.txt
sonar.python.xunit.reportPath=testresults.xml
sonar.sources=app
sonar.tests=tests
sonar.exclusions=,.github/**,.gitignore,CODEOWNERS,CHANGELOG.md,LICENSE.md,README.md,renovate.json,requirements-dev.txt,requirements.txt

0
tests/test_main.py Normal file
View File