Skip to content

Commit 57cdfe3

Browse files
authored
Merge pull request #62 from rok4/develop
Release 2.0.0
2 parents 77fb4ae + 48baef4 commit 57cdfe3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5414
-2230
lines changed

.bumpversion.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[bumpversion]
2+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(b(?P<beta>\d+))?
3+
serialize =
4+
{major}.{minor}.{patch}b{beta}
5+
{major}.{minor}.{patch}
6+
7+
[bumpversion:file:pyproject.toml]
8+
9+
[bumpversion:file:src/rok4/__init__.py]

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[run]
2-
include =
2+
include =
33
*/src/*
44
omit =
55
*/__init__.py

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
time: "17:00"
8+
timezone: Europe/Paris
9+
labels:
10+
- dependencies
11+
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: monthly
16+
time: "22:00"
17+
timezone: Europe/Paris
18+
labels:
19+
- ci-cd

.github/labeler.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ci-cd:
2+
- .github/**/*
3+
4+
dependencies:
5+
- requirements.txt
6+
- requirements/*.txt
7+
8+
documentation:
9+
- docs/**/*
10+
11+
enhancement:
12+
- src/**/*
13+
14+
quality:
15+
- tests/**/*
16+
17+
tooling:
18+
- .gitignore
19+
- .pre-commit-config.yaml
20+
- setup.cfg
21+
- pyproject.toml

.github/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
- pre-commit-ci
6+
categories:
7+
- title: Correction de bugs 🐛
8+
labels:
9+
- bug
10+
- title: Améliorations et nouvelles fonctionnalités 🎉
11+
labels:
12+
- enhancement
13+
- quality
14+
- title: Outillage 🔧
15+
labels:
16+
- ci-cd
17+
- dependencies
18+
- tooling
19+
- title: Documentation 📖
20+
labels:
21+
- documentation
22+
- title: Divers
23+
labels:
24+
- "*"

.github/workflows/build-and-release.yaml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Test, build and publish artefacts and documentation
33
on:
44
push:
55
tags:
6-
- '**'
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
- '[0-9]+.[0-9]+.[0-9]+b[0-9]+'
78

89
jobs:
910

@@ -19,15 +20,14 @@ jobs:
1920

2021
- name: Create Release
2122
id: create_release
22-
uses: actions/create-release@v1
23-
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
uses: ncipollo/release-action@v1
2524
with:
26-
tag_name: ${{ github.ref_name }}
27-
release_name: Release ${{ github.ref_name }}
28-
body_path: CHANGELOG.md
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
tag: ${{ github.ref_name }}
27+
name: Release ${{ github.ref_name }}
28+
generateReleaseNotes: true
2929
draft: false
30-
prerelease: false
30+
prerelease: ${{ contains(github.ref_name ,'b') }}
3131

3232
build_and_test:
3333

