|
1 | 1 | name: tests |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | branches: |
6 | 5 | - "main" |
7 | 6 | pull_request: |
8 | 7 | branches: |
9 | 8 | - "main" |
10 | | - |
11 | 9 | jobs: |
12 | 10 | tests: |
13 | 11 | runs-on: ubuntu-latest |
14 | 12 | steps: |
15 | | - #---------------------------------------------- |
16 | | - # check-out repo and set-up python |
17 | | - #---------------------------------------------- |
18 | | - - uses: actions/checkout@v2 |
19 | | - - uses: actions/setup-python@v2 |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Install uv |
| 15 | + uses: astral-sh/setup-uv@v5 |
| 16 | + - name: "Set up Python" |
| 17 | + uses: actions/setup-python@v5 |
20 | 18 | with: |
21 | | - python-version: 3.12 |
22 | | - #---------------------------------------------- |
23 | | - # ----- install & configure poetry ----- |
24 | | - #---------------------------------------------- |
25 | | - - name: Install Poetry |
26 | | - uses: snok/install-poetry@v1 |
| 19 | + python-version-file: "pyproject.toml" |
| 20 | + - name: Restore uv cache |
| 21 | + uses: actions/cache@v4 |
27 | 22 | with: |
28 | | - virtualenvs-create: true |
29 | | - virtualenvs-in-project: true |
30 | | - #---------------------------------------------- |
31 | | - # load cached venv if cache exists |
32 | | - #---------------------------------------------- |
33 | | - - name: Load cached venv |
34 | | - id: cached-poetry-dependencies |
35 | | - uses: actions/cache@v2 |
36 | | - with: |
37 | | - path: .venv |
38 | | - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} |
39 | | - #---------------------------------------------- |
40 | | - # install dependencies if cache does not exist |
41 | | - #---------------------------------------------- |
42 | | - - name: Install dependencies |
43 | | - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
44 | | - run: poetry install --no-interaction --no-root |
45 | | - #---------------------------------------------- |
46 | | - # install your root project, if required |
47 | | - #---------------------------------------------- |
48 | | - - name: Install library |
49 | | - run: poetry install --no-interaction |
50 | | - #---------------------------------------------- |
51 | | - # run test suite and output coverage file |
52 | | - #---------------------------------------------- |
| 23 | + path: /tmp/.uv-cache |
| 24 | + key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} |
| 25 | + restore-keys: | |
| 26 | + uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} |
| 27 | + uv-${{ runner.os }} |
| 28 | + - name: Install the project |
| 29 | + run: uv sync --all-extras --dev |
53 | 30 | - name: Test with pytest |
54 | | - run: poetry run pytest |
| 31 | + run: uv run pytest |
0 commit comments