-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (54 loc) · 1.81 KB
/
ci.yml
File metadata and controls
64 lines (54 loc) · 1.81 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pyyaml
- name: Lint with ruff
run: |
pip install ruff
ruff check amazon_ads_api/ codegen/ --select E,F,W --ignore E501,F403,F405,W291,W293,E402,F821
- name: Run unit tests
run: pytest tests/unit/ -v --tb=short
- name: Validate codegen (dry run)
run: python -m codegen.generate --dry-run
- name: Verify generated code matches specs
run: |
python -m codegen.generate
git diff --exit-code amazon_ads_api/generated/ || {
echo "Generated code is out of sync with specs!"
echo "Run 'python -m codegen.generate' and commit the results."
exit 1
}
- name: Validate all generated files syntax
run: |
python -c "
import ast, os, sys
errors = 0
for root, dirs, files in os.walk('amazon_ads_api/generated'):
for f in files:
if f.endswith('.py'):
path = os.path.join(root, f)
try:
ast.parse(open(path).read())
except SyntaxError as e:
print(f'SYNTAX ERROR: {path}: {e}')
errors += 1
if errors:
sys.exit(1)
print(f'All generated files valid')
"