Skip to content

Commit e3ba887

Browse files
committed
Merge branch 'master' into newerrors
2 parents 1e86fbf + 1923d74 commit e3ba887

Some content is hidden

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

61 files changed

+3405
-720
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Issues Fixed
2+
<!-- List the issues fixed by this PR -->
3+
- Closes #[issue number]
4+
- Related to #[issue number] (if applicable)
5+
6+
## Verification Steps
7+
Please ensure the following steps have been completed:
8+
- [ ] Added new tests to cover the changes.
9+
- [ ] Fixed all broken tests.
10+
- [ ] Ran `poetry run flake8` to check for linting issues.
11+
- [ ] Verified that all unit tests are passing:
12+
- [ ] Ran `poetry run pytest` to ensure unit tests pass.
13+
- [ ] Ran `poetry run tox` to validate compatibility across Python versions.
14+
15+
## Additional Notes
16+
<!-- Add any other relevant information, context, or screenshots -->

.github/PULL_REQUEST_TEMPLATE/bug_fix.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/check-i18n.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Check I18N Changes
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check-i18n:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository (PR branch)
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
17+
fetch-depth: 0
18+
19+
- name: Install system dependencies
20+
run: sudo apt-get update && sudo apt-get install -y gettext
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install poetry
31+
poetry install
32+
33+
- name: Run I18N module
34+
run: |
35+
poetry run python -m norminette.i18n
36+
37+
- name: Check for uncommitted .po changes
38+
run: |
39+
if git diff --ignore-matching-lines='^"POT-Creation-Date:' -- '*.po' | grep -P '^[+-](?![+-]{2} [ab]/)' > /dev/null; then
40+
echo "Meaningful I18N changes detected. Please run 'python -m norminette/i18n.py' and commit the changes."
41+
git diff -- '*.po'
42+
exit 1
43+
else
44+
echo "No changes detected in I18N files."
45+
fi

.github/workflows/python-package.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,31 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.8", "3.9", "3.10", "3.11"]
18+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1919

2020
timeout-minutes: 5
2121
steps:
2222
- uses: actions/checkout@v2
23+
2324
- name: Set up Python ${{ matrix.python-version }}
2425
uses: actions/setup-python@v2
2526
with:
2627
python-version: ${{ matrix.python-version }}
28+
2729
- name: Install dependencies
2830
run: |
2931
python -m pip install --upgrade pip
3032
pip install poetry
31-
- name: Setup package dependencies
32-
run: |
3333
poetry install
34+
35+
- name: Build package
36+
run: |
37+
poetry build
38+
3439
- name: Run linter
3540
run: |
3641
poetry run flake8
42+
3743
- name: Run tests
3844
run: |
3945
poetry run pytest

.github/workflows/python-publish.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,21 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: '3.9'
20+
python-version: '3.10'
2121
- name: Install dependencies
2222
run: |
23+
sudo apt-get update && sudo apt-get install -y gettext
2324
python -m pip install --upgrade pip
2425
pip install setuptools wheel twine poetry
26+
- name: Install norminette package
27+
run: |
28+
poetry install
29+
- name: Compile .mo files
30+
run: |
31+
poetry run python norminette/i18n.py
2532
- name: Build and publish
2633
env:
2734
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2835
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2936
run: |
3037
poetry publish --build --username $TWINE_USERNAME --password $TWINE_PASSWORD
31-
- name: Build and publish to test_pypi
32-
env:
33-
TWINE_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }}
34-
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
35-
run: |
36-
poetry publish --build --repository testpypi --username $TWINE_USERNAME --password $TWINE_PASSWORD

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ dist/
2222
*_cache
2323
.venv
2424
.tox
25+
*.pot
26+
**/*.mo

Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
FROM python:3.12-slim
1+
FROM python:3.13-alpine
22

33
WORKDIR /usr/src/norminette
44

5-
COPY pyproject.toml poetry.lock ./
5+
COPY pyproject.toml poetry.lock README.md ./
6+
COPY norminette/ ./norminette/
67

7-
RUN pip3 install poetry \
8-
&& poetry config virtualenvs.create false \
9-
&& poetry install --no-dev
10-
11-
COPY . .
12-
13-
RUN python3 setup.py install
8+
RUN pip3 install --no-cache-dir 'poetry>=2,<3' --root-user-action=ignore \
9+
&& poetry build \
10+
&& pip3 install dist/*.whl --root-user-action=ignore
1411

1512
WORKDIR /code
1613

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
## Install
44

5-
Requires python3.8+ (3.8, 3.9, 3.10, 3.11)
5+
Norminette requires Python >=3.10.
66

77
### Directly inside your global commands
88

99
Install using pip.
1010
```shell
11-
python3 -m pip install --upgrade pip setuptools
12-
python3 -m pip install norminette
11+
python3 -m pip install -U norminette
1312
```
1413

1514
Install using pipx.
@@ -98,3 +97,28 @@ norminette
9897
# Run tests
9998
poetry run pytest
10099
```
100+
101+
## Github action
102+
103+
Workflow example to check code with github action :
104+
105+
```yaml
106+
---
107+
name: Norminette
108+
109+
on:
110+
push:
111+
112+
jobs:
113+
check-norminette:
114+
name: Norminette
115+
runs-on: ubuntu-latest
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v3
119+
120+
- name: Norminette
121+
uses: 42School/norminette@<tag>
122+
with:
123+
args: '-RCheckForbiddenSourceHeader'
124+
```

action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: 'norminette-action'
3+
author: '42 School'
4+
description: 'It is the official github action for 42 school norminette'
5+
branding:
6+
icon: 'check'
7+
color: 'gray-dark'
8+
inputs:
9+
args:
10+
description: 'Args passed to norminette'
11+
required: false
12+
default: '.'
13+
runs:
14+
using: 'docker'
15+
image: 'Dockerfile'
16+
entrypoint: 'sh'
17+
args:
18+
- '-c'
19+
- "norminette ${{ inputs.args }}"

deploy.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)