Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0 - pre release #9

Merged
merged 20 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
173 changes: 84 additions & 89 deletions .github/workflows/python-CI.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,99 @@
name: Full CI
name: CI for Tests and Package Publishing

on:
push:
branches: [main, dev]
branches:
- '**'
pull_request:
branches:
- main
release:
types: [published]
types:
- published
workflow_dispatch:
inputs:
job:
description: 'Choose which job to run'
required: true
default: 'deploy'
type: choice
options:
- publish-module
- test-Django
- coverage
- all

permissions:
contents: read

jobs:
test-Django:
if: github.event.inputs.job == 'test-Django' || github.event.inputs.job == 'all' || github.event_name == 'release' || github.event_name == 'push'
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
cd ./test/app/
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install ../../
- name: Run Tests
run: |
cd ./test/app/
python manage.py test

coverage:
if: github.event.inputs.job == 'coverage' || github.event.inputs.job == 'all' || github.event_name == 'release' || github.event_name == 'push'
runs-on: ubuntu-latest
needs: test-Django
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Dependencies
run: |
cd ./test/app/
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
pip install ../../
- name: Run Coverage
run: |
cd ./test/app/ && coverage run manage.py test && coverage html && coverage xml
- name: Upload Coverage to GitHub
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./test/app/htmlcov
- name: Report Coverage
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test/app/htmlcov/coverage.xml

publish-module:
if: github.event_name == 'release' || github.event.inputs.job == 'publish-module' || github.event.inputs.job == 'all'
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"

- name: Install dependencies
run: |
poetry install

- name: Run pre-commit hooks
run: |
poetry run pre-commit run --all-files

- name: Run tests with tox
run: |
poetry run tox

- name: Stop on failure
if: failure()
run: exit 1

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: unittests
fail_ci_if_error: true
verbose: true

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload HTML coverage report
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: htmlcov/

publish:
runs-on: ubuntu-latest
needs: [test-Django, coverage]
needs: test

if: github.event_name == 'release' # Exécuter uniquement lors d'une release

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Check current folder
run: |
ls
- name: Build package
run: |
python -m build
- name: Publish build
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"

- name: Install dependencies
run: poetry install --no-dev

- name: Build package
run: poetry build

- name: Publish package
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,6 @@ cython_debug/
# MacOS
.DS_Store
.AppleDouble
.LSOverride
.LSOverride

junit.xml
81 changes: 81 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
files: \.yaml$
- id: trailing-whitespace
exclude: (migrations/|tests/).*
- id: end-of-file-fixer
exclude: (migrations/|tests/).*
- id: check-added-large-files
exclude: (migrations/|tests/).*
- id: check-case-conflict
exclude: (migrations/|tests/).*
- id: check-merge-conflict
exclude: (migrations/|tests/).*
- id: check-docstring-first
exclude: (migrations/|tests/).*

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.2.1
hooks:
- id: pyproject-fmt

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.1
hooks:
- id: tox-ini-fmt

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
exclude: (migrations/|tests/).*

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [ "--config=pyproject.toml" ]
exclude: (migrations/).*

- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
args: [ "-c", "pyproject.toml", "-r", "." ]
additional_dependencies: [ "bandit[toml]" ]
exclude: (migrations/|tests/).*

- repo: local
hooks:
- id: pytest
name: Pytest
entry: poetry run pytest -v
language: system
types: [ python ]
stages: [ commit ]
pass_filenames: false
always_run: true

- id: pylint
name: pylint
entry: poetry run pylint
language: system
types: [ python ]
require_serial: true
args:
- "-rn"
- "-sn"
- "--rcfile=pyproject.toml"
- "--load-plugins=pylint_pytest"

files: ^hybridrouter/
exclude: (migrations/|tests/).*
25 changes: 14 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"python.testing.unittestArgs": [
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"isort.args":["--profile", "black"],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.pytestArgs": [
"-v",
"-s",
"./test/app/",
"-m",
"unittest",
"discover",
"-p",
"test*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
}
"./hybridrouter/tests/"
]
}
Loading
Loading