Skip to content

Commit 65f75de

Browse files
authored
Merge pull request #9 from enzofrnt/1.0.0
1.0.0 - pre release
2 parents 127a0fb + 169c564 commit 65f75de

23 files changed

+1597
-319
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/python-CI.yml

Lines changed: 84 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,99 @@
1-
name: Full CI
1+
name: CI for Tests and Package Publishing
22

33
on:
44
push:
5-
branches: [main, dev]
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- main
610
release:
7-
types: [published]
11+
types:
12+
- published
813
workflow_dispatch:
9-
inputs:
10-
job:
11-
description: 'Choose which job to run'
12-
required: true
13-
default: 'deploy'
14-
type: choice
15-
options:
16-
- publish-module
17-
- test-Django
18-
- coverage
19-
- all
2014

2115
permissions:
2216
contents: read
2317

2418
jobs:
25-
test-Django:
26-
if: github.event.inputs.job == 'test-Django' || github.event.inputs.job == 'all' || github.event_name == 'release' || github.event_name == 'push'
19+
test:
2720
runs-on: ubuntu-latest
28-
strategy:
29-
matrix:
30-
python-version: ["3.10", "3.11", "3.12"]
3121

3222
steps:
33-
- uses: actions/checkout@v4
34-
- name: Set up Python ${{ matrix.python-version }}
35-
uses: actions/setup-python@v5
36-
with:
37-
python-version: ${{ matrix.python-version }}
38-
- name: Install Dependencies
39-
run: |
40-
cd ./test/app/
41-
python -m pip install --upgrade pip
42-
pip install -r requirements.txt
43-
pip install ../../
44-
- name: Run Tests
45-
run: |
46-
cd ./test/app/
47-
python manage.py test
48-
49-
coverage:
50-
if: github.event.inputs.job == 'coverage' || github.event.inputs.job == 'all' || github.event_name == 'release' || github.event_name == 'push'
51-
runs-on: ubuntu-latest
52-
needs: test-Django
53-
steps:
54-
- uses: actions/checkout@v4
55-
- name: Set up Python
56-
uses: actions/setup-python@v5
57-
with:
58-
python-version: '3.11'
59-
- name: Install Dependencies
60-
run: |
61-
cd ./test/app/
62-
python -m pip install --upgrade pip
63-
pip install -r requirements.txt
64-
pip install coverage
65-
pip install ../../
66-
- name: Run Coverage
67-
run: |
68-
cd ./test/app/ && coverage run manage.py test && coverage html && coverage xml
69-
- name: Upload Coverage to GitHub
70-
uses: actions/upload-artifact@v4
71-
with:
72-
name: coverage-report
73-
path: ./test/app/htmlcov
74-
- name: Report Coverage
75-
uses: codecov/codecov-action@v4.0.1
76-
with:
77-
token: ${{ secrets.CODECOV_TOKEN }}
78-
files: ./test/app/htmlcov/coverage.xml
79-
80-
publish-module:
81-
if: github.event_name == 'release' || github.event.inputs.job == 'publish-module' || github.event.inputs.job == 'all'
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.x'
29+
30+
- name: Install Poetry
31+
run: |
32+
curl -sSL https://install.python-poetry.org | python3 -
33+
export PATH="$HOME/.local/bin:$PATH"
34+
35+
- name: Install dependencies
36+
run: |
37+
poetry install
38+
39+
- name: Run pre-commit hooks
40+
run: |
41+
poetry run pre-commit run --all-files
42+
43+
- name: Run tests with tox
44+
run: |
45+
poetry run tox
46+
47+
- name: Stop on failure
48+
if: failure()
49+
run: exit 1
50+
51+
- name: Upload to Codecov
52+
uses: codecov/codecov-action@v3
53+
with:
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
files: coverage.xml
56+
flags: unittests
57+
fail_ci_if_error: true
58+
verbose: true
59+
60+
- name: Upload test results to Codecov
61+
if: ${{ !cancelled() }}
62+
uses: codecov/test-results-action@v1
63+
with:
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
66+
- name: Upload HTML coverage report
67+
if: always()
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: coverage-report
71+
path: htmlcov/
72+
73+
publish:
8274
runs-on: ubuntu-latest
83-
needs: [test-Django, coverage]
75+
needs: test
76+
77+
if: github.event_name == 'release' # Exécuter uniquement lors d'une release
78+
8479
steps:
85-
- uses: actions/checkout@v4
86-
- name: Set up Python
87-
uses: actions/setup-python@v5
88-
with:
89-
python-version: '3.11'
90-
- name: Install dependencies
91-
run: |
92-
python -m pip install --upgrade pip
93-
pip install build
94-
- name: Check current folder
95-
run: |
96-
ls
97-
- name: Build package
98-
run: |
99-
python -m build
100-
- name: Publish build
101-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
102-
with:
103-
user: __token__
104-
password: ${{ secrets.PYPI_API_TOKEN }}
80+
- uses: actions/checkout@v4
81+
82+
- name: Set up Python
83+
uses: actions/setup-python@v3
84+
with:
85+
python-version: '3.x'
86+
87+
- name: Install Poetry
88+
run: |
89+
curl -sSL https://install.python-poetry.org | python3 -
90+
export PATH="$HOME/.local/bin:$PATH"
91+
92+
- name: Install dependencies
93+
run: poetry install --no-dev
94+
95+
- name: Build package
96+
run: poetry build
97+
98+
- name: Publish package
99+
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,6 @@ cython_debug/
162162
# MacOS
163163
.DS_Store
164164
.AppleDouble
165-
.LSOverride
165+
.LSOverride
166+
167+
junit.xml

