Skip to content
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
73 changes: 13 additions & 60 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,24 @@ name: pythonbooks

on: [push, pull_request]

env:
PYTHON_VERSION: '3.11'
UV_CACHE_DIR: ~/.cache/uv

jobs:
setup:
runs-on: ubuntu-latest
outputs:
uv-path: ${{ steps.setup-uv.outputs.uv-path }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
id: setup-uv
run: |
curl -Ls https://astral.sh/uv/install.sh | bash
echo "uv-path=$HOME/.cargo/bin" >> $GITHUB_OUTPUT

lint:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Add uv to PATH
run: echo "${{ needs.setup.outputs.uv-path }}" >> $GITHUB_PATH
- name: Install ruff
run: uv pip install ruff
- name: Run ruff fix
run: uv run ruff check . --fix


test:
name: ruff lint with fix
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Add uv to PATH
run: echo "${{ needs.setup.outputs.uv-path }}" >> $GITHUB_PATH
- name: checkout repo
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v3
- name: set up python
uses: actions/setup-python@v5
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ hashFiles('**/pyproject.toml') }}
python-version: "3.x"

- name: Install dependencies
run: uv pip install pytest

- name: Run tests
run: uv run pytest
- name: install ruff via uv
run: |
pip install uv
uv venv .venv
UV_VENV=.venv uv pip install ruff

deploy:
needs: [lint, test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- run: echo "deploy"
- name: run ruff with autofix
run: UV_VENV=.venv uv run -- ruff check . --fix
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ repos:
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- id: ruff-format
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# pythonbooks

<<<<<<< HEAD



##
- python -m pre_commit run --all-files
- pre-commit run --all-files
=======
##
pre-commit run --all-files
python -m pre_commit run --all-files
python -m pre_commit run --all-files
>>>>>>> c2e78f81458663ba5834fa5b4731ef2b58bd57be