-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (111 loc) · 4.82 KB
/
coderipple-ci.yaml
File metadata and controls
132 lines (111 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Run coderipple tests and upload coverage
# Updated CI/CD pipeline with dependency fixes to achieve 100% test success rate
# Key additions: strands-agents, boto3, markdown-it-py, pytest
# These dependencies resolve import errors and module detection issues
on:
push
jobs:
test_coderipple: # Renamed job for clarity, indicating it tests 'coderipple'
name: Run coderipple tests and collect coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Validate Python version
run: |
echo "Validating Python version for CodeRipple compatibility..."
python scripts/validate_python_version.py
- name: Install dependencies for coderipple
run: |
# Upgrade pip to latest version
pip install --upgrade pip
# Install core dependencies that resolve test failures
pip install strands-agents boto3 markdown-it-py pytest pytest-cov
# Install application-specific dependencies for 'coderipple' from its requirements.txt
# This now explicitly points to coderipple/requirements.txt
if [ -f coderipple/requirements.txt ]; then
pip install -r coderipple/requirements.txt
else
echo "Error: coderipple/requirements.txt not found. Please ensure it exists."
exit 1 # Fail the job if requirements.txt is missing
fi
- name: Add coderipple/src to Python path
# This is crucial so that Python can find modules from coderipple/src
# when running tests from the coderipple directory.
run: |
echo "PYTHONPATH=$GITHUB_WORKSPACE/coderipple/src:$PYTHONPATH" >> $GITHUB_ENV
- name: Run coderipple tests
# Navigate to the 'coderipple' directory where its tests reside.
# --cov=src tells pytest-cov to measure coverage specifically for the 'src' directory
# within the current working directory ('coderipple').
run: |
cd coderipple
pytest --cov=src --cov-branch --cov-report=xml
- name: Upload coderipple results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
# The coverage XML report will be generated inside the 'coderipple' directory
# because pytest was run from there.
files: ./coderipple/coverage.xml
# A helpful flag for Codecov when dealing with sub-modules
# It tells Codecov to apply coverage to files relative to the 'coderipple' directory
# rather than the root of the repo.
flags: coderipple
test_lambda: # New job to test AWS Lambda functions
name: Run AWS Lambda tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install lambda dependencies
run: |
# Upgrade pip to latest version
pip install --upgrade pip
# Install core dependencies that resolve test failures
pip install strands-agents boto3 markdown-it-py pytest pytest-cov
# First install main coderipple package dependencies
if [ -f coderipple/requirements.txt ]; then
pip install -r coderipple/requirements.txt
else
echo "Error: coderipple/requirements.txt not found. Please ensure it exists."
exit 1
fi
# Install main coderipple package in editable mode
pip install -e coderipple/
# Install lambda orchestrator package in editable mode
if [ -f aws/lambda_orchestrator/requirements.txt ]; then
pip install -r aws/lambda_orchestrator/requirements.txt
pip install -e aws/lambda_orchestrator/
else
echo "Error: aws/lambda_orchestrator/requirements.txt not found. Please ensure it exists."
exit 1
fi
- name: Run lambda tests with coverage
env:
# Mock AWS credentials for testing
AWS_ACCESS_KEY_ID: test-key-id
AWS_SECRET_ACCESS_KEY: test-secret-key
AWS_DEFAULT_REGION: us-east-1
run: |
cd aws/lambda_orchestrator
# Run tests with coverage on lambda_handler.py
pytest tests/ --cov=lambda_handler --cov-branch --cov-report=xml
- name: Upload lambda results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./aws/lambda_orchestrator/coverage.xml
flags: lambda