Skip to content

Commit bde63ad

Browse files
committed
v2
1 parent f38dc4e commit bde63ad

16 files changed

Lines changed: 1292 additions & 417 deletions

.github/workflows/ci_cd.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CodeConcat CI/CD
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: [ 'v*.*.*' ]
7+
pull_request:
8+
branches: [ "main" ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
id-token: write # For PyPI Trusted Publishing
14+
15+
jobs:
16+
lint-check:
17+
name: Lint & Format Check
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install ruff
28+
- name: Run Ruff Linter
29+
run: ruff check .
30+
- name: Run Ruff Formatter Check
31+
run: ruff format --check .
32+
33+
type-check:
34+
name: Type Check
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.11'
41+
- name: Install dependencies
42+
# Install with 'dev' extras to get mypy and types-*
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install .[dev]
46+
# Install libmagic for python-magic (needed for mypy checks too if types are strict)
47+
sudo apt-get update && sudo apt-get install -y libmagic1
48+
- name: Run MyPy Type Checker
49+
run: mypy codeconcat tests
50+
51+
test:
52+
name: Test & Coverage
53+
needs: [lint-check, type-check] # Depends on checks passing
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # Test across versions
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Set up Python ${{ matrix.python-version }}
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
66+
- name: Install dependencies including test extras
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install .[dev] # Installs pytest, pytest-cov etc.
70+
# Install libmagic required by python-magic (needed at runtime for tests)
71+
sudo apt-get update && sudo apt-get install -y libmagic1
72+
73+
- name: Run Pytest with Coverage
74+
run: pytest # Reads config from pyproject.toml
75+
76+
- name: Upload coverage reports to Codecov
77+
uses: codecov/codecov-action@v4 # Use v4
78+
with:
79+
# token: ${{ secrets.CODECOV_TOKEN }} # Not needed for public repos on codecov.io
80+
slug: lguibr/codeconcat # Optional: verify auto-detection
81+
files: ./coverage.xml # Ensure this matches pytest output
82+
fail_ci_if_error: true
83+
env:
84+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # Needed for private repos or Codecov Enterprise
85+
86+
publish:
87+
name: Publish to PyPI
88+
needs: test # Publish only if tests pass
89+
runs-on: ubuntu-latest
90+
if: startsWith(github.ref, 'refs/tags/v')
91+
environment:
92+
name: pypi
93+
url: https://pypi.org/p/codeconcat
94+
permissions:
95+
id-token: write # Required for trusted publishing
96+
97+
steps:
98+
- uses: actions/checkout@v4
99+
- uses: actions/setup-python@v5
100+
with:
101+
python-version: '3.11'
102+
- name: Install build dependencies
103+
run: python -m pip install --upgrade pip build
104+
- name: Build package
105+
run: python -m build
106+
- name: Publish package to PyPI
107+
uses: pypa/gh-action-pypi-publish@release/v1
108+
# Uses OIDC Trusted Publishing (no token needed)

.github/workflows/main.yml

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

.gitignore

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,81 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6+
# C extensions
7+
*.so
8+
69
# Distribution / packaging
7-
dist/
10+
.Python
811
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
923
*.egg-info/
24+
.installed.cfg
1025
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
*.py,cover
49+
.hypothesis/
50+
.pytest_cache/
1151

12-
# Virtual environments
52+
# Environments
53+
.env
54+
.venv
55+
env/
1356
venv/
14-
.venv/
57+
ENV/
58+
env.bak/
59+
venv.bak/
1560

16-
# IDE files
61+
# Spyder project settings
62+
.spyderproject
63+
.spyderworkspace
64+
65+
# Rope project settings
66+
.ropeproject
67+
68+
# mkdocs documentation
69+
/site
70+
71+
# mypy
72+
.mypy_cache/
73+
.dmypy.json
74+
dmypy.json
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# VS Code settings
1780
.vscode/
18-
.idea/
19-
20-
# Miscellaneous
21-
*.log
22-
*.swp
23-
*.swo
24-
*.bak
25-
*.txt
81+
82+
# Ruff
83+
.ruff_cache/

.isort.cfg

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

.pre-commit-config.yaml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1+
# .pre-commit-config.yaml
12
repos:
23
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
4+
rev: v4.6.0 # Updated rev, use latest stable
45
hooks:
56
- id: check-yaml
67
- id: end-of-file-fixer
78
- id: trailing-whitespace
89
args: [--markdown-linebreak-ext=md]
910
- id: debug-statements
1011
- id: fix-encoding-pragma
12+
# Note: The warning about deprecated stages might still appear
13+
# Run `pre-commit autoupdate` to potentially fix if desired.
1114

12-
- repo: https://github.com/pycqa/isort
13-
rev: 5.13.2
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
# Find the latest tag on GitHub https://github.com/astral-sh/ruff-pre-commit/tags
17+
rev: v0.5.5 # Use the latest stable tag
1418
hooks:
15-
- id: isort
16-
name: isort (python)
17-
args: ["--settings-path", ".isort.cfg"]
18-
19-
- repo: https://github.com/psf/black
20-
rev: 24.2.0
21-
hooks:
22-
- id: black
23-
language_version: python3.11
24-
25-
- repo: https://github.com/PyCQA/flake8
26-
rev: 7.0.0
27-
hooks:
28-
- id: flake8
19+
# Run the linter (replaces flake8, isort)
20+
- id: ruff
21+
args: [--fix, --exit-non-zero-on-fix] # Auto-fix issues and fail if fixes were made
22+
# Run the formatter (replaces black)
23+
- id: ruff-format
2924

25+
# Keep mypy
3026
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.9.0
27+
rev: v1.11.0 # Use the latest stable version compatible with your project
3228
hooks:
3329
- id: mypy
34-
additional_dependencies: [types-all]
30+
additional_dependencies: [types-setuptools]
31+
# Add other specific types-* if mypy complains later

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10.13

0 commit comments

Comments
 (0)