.pre-commit-config.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
files: \.yaml$
8+
- id: trailing-whitespace
9+
exclude: (migrations/|tests/).*
10+
- id: end-of-file-fixer
11+
exclude: (migrations/|tests/).*
12+
- id: check-added-large-files
13+
exclude: (migrations/|tests/).*
14+
- id: check-case-conflict
15+
exclude: (migrations/|tests/).*
16+
- id: check-merge-conflict
17+
exclude: (migrations/|tests/).*
18+
- id: check-docstring-first
19+
exclude: (migrations/|tests/).*
20+
21+
- repo: https://github.com/tox-dev/pyproject-fmt
22+
rev: 2.2.1
23+
hooks:
24+
- id: pyproject-fmt
25+
26+
- repo: https://github.com/tox-dev/tox-ini-fmt
27+
rev: 1.3.1
28+
hooks:
29+
- id: tox-ini-fmt
30+
31+
- repo: https://github.com/asottile/pyupgrade
32+
rev: v3.15.2
33+
hooks:
34+
- id: pyupgrade
35+
36+
- repo: https://github.com/pre-commit/mirrors-isort
37+
rev: v5.10.1
38+
hooks:
39+
- id: isort
40+
exclude: (migrations/|tests/).*
41+
42+
- repo: https://github.com/psf/black
43+
rev: 23.3.0
44+
hooks:
45+
- id: black
46+
args: [ "--config=pyproject.toml" ]
47+
exclude: (migrations/).*
48+
49+
- repo: https://github.com/PyCQA/bandit
50+
rev: 1.7.4
51+
hooks:
52+
- id: bandit
53+
args: [ "-c", "pyproject.toml", "-r", "." ]
54+
additional_dependencies: [ "bandit[toml]" ]
55+
exclude: (migrations/|tests/).*
56+
57+
- repo: local
58+
hooks:
59+
- id: pytest
60+
name: Pytest
61+
entry: poetry run pytest -v
62+
language: system
63+
types: [ python ]
64+
stages: [ commit ]
65+
pass_filenames: false
66+
always_run: true
67+
68+
- id: pylint
69+
name: pylint
70+
entry: poetry run pylint
71+
language: system
72+
types: [ python ]
73+
require_serial: true
74+
args:
75+
- "-rn"
76+
- "-sn"
77+
- "--rcfile=pyproject.toml"
78+
- "--load-plugins=pylint_pytest"
79+
80+
files: ^hybridrouter/
81+
exclude: (migrations/|tests/).*

.vscode/settings.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
{
2-
"python.testing.unittestArgs": [
2+
"[python]": {
3+
"editor.defaultFormatter": "ms-python.black-formatter",
4+
"editor.formatOnSave": true,
5+
"editor.codeActionsOnSave": {
6+
"source.organizeImports": "explicit"
7+
}
8+
},
9+
"isort.args":["--profile", "black"],
10+
"python.testing.pytestEnabled": true,
11+
"python.testing.unittestEnabled": false,
12+
"python.testing.pytestArgs": [
313
"-v",
414
"-s",
5-
"./test/app/",
6-
"-m",
7-
"unittest",
8-
"discover",
9-
"-p",
10-
"test*.py"
11-
],
12-
"python.testing.pytestEnabled": false,
13-
"python.testing.unittestEnabled": true,
14-
}
15+
"./hybridrouter/tests/"
16+
]
17+
}

0 commit comments

Comments
 (0)