Skip to content

Commit 4c30fb0

Browse files
authored
Merge pull request #1 from breedx/ezequiel-advanced-test
Ezequiel advanced test
2 parents ff50226 + c20012a commit 4c30fb0

19 files changed

Lines changed: 1747 additions & 750 deletions

.github/workflows/tests.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Test Suite
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.11', '3.12']
15+
environment: [dev, stage]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements.txt
29+
30+
- name: Run tests with pytest
31+
env:
32+
API_ENV: ${{ matrix.environment }}
33+
JWT_SECRET: test_secret_for_ci
34+
run: |
35+
pytest -v \
36+
--cov=app \
37+
--cov-report=term-missing \
38+
--cov-report=xml \
39+
--junitxml=junit.xml \
40+
-n auto
41+
42+
- name: Upload coverage reports
43+
uses: codecov/codecov-action@v3
44+
with:
45+
file: ./coverage.xml
46+
flags: unittests
47+
name: codecov-${{ matrix.python-version }}-${{ matrix.environment }}
48+
49+
- name: Upload test results
50+
if: always()
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: test-results-${{ matrix.python-version }}-${{ matrix.environment }}
54+
path: junit.xml
55+
56+
rust-tests:
57+
runs-on: ubuntu-latest
58+
needs: test
59+
steps:
60+
- uses: actions/checkout@v3
61+
62+
- name: Setup Rust
63+
uses: actions-rs/toolchain@v1
64+
with:
65+
toolchain: stable
66+
override: true
67+
68+
- name: Cache cargo registry
69+
uses: actions/cache@v3
70+
with:
71+
path: ~/.cargo/registry
72+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
73+
74+
- name: Cache cargo build
75+
uses: actions/cache@v3
76+
with:
77+
path: rust_tests/target
78+
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
79+
80+
- name: Setup Python and start API
81+
uses: actions/setup-python@v4
82+
with:
83+
python-version: '3.11'
84+
85+
- name: Install Python dependencies and start API
86+
run: |
87+
python -m pip install --upgrade pip
88+
pip install -r requirements.txt
89+
export API_ENV=dev
90+
export JWT_SECRET=test_secret_for_rust_tests
91+
uvicorn app.main:app --host 0.0.0.0 --port 8000 &
92+
sleep 5 # Wait for API to start
93+
94+
- name: Run Rust integration tests
95+
working-directory: rust_tests
96+
run: cargo test --verbose
97+
98+
- name: Upload Rust test results
99+
if: always()
100+
uses: actions/upload-artifact@v3
101+
with:
102+
name: rust-test-results
103+
path: rust_tests/target/debug/deps/*.xml

.gitignore

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ venv/
88
env/
99
ENV/
1010
.venv
11-
12-
# pytest
11+
pip-log.txt
12+
pip-delete-this-directory.txt
1313
.pytest_cache/
1414
.coverage
1515
htmlcov/
1616
*.cover
17+
.hypothesis/
18+
19+
# Rust
20+
rust_tests/target/
21+
rust_tests/Cargo.lock
22+
**/*.rs.bk
1723

1824
# IDE
1925
.vscode/
@@ -26,9 +32,7 @@ htmlcov/
2632
.DS_Store
2733
Thumbs.db
2834

29-
# Environment
30-
.env
31-
*.log
32-
33-
# Internal documentation (not for candidates)
34-
BUGS_REFERENCE.md
35+
# Test outputs
36+
junit.xml
37+
coverage.xml
38+
.coverage.*

0 commit comments

Comments
 (0)