Merge pull request #24 from tarun-e/test-config #15
This file contains hidden or 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: Notebook Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test]" | |
| - name: Run validation tests | |
| run: | | |
| pytest tests/validation/ -v --tb=short --junit-xml=validation-results.xml | tee validation-output.txt | |
| continue-on-error: true | |
| - name: Run smoke tests | |
| run: | | |
| pytest tests/examples/ -v --tb=short --junit-xml=smoke-results.xml | tee smoke-output.txt | |
| continue-on-error: true | |
| - name: Check test results | |
| run: | | |
| # Fail the workflow if any tests failed | |
| grep -q "failed" validation-output.txt && exit 1 || true | |
| grep -q "failed" smoke-output.txt && exit 1 || true | |
| exit 0 | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| validation-results.xml | |
| smoke-results.xml | |
| retention-days: 7 | |
| - name: Generate test summary | |
| if: always() | |
| run: | | |
| echo "## Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Validation Tests" >> $GITHUB_STEP_SUMMARY | |
| tail -n 1 validation-output.txt >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Smoke Tests" >> $GITHUB_STEP_SUMMARY | |
| tail -n 1 smoke-output.txt >> $GITHUB_STEP_SUMMARY |