File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : PR Unit Tests
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - develop
7+ - master # Add any other branches where you want to enforce tests
8+
9+ jobs :
10+ test :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout Repository
15+ uses : actions/checkout@v4
16+
17+ - name : Set up Python
18+ uses : actions/setup-python@v4
19+ with :
20+ python-version : " 3.12" # Change this to match your setup
21+
22+ - name : Install Dependencies
23+ run : |
24+ python -m pip install --upgrade pip
25+ poetry install
26+ pip install pytest
27+
28+ - name : Run Unit Tests
29+ run : pytest tests/
30+
31+ - name : Verify Tests Passed
32+ if : ${{ success() }}
33+ run : echo "All tests passed! Pull request is allowed."
34+
35+ - name : Fail PR on Test Failure
36+ if : ${{ failure() }}
37+ run : exit 1 # This ensures the PR cannot be merged if tests fail
You can’t perform that action at this time.
0 commit comments