ci: simplify to single Python version (3.13) #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') | |
| " |