Merge pull request #13 from nasa/build/switch-actions-to-uv #2
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
| # A reusable workflow to build and run the unit test suite | |
| # | |
| # This workflow will install Python dependencies, run tests, | |
| # and report test results and code coverage as artifacts. It will | |
| # be called by the workflow that run tests against new PRs and as | |
| # a first step in the workflow that publishes new Docker images. | |
| name: Unit Tests | |
| on: | |
| push: | |
| workflow_dispatch: | |
| env: | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Retrieve repository | |
| uses: actions/checkout@v6 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: uv sync --extra dev --extra harmony --frozen | |
| - name: Run linting | |
| run: | | |
| uv run ruff check casper | |
| - name: Run tests and collect coverage | |
| run: uv run pytest --cov=casper --cov-report=xml tests/unit | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| flags: unittests |