|
75 | 75 | - name: "Check out repository code" |
76 | 76 | uses: "actions/checkout@v4" |
77 | 77 | - name: "Setup environment" |
78 | | - run: "pip install ruff==0.5.0" |
| 78 | + run: "pip install ruff==0.7.1" |
79 | 79 | - name: "Linting: ruff check" |
80 | 80 | run: "ruff check ." |
81 | 81 | - name: "Linting: ruff format" |
@@ -142,12 +142,31 @@ jobs: |
142 | 142 | run: | |
143 | 143 | pipx install poetry |
144 | 144 | poetry config virtualenvs.prefer-active-python true |
145 | | - pip install invoke toml |
| 145 | + pip install invoke toml codecov |
146 | 146 | - name: "Install Package" |
147 | 147 | run: "poetry install --all-extras" |
148 | 148 | - name: "Mypy Tests" |
149 | 149 | run: "poetry run mypy --show-error-codes infrahub_sdk/" |
150 | 150 | # - name: "Pylint Tests" |
151 | 151 | # run: "poetry run pylint infrahub_sdk/" |
152 | 152 | - name: "Unit Tests" |
153 | | - run: "poetry run pytest tests/unit/" |
| 153 | + run: "poetry run pytest --cov infrahub_sdk tests/unit/" |
| 154 | + - name: "Upload coverage to Codecov" |
| 155 | + run: | |
| 156 | + codecov --flags python-${{ matrix.python-version }} |
| 157 | + env: |
| 158 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 159 | + |
| 160 | + # The pytest-cov plugin doesn't quite work with content that is |
| 161 | + # auto-imported by our own infrahub pytest plugin, this workaround |
| 162 | + # reports the missing lines |
| 163 | + - name: "Report coverage for pytest-plugin" |
| 164 | + if: matrix.python-version == '3.12' |
| 165 | + run: | |
| 166 | + source $(poetry env info --path)/bin/activate |
| 167 | + coverage run --source=infrahub_sdk -m pytest tests/unit/pytest_plugin |
| 168 | + coverage report -m |
| 169 | + coverage xml |
| 170 | + codecov --flags python-filler-${{ matrix.python-version }} |
| 171 | + env: |
| 172 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments