diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2c102ce..6b80c772 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,17 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + + - name: setup uv + uses: yezz123/setup-uv@v1 + with: + uv-version: "0.1.2" + + - name: Create virtual environment + run: uv venv + - name: Install Dependencies - run: pip install -r requirements/pyproject.txt && pip install -r requirements/linting.txt + run: uv pip install -r requirements/pyproject.txt && uv pip install -r requirements/linting.txt - uses: pre-commit/action@v3.0.1 with: extra_args: --all-files --verbose @@ -49,17 +58,39 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install Dependencies - run: pip install -r requirements/pyproject.txt && pip install -r requirements/testing.txt + - name: setup UV + uses: yezz123/setup-uv@v1 + with: + uv-version: "0.1.2" - - name: Freeze Dependencies - run: pip freeze + - name: Create virtual environment + run: uv venv - - name: Test with pytest - run: bash scripts/test.sh + - name: Install Dependencies + run: uv pip install -r requirements/pyproject.txt && uv pip install -r requirements/testing.txt - - name: Upload coverage + - name: Freeze Dependencies + run: uv pip freeze + + - name: Test with pytest on Windows - Python ${{ matrix.python-version }} + if: ${{ matrix.os == 'windows' }} + run: | + .\.venv\Scripts\activate.ps1 && bash scripts/test.sh + env: + CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps + + - name: Test with pytest on POSIX - Python ${{ matrix.python-version }} + if: ${{ matrix.os != 'windows' }} + run: | + source .venv/bin/activate && bash scripts/test.sh + env: + CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps + + - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml # https://github.com/marketplace/actions/alls-green#why used for branch protection checks check: diff --git a/pyproject.toml b/pyproject.toml index 9ba59069..b691ea26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,14 +99,15 @@ known-third-party = ["pydantic", "typing_extensions", "sqlalchemy"] keep-runtime-typing = true [tool.coverage.run] -source = ["authx", "tests"] +source = ["authx"] branch = true context = '${CONTEXT}' [tool.coverage.paths] source = [ - "authx/", - "tests/", + 'authx/', + '/Users/runner/work/authx/authx/authx/', + 'D:\a\authx\authx\authx', ] [tool.coverage.report] diff --git a/scripts/test.sh b/scripts/test.sh index dad7e23a..52590618 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -6,4 +6,4 @@ set -x echo "ENV=${ENV}" export PYTHONPATH=. -pytest --cov-report=term-missing --cov-fail-under=80 +pytest --cov=authx --cov-report=xml