|
| 1 | +name: CI |
| 2 | + |
| 3 | +"on": |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - master |
| 8 | + - revamp |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - master |
| 13 | + |
| 14 | +jobs: |
| 15 | + test: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: | |
| 31 | + python -m pip install --upgrade pip |
| 32 | + pip install pdm |
| 33 | + pdm install --group :all |
| 34 | +
|
| 35 | + - name: Lint with ruff |
| 36 | + run: | |
| 37 | + pdm run ruff check . |
| 38 | +
|
| 39 | + - name: Format check with black |
| 40 | + run: | |
| 41 | + pdm run black --check . |
| 42 | +
|
| 43 | + - name: Type check with mypy |
| 44 | + run: | |
| 45 | + pdm run mypy garminconnect --ignore-missing-imports |
| 46 | +
|
| 47 | + # - name: Test with pytest |
| 48 | + # env: |
| 49 | + # GARMINTOKENS: ${{ secrets.GARMINTOKENS }} |
| 50 | + # run: | |
| 51 | + # # Use existing VCR cassettes for CI to avoid network calls |
| 52 | + # pdm run pytest tests/ -v --tb=short --vcr-record=none |
| 53 | + # continue-on-error: false |
| 54 | + |
| 55 | + # - name: Upload coverage reports |
| 56 | + # if: matrix.python-version == '3.11' |
| 57 | + # env: |
| 58 | + # GARMINTOKENS: ${{ secrets.GARMINTOKENS }} |
| 59 | + # run: | |
| 60 | + # pdm run coverage run -m pytest -v --tb=short --vcr-record=none |
| 61 | + # pdm run coverage xml |
| 62 | + # continue-on-error: true |
| 63 | + |
| 64 | + - name: Upload coverage artifact |
| 65 | + if: matrix.python-version == '3.11' |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: coverage-xml |
| 69 | + path: coverage.xml |
| 70 | + |
| 71 | + security: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Set up Python |
| 77 | + uses: actions/setup-python@v5 |
| 78 | + with: |
| 79 | + python-version: "3.11" |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + run: | |
| 83 | + python -m pip install --upgrade pip |
| 84 | + pip install bandit[toml] safety |
| 85 | +
|
| 86 | + - name: Security check with bandit |
| 87 | + run: | |
| 88 | + bandit -r garminconnect -f json -o bandit-report.json || true |
| 89 | +
|
| 90 | + - name: Safety check |
| 91 | + run: | |
| 92 | + safety check --json --output safety-report.json || true |
| 93 | + continue-on-error: true |
0 commit comments