Add GitHub Actions workflow for unit tests #11
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
name: Python Unit Tests with Debugging | |
on: | |
push: | |
branches: | |
- 315-Unittest-via-Github-actions | |
pull_request: | |
branches: | |
- 315-Unittest-via-Github-actions | |
jobs: | |
run-tests: | |
name: Run Unit Tests Across Python Versions | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
test-engine: ["PYTEST", "UNITTEST"] | |
continue-on-error: true | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Step 3: Verify Directory Structure | |
- name: Verify Directory Structure | |
run: | | |
echo "Listing files to verify directory structure:" | |
ls -R ${GITHUB_WORKSPACE} | |
# Step 4: Run Tests | |
- name: Run Tests | |
continue-on-error: true | |
run: | | |
TEST_PATH="${{ github.workspace }}/FiLiP/tests" | |
echo "Testing path: $TEST_PATH" | |
if [ "${{ matrix.test-engine }}" == "PYTEST" ]; then | |
python -m pytest $TEST_PATH/ || true; | |
else | |
python -m unittest discover --verbose $TEST_PATH "test_*.py" || true; | |
fi |