-
Notifications
You must be signed in to change notification settings - Fork 52
100 lines (84 loc) · 2.99 KB
/
Copy pathcheck.yml
File metadata and controls
100 lines (84 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Run linters and tests
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check CHANGELOG was updated
if: github.event_name == 'pull_request'
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^CHANGELOG.md$"; then
echo "✅ CHANGELOG.md was updated"
else
echo "❌ ERROR: CHANGELOG.md was not updated"
echo "Please add your changes to the CHANGELOG.md file"
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install UV
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
# Tests are owned by the test job below, so the test hook is skipped here.
- name: Run all checks
env:
SKIP: test
run: uv run --extra async pre-commit run --all-files --verbose
test:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
include:
# Only this leg has the credentials for the integration tests, so it
# is the one that can meet the coverage threshold.
- python-version: "3.13"
coverage: true
steps:
- uses: actions/checkout@v5
- name: Install UV
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
# Each version resolves to different wheels, so they cannot share one
# cache entry.
cache-suffix: py${{ matrix.python-version }}
- name: Run tests
if: ${{ !matrix.coverage }}
run: uv run --python "${{ matrix.python-version }}" --extra async pytest -rs --no-cov
- name: Run tests with coverage
if: ${{ matrix.coverage }}
env:
AFFILIATE_TAG: ${{ secrets.AFFILIATE_TAG }}
COUNTRY_CODE: ${{ secrets.COUNTRY_CODE }}
CREDENTIAL_ID: ${{ secrets.CREDENTIAL_ID }}
CREDENTIAL_SECRET: ${{ secrets.CREDENTIAL_SECRET }}
API_VERSION: ${{ secrets.API_VERSION }}
run: uv run --python "${{ matrix.python-version }}" --extra async pytest -rs --cov=amazon_creatorsapi