Skip to content

Commit 6b0cf40

Browse files
committed
update check workflow
1 parent 1f46d4a commit 6b0cf40

1 file changed

Lines changed: 52 additions & 117 deletions

File tree

.github/workflows/lint-and-test.yml

Lines changed: 52 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -13,127 +13,62 @@ env:
1313
COUNTRY_CODE: ${{ secrets.COUNTRY_CODE }}
1414

1515
jobs:
16-
ruff:
16+
check:
1717
runs-on: ubuntu-latest
18-
container:
19-
image: python:3.12
20-
steps:
21-
- name: Check out code
22-
uses: actions/checkout@v4
23-
- name: Install dependencies
24-
run: pip install ruff
25-
- name: Check code errors
26-
run: ruff check --output-format=github .
27-
28-
mypy:
29-
runs-on: ubuntu-latest
30-
container:
31-
image: python:3.12
32-
steps:
33-
- name: Check out code
34-
uses: actions/checkout@v4
35-
- name: Install dependencies
36-
run: pip install mypy
37-
- name: Check code errors
38-
run: mypy amazon_paapi
39-
40-
test-py37:
41-
runs-on: ubuntu-latest
42-
needs: [test-py38]
43-
container:
44-
image: python:3.7
45-
steps:
46-
- name: Check out code
47-
uses: actions/checkout@v4
48-
- name: Install dependencies
49-
run: pip install -e . && pip install pytest
50-
- name: Run tests
51-
run: python -m pytest
52-
53-
test-py38:
54-
runs-on: ubuntu-latest
55-
needs: [test-py39]
56-
container:
57-
image: python:3.8
58-
steps:
59-
- name: Check out code
60-
uses: actions/checkout@v4
61-
- name: Install dependencies
62-
run: pip install -e . && pip install pytest
63-
- name: Run tests
64-
run: python -m pytest
65-
66-
test-py39:
67-
runs-on: ubuntu-latest
68-
needs: [test-py310]
69-
container:
70-
image: python:3.9
71-
steps:
72-
- name: Check out code
73-
uses: actions/checkout@v4
74-
- name: Install dependencies
75-
run: pip install -e . && pip install pytest
76-
- name: Run tests
77-
run: python -m pytest
78-
79-
test-py310:
80-
runs-on: ubuntu-latest
81-
needs: [test-py311]
82-
container:
83-
image: python:3.10
84-
steps:
85-
- name: Check out code
86-
uses: actions/checkout@v4
87-
- name: Install dependencies
88-
run: pip install -e . && pip install pytest
89-
- name: Run tests
90-
run: python -m pytest
91-
92-
test-py311:
93-
runs-on: ubuntu-latest
94-
needs: [test-py312]
95-
container:
96-
image: python:3.11
18+
9719
steps:
98-
- name: Check out code
99-
uses: actions/checkout@v4
100-
- name: Install dependencies
101-
run: pip install -e . && pip install pytest
102-
- name: Run tests
103-
run: python -m pytest
20+
- uses: actions/checkout@v5
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v6
24+
with:
25+
python-version: "3.13"
10426

27+
- name: Install UV
28+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
10529

106-
test-py312:
107-
runs-on: ubuntu-latest
108-
container:
109-
image: python:3.12
110-
steps:
111-
- name: Check out code
112-
uses: actions/checkout@v4
113-
- name: Install dependencies
114-
run: pip install -e . && pip install coverage pytest
115-
- name: Run tests
116-
run: coverage run -m pytest && coverage xml && coverage report
117-
- name: Save code coverage file
118-
uses: actions/upload-artifact@v4
119-
with:
120-
name: coverage
121-
path: coverage.xml
122-
123-
sonar:
30+
- name: Cache UV dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/uv
34+
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
35+
restore-keys: |
36+
${{ runner.os }}-uv-
37+
38+
- name: Cache pre-commit
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.cache/pre-commit
42+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pre-commit-
45+
46+
- name: Run all checks
47+
run: |
48+
SKIP=test uv run pre-commit run --all-files
49+
50+
test:
12451
runs-on: ubuntu-latest
125-
needs: [test-py312]
52+
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
python-version:
57+
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
58+
12659
steps:
127-
- name: Check out code
128-
uses: actions/checkout@v4
129-
with:
130-
fetch-depth: 0
131-
- name: Download a single artifact
132-
uses: actions/download-artifact@v4
60+
- uses: actions/checkout@v5
61+
62+
- name: Install UV
63+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
64+
65+
- name: Cache UV dependencies
66+
uses: actions/cache@v4
13367
with:
134-
name: coverage
135-
- name: Check code errors
136-
uses: SonarSource/sonarcloud-github-action@master
137-
env:
138-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68+
path: ~/.cache/uv
69+
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
70+
restore-keys: |
71+
${{ runner.os }}-uv-py${{ matrix.python-version }}-
72+
73+
- name: Run tests
74+
run: uv run --python "${{ matrix.python-version }}" pytest -rs

0 commit comments

Comments
 (0)