Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 Add setup for uv and use uv for dependency installation #537

Merged
merged 13 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 39 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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