@@ -68,41 +68,40 @@ jobs:
6868
python3 -m venv .venv
6969
source .venv/bin/activate
7070
python3 -m pip install --upgrade build bump2version
71-
bump2version --current-version 0.0.0 --new-version ${{ github.ref_name }} patch pyproject.toml src/rok4/__init__.py
71+
bump2version --current-version 0.0.0 --new-version ${{ github.ref_name }} patch
7272
pip install -e .
7373
echo "/usr/lib/python3/dist-packages/" >.venv/lib/python${{ matrix.python-version }}/site-packages/system.pth
7474
7575
- name: Run unit tests
76-
if: "(${{ matrix.os }}=='ubuntu-20.04')&&(${{ matrix.python-version }}=='3.8')"
7776
run: |
7877
source .venv/bin/activate
7978
pip install -e .[test]
8079
coverage run -m pytest
8180
coverage report -m
8281
8382
- name: Build unit tests report
84-
if: "(${{ matrix.os }}=='ubuntu-20.04')&&(${{ matrix.python-version }}=='3.8')"
83+
if: "! contains(github.ref_name,'b') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8'"
8584
run: |
8685
source .venv/bin/activate
8786
coverage html -d dist/tests/
8887
rm dist/tests/.gitignore
8988
9089
- name: Build package
91-
if: "(${{ matrix.os }}=='ubuntu-20.04')&&(${{ matrix.python-version }}=='3.8')"
90+
if: "matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8'"
9291
run: |
9392
source .venv/bin/activate
9493
python3 -m build
9594
9695
- name: Build documentation
97-
if: "(${{ matrix.os }}=='ubuntu-20.04')&&(${{ matrix.python-version }}=='3.8')"
96+
if: "! contains(github.ref_name,'b') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8'"
9897
run: |
9998
source .venv/bin/activate
10099
pip install -e .[doc]
101100
pdoc3 --html --output-dir dist/ rok4
102101
cp README.md CHANGELOG.md dist/
103102
104103
- name: Upload packages, tests results and documentation
105-
if: "(${{ matrix.os }}=='ubuntu-20.04')&&(${{ matrix.python-version }}=='3.8')"
104+
if: "matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8'"
106105
uses: actions/upload-artifact@v3
107106
with:
108107
name: dist-py3
@@ -113,7 +112,7 @@ jobs:
113112
publish_artefacts:
114113
name: Add built artefacts to release and PyPI
115114
needs: [create_release, build_and_test]
116-
if: "always()&&(needs.create_release.outputs.job_status=='success')&&(needs.build_and_test.outputs.job_status=='success')"
115+
if: "always() && needs.create_release.outputs.job_status == 'success' && needs.build_and_test.outputs.job_status == 'success'"
117116
runs-on: ubuntu-latest
118117

119118
steps:
@@ -135,7 +134,7 @@ jobs:
135134
asset_content_type: application/zip
136135

137136
- name: Add tarball package to release
138-
id: upload-release-targz
137+
id: upload-release-targz
139138
uses: actions/upload-release-asset@v1
140139
env:
141140
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -159,7 +158,7 @@ jobs:
159158
commit_documentation:
160159
name: Add documentation and unit tests results into gh-pages branch
161160
needs: build_and_test
162-
if: "always()&&(needs.create_release.outputs.job_status=='success')&&(needs.build_and_test.outputs.job_status=='success')"
161+
if: "always() && ! contains(github.ref_name,'b') && needs.create_release.outputs.job_status == 'success' && needs.build_and_test.outputs.job_status == 'success'"
163162
runs-on: ubuntu-latest
164163

