|
1 | | -# Built from: |
2 | | -# https://docs.github.com/en/actions/guides/building-and-testing-python |
3 | | -# https://github.com/snok/install-poetry#workflows-and-tips |
4 | | - |
5 | 1 | name: Build and test |
6 | 2 |
|
7 | 3 | on: |
8 | 4 | push: |
9 | | - branches: [ main ] |
| 5 | + branches: [main] |
10 | 6 | pull_request: |
11 | | - branches: [ main ] |
| 7 | + branches: [main] |
12 | 8 |
|
13 | 9 | jobs: |
14 | 10 | lint: |
15 | 11 | runs-on: ubuntu-latest |
16 | 12 | strategy: |
17 | 13 | matrix: |
18 | | - python-version: [ '3.9' ] |
| 14 | + python-version: ["3.11"] |
19 | 15 | steps: |
20 | | - - uses: actions/checkout@v2 |
21 | | - - name: Set up Python ${{ matrix.python-version }} |
22 | | - uses: actions/setup-python@v2 |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - name: Install uv |
| 18 | + uses: astral-sh/setup-uv@v6 |
23 | 19 | with: |
24 | 20 | python-version: ${{ matrix.python-version }} |
| 21 | + enable-cache: true |
| 22 | + cache-dependency-glob: "uv.lock" |
25 | 23 | - name: Install dependencies |
26 | | - run: | |
27 | | - pip install tox |
| 24 | + run: uv sync --dev --locked |
28 | 25 | - name: Check code quality with flake8 |
29 | | - run: tox -e flake8 |
| 26 | + run: uv run tox -e flake8 |
30 | 27 |
|
31 | 28 | test: |
32 | 29 | runs-on: ubuntu-latest |
33 | 30 | strategy: |
34 | 31 | matrix: |
35 | | - python-version: [ '3.9' ] |
| 32 | + python-version: ["3.11"] |
36 | 33 |
|
37 | 34 | steps: |
38 | 35 |
|
39 | 36 | #---------------------------------------------- |
40 | 37 | # check-out repo and set-up python |
41 | 38 | #---------------------------------------------- |
42 | 39 | - name: Check out repository |
43 | | - uses: actions/checkout@v3 |
44 | | - |
45 | | - - name: Set up Python ${{ matrix.python-version }} |
46 | | - uses: actions/setup-python@v3 |
47 | | - with: |
48 | | - python-version: ${{ matrix.python-version }} |
49 | | - |
50 | | - #---------------------------------------------- |
51 | | - # install & configure poetry |
52 | | - #---------------------------------------------- |
53 | | - - name: Install Poetry |
54 | | - uses: snok/install-poetry@v1.3 |
55 | | - with: |
56 | | - virtualenvs-create: true |
57 | | - virtualenvs-in-project: true |
| 40 | + uses: actions/checkout@v4 |
58 | 41 |
|
59 | 42 | #---------------------------------------------- |
60 | | - # load cached venv if cache exists |
| 43 | + # install uv |
61 | 44 | #---------------------------------------------- |
62 | | - - name: Load cached venv |
63 | | - id: cached-poetry-dependencies |
64 | | - uses: actions/cache@v3 |
| 45 | + - name: Install uv |
| 46 | + uses: astral-sh/setup-uv@v6 |
65 | 47 | with: |
66 | | - path: .venv |
67 | | - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + enable-cache: true |
| 50 | + cache-dependency-glob: "uv.lock" |
68 | 51 |
|
69 | 52 | #---------------------------------------------- |
70 | | - # install dependencies if cache does not exist |
| 53 | + # install dependencies |
71 | 54 | #---------------------------------------------- |
72 | 55 | - name: Install dependencies |
73 | | - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
74 | | - run: poetry install --no-interaction --no-root |
75 | | - |
76 | | - #---------------------------------------------- |
77 | | - # install your root project, if required |
78 | | - #---------------------------------------------- |
79 | | - - name: Install library |
80 | | - run: poetry install --no-interaction |
| 56 | + run: uv sync --dev --locked |
81 | 57 |
|
82 | 58 | #---------------------------------------------- |
83 | 59 | # run test suite |
84 | 60 | #---------------------------------------------- |
85 | 61 | - name: Run tests |
86 | | - run: poetry run python -m unittest discover |
87 | | - |
| 62 | + run: uv run python -m unittest discover |
0 commit comments