/ .github / workflows / ci.yml
ci.yml
 1  name: CI
 2  
 3  on:
 4    push:
 5      branches: [main]
 6    pull_request:
 7      branches: [main]
 8  
 9  permissions:
10    contents: read
11  
12  jobs:
13    test:
14      runs-on: ubuntu-latest
15      strategy:
16        matrix:
17          python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
18  
19      steps:
20        - uses: actions/checkout@v4
21  
22        - name: Set up Python ${{ matrix.python-version }}
23          uses: actions/setup-python@v5
24          with:
25            python-version: ${{ matrix.python-version }}
26  
27        - name: Install dependencies
28          run: |
29            python -m pip install --upgrade pip
30            pip install -e ".[dev]"
31  
32        - name: Lint with ruff
33          run: ruff check src/ tests/
34  
35        - name: Type check with mypy
36          run: mypy src/argus_ai/ --ignore-missing-imports
37  
38        - name: Run tests
39          run: pytest tests/ -v --tb=short --cov=argus_ai --cov-report=term-missing
40  
41    publish:
42      needs: test
43      runs-on: ubuntu-latest
44      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
45  
46      permissions:
47        id-token: write
48  
49      steps:
50        - uses: actions/checkout@v4
51  
52        - name: Set up Python
53          uses: actions/setup-python@v5
54          with:
55            python-version: "3.12"
56  
57        - name: Install build tools
58          run: pip install build
59  
60        - name: Build package
61          run: python -m build
62  
63        - name: Publish to PyPI
64          uses: pypa/gh-action-pypi-publish@release/v1