-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI on Merge to Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Triggers when code is pushed to the main branch | ||
- ms4 | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository code | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Set up Python environment (specifically Python 3.12) | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
# Step 2.1: Set PYTHONPATH to include the root directory (or src if relevant) | ||
- name: Set PYTHONPATH | ||
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV # Adds current directory to PYTHONPATH | ||
|
||
|
||
# Step 3: Install pytest and pytest-cov for coverage | ||
- name: Install pytest and pytest-cov | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest pytest-cov | ||
# Step 4: Run pytest with coverage and generate HTML report | ||
- name: Run tests with coverage | ||
run: | | ||
pytest --cov=. --cov-report=html | ||
# Step 5: Upload coverage report as an artifact | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-report | ||
path: htmlcov # The folder where pytest-cov stores HTML reports |