Skip to content

Commit 0c43ebb

Browse files
dphoriacursoragent
andauthored
feature/pull-request-actions (#3)
* feat: Add GitHub Actions for pull request checks - Create feature/pull-request-actions branch - Add comprehensive CI workflow with tests, linting, and security checks - Add pull request workflow for basic quality checks - Add security workflow for vulnerability scanning - Update pyproject.toml with additional dev and security dependencies - Update README with development workflow documentation - Configure PDM for dependency management - Set up ruff, black, pytest, bandit, and safety checks * chore: Update lock file with security dependencies * refactor: Consolidate GitHub Actions into single comprehensive workflow - Remove redundant pull-request.yml and security.yml files - Consolidate all checks into single ci.yml workflow - Add conditional job execution for optimized performance - Quick checks for PRs, full suite for main branch - Update README to reflect simplified approach * simplify: Remove lint and security jobs from GitHub Actions - Remove lint job (ruff format, isort checks) - Remove security job (bandit, safety scans) - Keep only quick-checks and test jobs - Update README to reflect simplified workflow - Streamline local development instructions * feat: Make test job run only on manual triggers - Add conditional 'if: github.event_name == workflow_dispatch' to test job - Test job now only runs when manually triggered - Pull requests only run quick checks (Ruff + Black) - Update README to reflect new behavior * revert: Restore README.md to original state - Remove all GitHub Actions documentation - Remove development workflow instructions - Restore original README content * feat: Add pytest to quick-checks job - Add pytest step to quick-checks job for pull requests - Exclude test_receipt_analysis_with_chat test that calls OpenAI API - Use -k 'not test_receipt_analysis_with_chat' to skip the API test - All other tests (15/16) run successfully in quick checks * fix: Add ruff configuration to resolve CI failures - Add comprehensive ruff configuration to pyproject.toml - Use modern lint section syntax to avoid deprecation warnings - Ignore import sorting issues (I001) to focus on code quality - Ignore other style issues that don't affect functionality - Ensure consistent behavior between local and CI environments * fix: Simplify ruff configuration to resolve CI issues - Reduce ruff rules to only essential error checking (E, W, F) - Remove complex rules that might cause version compatibility issues - Keep only basic pycodestyle errors, warnings, and pyflakes - Ignore only line length issues (E501) which are handled by black * fix: Use pdm sync instead of pdm install in GitHub Actions - Change pdm install to pdm sync to ensure all dependencies are installed - pdm sync installs all groups including dev dependencies (ruff, black, pytest) - pdm install only installs main dependencies by default - This should resolve the 'ruff command not found' error in CI * fix: Add dev group to lockfile and update GitHub Actions - Add dev group to pdm.lock so dev dependencies can be installed - Update GitHub Actions to explicitly install dev group with --group dev - Add pdm list command for debugging to see what's installed - This should resolve the missing ruff and other dev tools in CI * test binary data --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 8440abb commit 0c43ebb

File tree

5 files changed

+415
-223
lines changed

5 files changed

+415
-223
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
push:
7+
branches: [ main, master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
# Quick checks for PRs - runs first and fast
12+
quick-checks:
13+
if: github.event_name == 'pull_request'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Install PDM
25+
uses: pdm-project/setup-pdm@v3
26+
with:
27+
python-version: "3.12"
28+
29+
- name: Install dependencies
30+
run: |
31+
pdm sync --group dev
32+
pdm list
33+
34+
- name: Run Ruff check
35+
run: pdm run ruff check
36+
37+
- name: Run Black check
38+
run: pdm run black --check .
39+
40+
- name: Run tests (excluding OpenAI API test)
41+
run: |
42+
INFERENCE_API_TOKEN=dummy_token pdm run pytest -k "not test_receipt_analysis_with_chat"
43+
env:
44+
INFERENCE_API_TOKEN: dummy_token
45+
46+
# Comprehensive testing and quality checks
47+
test:
48+
if: github.event_name == 'workflow_dispatch'
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
python-version: ["3.12"]
53+
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: Set up Python ${{ matrix.python-version }}
59+
uses: actions/setup-python@v4
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
63+
- name: Install PDM
64+
uses: pdm-project/setup-pdm@v3
65+
with:
66+
python-version: ${{ matrix.python-version }}
67+
68+
- name: Cache PDM dependencies
69+
uses: actions/cache@v3
70+
with:
71+
path: |
72+
.pdm.toml
73+
.venv
74+
key: ${{ runner.os }}-pdm-${{ hashFiles('**/pdm.lock') }}
75+
restore-keys: |
76+
${{ runner.os }}-pdm-
77+
78+
- name: Install dependencies
79+
run: |
80+
pdm sync --group dev
81+
pdm list
82+
83+
- name: Run tests with coverage
84+
run: |
85+
INFERENCE_API_TOKEN=dummy_token pdm run pytest --cov=src --cov-report=xml --cov-report=term-missing
86+
env:
87+
INFERENCE_API_TOKEN: dummy_token
88+
89+
- name: Upload coverage to Codecov
90+
uses: codecov/codecov-action@v3
91+
with:
92+
file: ./coverage.xml
93+
fail_ci_if_error: false
94+
continue-on-error: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ cython_debug/
164164
**/*.ipynb
165165
*.jpg
166166
*.png
167+
!bin/*.jpg
167168
bill.env
168169
bin/export-tokens.sh
169170
bin/docker-up.sh

bin/20241128_183627.jpg

3.14 MB
Loading

0 commit comments

Comments
 (0)