165164
steps:
@@ -183,31 +182,33 @@ jobs:
183182
184183
- name: Add pages from templates
185184
run: |
186-
sed "s#__version__#${{ github.ref_name }}#" templates/TESTS.template.md >docs/versions/${{ github.ref_name }}/TESTS.md
187-
sed "s#__version__#${{ github.ref_name }}#" templates/DOCUMENTATION.template.md >docs/versions/${{ github.ref_name }}/DOCUMENTATION.md
188-
sed "s#__version__#${{ github.ref_name }}#" templates/CHANGELOG.template.md >docs/versions/${{ github.ref_name }}/CHANGELOG.md
189-
cat artifact/CHANGELOG.md >>docs/versions/${{ github.ref_name }}/CHANGELOG.md
190-
sed "s#__version__#${{ github.ref_name }}#" templates/README.template.md >docs/versions/${{ github.ref_name }}/README.md
191-
cat artifact/README.md >>docs/versions/${{ github.ref_name }}/README.md
192-
sed "s#__version__#${{ github.ref_name }}#" templates/index.template.md >docs/index.md
193-
echo "# Versions" >docs/versions.md
194-
echo "" >>docs/versions.md
195-
for v in `ls -t docs/versions | grep -v latest`; do sed "s#__version__#$v#" templates/versions.template.md >>docs/versions.md; done
185+
sed "s#__version__#${{ github.ref_name }}#" templates/mkdocs.template.yml >mkdocs.yml
186+
187+
sed "s#__version__#${{ github.ref_name }}#" templates/unit-tests.template.md >docs/versions/${{ github.ref_name }}/unit-tests.md
188+
sed "s#__version__#${{ github.ref_name }}#" templates/documentation.template.md >docs/versions/${{ github.ref_name }}/documentation.md
189+
190+
sed "s#__version__#${{ github.ref_name }}#" templates/index-version.template.md >docs/versions/${{ github.ref_name }}/index.md
191+
cat artifact/README.md >>docs/versions/${{ github.ref_name }}/index.md
192+
sed -i "s#x.y.z#${{ github.ref_name }}#g" docs/versions/${{ github.ref_name }}/index.md
193+
194+
cp templates/index-versions.template.md docs/versions/index.md
195+
sed "s/^## \(.*\)$/## \1 \n\n[➔ Lien vers la documentation](\1\/index.md) /" artifact/CHANGELOG.md >>docs/versions/index.md
196+
196197
sed "s#__version__#${{ github.ref_name }}#" templates/latest.template.html >docs/versions/latest/index.html
197198
rm -r artifact
198199
199200
- name: Publish on gh-pages branch
200201
run: |
201202
git config user.name github-actions
202203
git config user.email github-actions@github.com
203-
git add -v docs/versions/${{ github.ref_name }}/ docs/versions/latest/ docs/index.md docs/versions.md
204+
git add -v docs/versions/${{ github.ref_name }}/ docs/versions/latest/ docs/versions/index.md mkdocs.yml
204205
git commit -m "Add documentation for version ${{ github.ref_name }}"
205206
git push
206207
207208
delete_version:
208209
name: Remove release and tag if error occured
209210
needs: build_and_test
210-
if: "always()&&(needs.create_release.outputs.job_status=='success')&&(needs.build_and_test.outputs.job_status!='success')"
211+
if: "always() && needs.create_release.outputs.job_status == 'success' && needs.build_and_test.outputs.job_status != 'success'"
211212
runs-on: ubuntu-latest
212213

213214
steps:
@@ -218,4 +219,3 @@ jobs:
218219
delete_release: true
219220
env:
220221
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
221-
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "🏷 PR Labeler"
2+
on:
3+
- pull_request_target
4+
5+
permissions:
6+
contents: read
7+
pull-requests: write
8+
9+
jobs:
10+
triage:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/labeler@v4
14+
with:
15+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.pre-commit-config.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
exclude: ".venv|__pycache__|tests/dev/|tests/fixtures/"
2+
fail_fast: false
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.4.0
6+
hooks:
7+
- id: check-added-large-files
8+
args: ["--maxkb=1024"]
9+
- id: check-ast
10+
- id: check-builtin-literals
11+
- id: check-case-conflict
12+
- id: check-toml
13+
- id: check-yaml
14+
- id: detect-private-key
15+
- id: end-of-file-fixer
16+
- id: fix-byte-order-marker
17+
- id: fix-encoding-pragma
18+
args: [--remove]
19+
- id: name-tests-test
20+
args: [--pytest-test-first]
21+
- id: trailing-whitespace
22+
args: [--markdown-linebreak-ext=md]
23+
24+
- repo: https://github.com/astral-sh/ruff-pre-commit
25+
rev: "v0.0.281"
26+
hooks:
27+
- id: ruff
28+
args: ["--fix-only", "--target-version=py38"]
29+
30+
- repo: https://github.com/psf/black
31+
rev: 23.3.0
32+
hooks:
33+
- id: black
34+
args: ["--target-version=py38"]
35+
36+
- repo: https://github.com/pycqa/isort
37+
rev: 5.12.0
38+
hooks:
39+
- id: isort
40+
args: ["--profile", "black", "--filter-files"]
41+
42+
- repo: https://github.com/asottile/pyupgrade
43+
rev: v3.3.1
44+
hooks:
45+
- id: pyupgrade
46+
args:
47+
- "--py38-plus"
48+
49+
ci:
50+
autofix_commit_msg: "[pre-commit.ci] Corrections automatiques appliquées par les git hooks."
51+
autofix_prs: true
52+
autoupdate_commit_msg: "[pre-commit.ci] Mise à jour des git hooks."
53+
autoupdate_schedule: quarterly

0 commit comments

Comments
 (0)