Skip to content

Commit

Permalink
Merge pull request #1 from eccenca/feature/properPoetryProject
Browse files Browse the repository at this point in the history
add template + cli
  • Loading branch information
seebi authored Dec 16, 2024
2 parents 8e21a0c + f36cec9 commit b945b96
Show file tree
Hide file tree
Showing 24 changed files with 2,195 additions and 77 deletions.
3 changes: 3 additions & 0 deletions .copier-answers.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changes here will be overwritten by Copier
package_dir=cmem_plugin_index

11 changes: 11 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changes here will be overwritten by Copier
_commit: v7.0.0
_src_path: gh:eccenca/cmem-plugin-template
author_mail: [email protected]
author_name: eccenca GmbH
github_page: https://github.com/eccenca/cmem-plugin-index
project_description: Create an up-to-date list of Corporate Memory plugin packages.
project_slug: cmem-plugin-index
project_type: generic
pypi: false

76 changes: 76 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: check

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" and "develop" branch
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
check:

runs-on: ubuntu-latest
concurrency: testing_environment

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install and configure poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dynamic versioning plugin
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
- name: mypy
run: |
task check:mypy
- name: ruff
run: |
task check:ruff
- name: pytest
env:
CMEM_BASE_URI: ${{ secrets.CMEM_BASE_URI }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
run: |
task check:pytest
- name: safety
run: |
task check:safety
- name: Publish Test Report in Action
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
with:
report_paths: dist/junit-*.xml

- name: Publish Test and Coverage Report as PR comment
uses: xportation/junit-coverage-report@main
if: github.event_name == 'pull_request'
with:
junit-path: dist/junit-pytest.xml
coverage-path: dist/coverage.xml

28 changes: 20 additions & 8 deletions .github/workflows/update-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,32 @@ jobs:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
- name: Install Task
uses: arduino/setup-task@v1

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install and configure poetry
uses: snok/install-poetry@v1
with:
python-version: 3.11
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dependencies
run: pip install requests beautifulsoup4
- name: Install dynamic versioning plugin
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Run Python script to query PyPI and update package list
run: |
python src/plugin_info.py # Run the Python script located in 'src/'
poetry run cmem-plugin-index data/plugins_info.json
- name: Commit and push changes
run: |
Expand Down
149 changes: 149 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
# 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/
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/
cover/

# 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
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# project build plan specific ignores
version.py
co
*.xml
*.html
*.bak
artifacts
.DS_Store
.task
91 changes: 91 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
default:
image: docker-registry.eccenca.com/eccenca-python:v3.11.4
# all jobs can be interrupted in case a new commit is pushed
interruptible: true
before_script:
# make sure poetry creates virtual environment as .venv
- poetry config virtualenvs.in-project true
cache:
# cache the virtual environment based on the poetry lock file
key:
files:
- poetry.lock
paths:
- .venv

stages:
- test
- build
- publish

ruff:
stage: test
script:
- task check:ruff
artifacts:
when: always
reports:
junit:
- dist/junit-ruff.xml

mypy:
stage: test
script:
- task check:mypy
artifacts:
when: always
reports:
junit:
- dist/junit-mypy.xml

pytest:
stage: test
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
script:
- task check:pytest
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: dist/coverage.xml
junit:
- dist/junit-pytest.xml
paths:
- dist/badge-coverage.svg
- dist/badge-tests.svg
- dist/coverage
- dist/coverage.xml

safety:
stage: test
script:
- task check:safety

build:
stage: build
needs:
- mypy
- pytest
- safety
script:
- task build
artifacts:
when: always
paths:
- dist/*.tar.gz
- dist/*.whl

pypi:
# publishing only available on a tag
stage: publish
needs:
- ruff
- build
allow_failure: true
when: manual
script:
- poetry config pypi-token.pypi $PYPI_TOKEN
- poetry publish

8 changes: 8 additions & 0 deletions .idea/.gitignore

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

12 changes: 12 additions & 0 deletions .idea/cmem-plugin-index.iml

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

Loading

0 comments on commit b945b96

Please sign in to comment.