REFACTOR: Migrate from poetry to uv #21
Workflow file for this run
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: Testing | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| branches: | |
| - "main" | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit-tests: | |
| name: Run unit test suite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install requirements | |
| run: uv sync --locked --all-extras --dev | |
| - name: Run tests with coverage | |
| run: | | |
| uv run coverage run \ | |
| --source=codexa \ | |
| --omit="*/__*.py,*/test_*.py,/tmp/*" \ | |
| -m pytest | |
| uv run coverage report > coverage.txt | |
| uv run coverage html | |
| - name: Create GHA job summary | |
| if: always() | |
| run: | | |
| TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S") | |
| echo "# Codexa Unit Testing Report" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## Pytest coverage" >> $GITHUB_STEP_SUMMARY | |
| echo '```text' >> $GITHUB_STEP_SUMMARY | |
| cat coverage.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: Upload coverage files | |
| if: success() | |
| id: upload-pages | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: htmlcov/ | |
| deploy: | |
| name: Deploy coverage report | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| permissions: | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Post report URL | |
| if: success() | |
| run: | | |
| echo "Coverage report: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY |