|
5 | 5 | branches: [ main ] |
6 | 6 | pull_request: |
7 | 7 | branches: [ main ] |
8 | | - release: |
9 | | - types: [created] |
10 | | - |
11 | 8 |
|
12 | 9 | jobs: |
13 | 10 | build: |
14 | 11 | runs-on: ubuntu-latest |
15 | 12 | strategy: |
16 | 13 | matrix: |
17 | | - python-version: [ '3.9', '3.10', '3.11', '3.12' ] |
| 14 | + python-version: [ '3.10', '3.11', '3.12', '3.13' ] |
18 | 15 | steps: |
19 | 16 | - uses: actions/checkout@v4 |
20 | | - - name: Set up Python |
21 | | - uses: actions/setup-python@v5 |
22 | | - with: |
23 | | - python-version: ${{ matrix.python-version }} |
24 | | - - name: Update pip and poetry |
25 | | - run: | |
26 | | - python -m pip install --upgrade pip |
27 | | - pip install poetry |
28 | | - - name: Cache Python dependencies |
29 | | - uses: actions/cache@v4 |
30 | | - id: cache-python |
| 17 | + |
| 18 | + - name: Install the latest version of uv |
| 19 | + uses: astral-sh/setup-uv@v6 |
31 | 20 | with: |
32 | | - path: ~/.cache/pypoetry |
33 | | - key: python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} |
34 | | - - name: Install Python dependencies |
35 | | - if: steps.cache-python.outputs.cache-hit != 'true' |
36 | | - run: poetry install |
| 21 | + version: "0.8.10" |
| 22 | + enable-cache: true |
| 23 | + |
| 24 | + - name: Install Python version |
| 25 | + run: uv python install ${{ matrix.python-version }} |
| 26 | + |
| 27 | + - name: Install the project |
| 28 | + run: uv sync |
| 29 | + |
37 | 30 | - name: Cache pre-commit |
38 | 31 | uses: actions/cache@v4 |
39 | 32 | id: cache-pre-commit |
40 | 33 | with: |
41 | 34 | path: ~/.cache/pre-commit/ |
42 | | - key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }} |
| 35 | + key: pre-commit-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} |
| 36 | + |
43 | 37 | - name: Install pre-commit |
44 | 38 | if: steps.cache-pre-commit.outputs.cache-hit != 'true' |
45 | | - run: poetry run pre-commit install --install-hooks |
| 39 | + run: uv run pre-commit install --install-hooks |
| 40 | + |
46 | 41 | - name: Run pre-commit |
47 | | - run: poetry run pre-commit run --all-files |
48 | | - - name: Run pytest |
49 | | - run: poetry run pytest |
50 | | - - uses: codecov/codecov-action@v3 |
| 42 | + run: uv run pre-commit run --all-files |
| 43 | + |
| 44 | + - name: Run tests |
| 45 | + run: uv run pytest |
| 46 | + |
| 47 | + - name: Upload coverage reports to Codecov |
| 48 | + uses: codecov/codecov-action@v3 |
51 | 49 | env: |
52 | 50 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
53 | | - |
54 | | - deploy: |
55 | | - needs: build |
56 | | - if: github.event_name == 'release' && github.event.action == 'created' |
57 | | - runs-on: ubuntu-latest |
58 | | - steps: |
59 | | - - uses: actions/checkout@v4 |
60 | | - - name: Set up Python |
61 | | - uses: actions/setup-python@v5 |
62 | | - with: |
63 | | - python-version: 3.9 |
64 | | - - name: Install dependencies |
65 | | - run: | |
66 | | - python -m pip install --upgrade pip |
67 | | - pip install poetry |
68 | | - - name: Deploy to PyPI |
69 | | - run: | |
70 | | - poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} |
71 | | - poetry build |
72 | | - poetry publish |
0 commit comments