| 1 | name: Python package |
| 2 | on: |
| 3 | push: |
| 4 | branches: ["main"] |
| 5 | pull_request: |
| 6 | branches: ["main"] |
| 7 | permissions: |
| 8 | contents: read |
| 9 | jobs: |
| 10 | build: |
| 11 | runs-on: ubuntu-latest |
| 12 | strategy: |
| 13 | fail-fast: false |
| 14 | matrix: |
| 15 | python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 16 | steps: |
| 17 | - uses: actions/checkout@v4 |
| 18 | - name: Set up Python ${{ matrix.python-version }} |
| 19 | uses: actions/setup-python@v5 |
| 20 | with: |
| 21 | python-version: ${{ matrix.python-version }} |
| 22 | - name: Install dependencies |
| 23 | run: | |
| 24 | python -m pip install --upgrade pip |
| 25 | python -m pip install flake8 pytest |
| 26 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 27 | - name: Lint with flake8 |
| 28 | run: | |
| 29 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 30 | - name: Test with pytest |
| 31 | run: pytest |