Skip to content

Commit

Permalink
👷 Refactor CI workflow to use setup-uv action
Browse files Browse the repository at this point in the history
  • Loading branch information
yezz123 committed Apr 20, 2024
1 parent ce10b43 commit d805009
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: pip install -e .[lint]
- uses: pre-commit/[email protected]

- name: setup uv
uses: yezz123/setup-uv@v4
with:
extra_args: --all-files --verbose
- name: Run mypy
run: bash scripts/lint.sh
uv-venv: ".venv"

- name: Install Dependencies
run: uv pip install -r requirements/pyproject.txt && uv pip install -r requirements/linting.txt

- name: Run Pre-commit
run: bash scripts/format.sh

tests:

Expand All @@ -51,17 +55,27 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: setup UV
uses: yezz123/setup-uv@v4
with:
uv-venv: ".venv"

- name: Install Dependencies
run: pip install -e .[test]
run: uv pip install -r requirements/pyproject.txt && uv pip install -r requirements/testing.txt

- name: Freeze Dependencies
run: pip freeze
run: uv pip freeze

- name: Test with pytest
- name: Test with pytest - ${{ matrix.os }} - py${{ matrix.python-version }}
run: bash scripts/test.sh
env:
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps

- name: Upload coverage
- 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
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=fastapi_class --cov=tests --cov-report=term-missing --cov-fail-under=80
pytest --cov=fastapi_class --cov-report=xml

0 comments on commit d805009

Please sign in to comment.