Skip to content

Commit 38e9b8b

Browse files
committed
Making ci changes and refactoring changes
1 parent 81ea45f commit 38e9b8b

31 files changed

+3886
-111
lines changed

.github/workflows/ci.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main-copy, working-branch ]
6+
pull_request:
7+
branches: [ main-copy, working-branch ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v2
26+
with:
27+
version: "latest"
28+
29+
- name: Create virtual environment
30+
run: uv venv
31+
32+
- name: Activate virtual environment
33+
run: source .venv/bin/activate
34+
35+
- name: Install dependencies
36+
run: uv pip install -e ".[dev]"
37+
38+
- name: Lint with flake8
39+
run: |
40+
# Stop the build if there are Python syntax errors or undefined names
41+
flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
42+
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43+
flake8 src/ tests/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
44+
45+
- name: Type check with mypy
46+
run: mypy src/audio_processing_ai/ --ignore-missing-imports
47+
48+
- name: Format check with black
49+
run: black --check src/ tests/
50+
51+
- name: Import sort check with isort
52+
run: isort --check-only src/ tests/
53+
54+
- name: Test with pytest
55+
run: pytest tests/ -v --cov=src/audio_processing_ai --cov-report=xml
56+
57+
- name: Upload coverage to Codecov
58+
if: matrix.python-version == '3.9'
59+
uses: codecov/codecov-action@v3
60+
with:
61+
file: ./coverage.xml
62+
flags: unittests
63+
name: codecov-umbrella
64+
fail_ci_if_error: false
65+
66+
build:
67+
runs-on: ubuntu-latest
68+
needs: test
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Set up Python
74+
uses: actions/setup-python@v4
75+
with:
76+
python-version: "3.9"
77+
78+
- name: Install uv
79+
uses: astral-sh/setup-uv@v2
80+
with:
81+
version: "latest"
82+
83+
- name: Install build dependencies
84+
run: uv pip install build twine
85+
86+
- name: Build package
87+
run: uv run python -m build
88+
89+
- name: Check package
90+
run: uv run twine check dist/*
91+
92+
- name: Upload build artifacts
93+
uses: actions/upload-artifact@v3
94+
with:
95+
name: dist
96+
path: dist/
97+
98+
test-scripts:
99+
runs-on: ubuntu-latest
100+
needs: test
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Set up Python
106+
uses: actions/setup-python@v4
107+
with:
108+
python-version: "3.9"
109+
110+
- name: Install uv
111+
uses: astral-sh/setup-uv@v2
112+
with:
113+
version: "latest"
114+
115+
- name: Install dependencies
116+
run: uv pip install -e .
117+
118+
- name: Test train.py help
119+
run: python train.py --help
120+
121+
- name: Test predict.py help
122+
run: python predict.py --help
123+
124+
- name: Test threshold_sweep.py import
125+
run: python -c "import sys; sys.path.append('src/audio_processing_ai/scripts'); import threshold_sweep; print('threshold_sweep imports successfully')"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Dependency Update
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 9 AM UTC
6+
- cron: '0 9 * * 1'
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-dependencies:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.9"
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v2
25+
with:
26+
version: "latest"
27+
28+
- name: Update dependencies
29+
run: |
30+
uv lock --upgrade
31+
git config --local user.email "[email protected]"
32+
git config --local user.name "GitHub Action"
33+
git add uv.lock
34+
if git diff --staged --quiet; then
35+
echo "No dependency updates found"
36+
else
37+
git commit -m "chore: update dependencies via uv"
38+
git push origin main-copy
39+
fi

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release (e.g., v1.0.0)'
11+
required: true
12+
type: string
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
id-token: write
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: "3.9"
30+
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v2
33+
with:
34+
version: "latest"
35+
36+
- name: Install build dependencies
37+
run: uv pip install build twine
38+
39+
- name: Build package
40+
run: uv run python -m build
41+
42+
- name: Check package
43+
run: uv run twine check dist/*
44+
45+
- name: Publish to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
user: __token__
49+
password: ${{ secrets.PYPI_API_TOKEN }}
50+
skip_existing: true
51+
52+
- name: Create GitHub Release
53+
uses: actions/create-release@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tag_name: ${{ github.ref_name }}
58+
release_name: Release ${{ github.ref_name }}
59+
body: |
60+
## Changes in ${{ github.ref_name }}
61+
62+
See the [changelog](CHANGELOG.md) for detailed information about this release.
63+
64+
### Installation
65+
66+
```bash
67+
pip install audio-processing-ai==${{ github.ref_name }}
68+
```
69+
70+
### Quick Start
71+
72+
```python
73+
from audio_processing_ai import AIAudioDataset, DualHeadCnn14Simple
74+
75+
# Your code here
76+
```
77+
draft: false
78+
prerelease: false

.gitignore

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,93 @@ model/saved_models/*.pth*
206206
data/train/*
207207

208208
# No data in data_split folder
209-
data_split/*
209+
data_split/*
210+
211+
# OS generated files
212+
.DS_Store
213+
.DS_Store?
214+
._*
215+
.Spotlight-V100
216+
.Trashes
217+
ehthumbs.db
218+
Thumbs.db
219+
220+
# Editor files
221+
*.swp
222+
*.swo
223+
*~
224+
225+
# Temporary files
226+
*.tmp
227+
*.temp
228+
*.bak
229+
*.backup
230+
231+
# Log files
232+
*.log
233+
logs/
234+
235+
# Environment variables
236+
.env.local
237+
.env.*.local
238+
239+
# Coverage reports
240+
htmlcov/
241+
.coverage.*
242+
.coverage
243+
244+
# pytest
245+
.pytest_cache/
246+
247+
# Jupyter Notebook checkpoints
248+
.ipynb_checkpoints/
249+
250+
# pyenv
251+
.python-version
252+
253+
# pipenv
254+
Pipfile.lock
255+
256+
# PEP 582
257+
__pypackages__/
258+
259+
# Celery
260+
celerybeat-schedule
261+
celerybeat.pid
262+
263+
# SageMath
264+
*.sage.py
265+
266+
# Spyder
267+
.spyderproject
268+
.spyproject
269+
270+
# Rope
271+
.ropeproject
272+
273+
# mkdocs
274+
/site
275+
276+
# mypy
277+
.mypy_cache/
278+
.dmypy.json
279+
dmypy.json
280+
281+
# Pyre
282+
.pyre/
283+
284+
# pytype
285+
.pytype/
286+
287+
# Cython
288+
cython_debug/
289+
290+
# Output files
291+
*.csv
292+
*.xlsx
293+
predictions_*.csv
294+
predictions_*.xlsx
295+
296+
# Model outputs and checkpoints (excluding the specific patterns you want to keep)
297+
*.pth
298+
*.pth.gz

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-merge-conflict
10+
- id: debug-statements
11+
12+
- repo: https://github.com/psf/black
13+
rev: 23.7.0
14+
hooks:
15+
- id: black
16+
language_version: python3
17+
18+
- repo: https://github.com/pycqa/isort
19+
rev: 5.12.0
20+
hooks:
21+
- id: isort
22+
args: ["--profile", "black"]
23+
24+
- repo: https://github.com/pycqa/flake8
25+
rev: 6.0.0
26+
hooks:
27+
- id: flake8
28+
args: [--max-line-length=88, --extend-ignore=E203]
29+
30+
- repo: https://github.com/pre-commit/mirrors-mypy
31+
rev: v1.5.1
32+
hooks:
33+
- id: mypy
34+
additional_dependencies: [types-all]
35+
args: [--ignore-missing-imports]

0 commit comments

Comments
 (0)