diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f947124..86f5d69 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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" \ No newline at end of file + - name: run ruff with autofix + run: UV_VENV=.venv uv run -- ruff check . --fix \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9b2ace..e8aa2ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,4 +4,4 @@ repos: hooks: - id: ruff args: [--fix] - - id: ruff-format + - id: ruff-format \ No newline at end of file diff --git a/README.md b/README.md index b4623f9..5884a85 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file +python -m pre_commit run --all-files +>>>>>>> c2e78f81458663ba5834fa5b4731ef2b58bd57be