CI #60
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: | |
| pull_request: | |
| branches: | |
| - main | |
| - release/** | |
| schedule: | |
| - cron: "13 3 * * *" | |
| workflow_dispatch: {} | |
| jobs: | |
| linters: | |
| name: Linting and static analysis | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 # usually 1-2, rarely 3 mins (because of installations) | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - run: pip install --group dev -e . | |
| - run: pre-commit run --all-files | |
| - run: mypy kmock --strict | |
| unit-tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 # usually 2-3 mins | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install --group dev -e . | |
| - run: coverage run --branch --source=kmock -m pytest --color=yes --timeout=2 | |
| - run: coverage xml | |
| - name: Publish coverage to Coveralls.io | |
| if: success() | |
| run: coveralls --service=github | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.github_token }} | |
| continue-on-error: true | |
| - name: Publish coverage to CodeCov.io | |
| uses: codecov/codecov-action@v5 | |
| if: success() | |
| env: | |
| PYTHON: ${{ matrix.python-version }} | |
| with: | |
| flags: unit | |
| env_vars: PYTHON | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| continue-on-error: true | |
| # No coverage: PyPy performs extremely poorly with tracing/coverage (13 mins vs. 3 mins). | |
| # Extra time: 2-3 mins for building the dependencies (since no binary wheels are available). | |
| # Extra time: PyPy is good with JIT for repetitive code; tests are too unique for JIT. | |
| pypy-tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ "pypy-3.10", "pypy-3.11" ] | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install --upgrade pip wheel setuptools | |
| - run: pip install --group dev -e . | |
| - run: pytest --color=yes --timeout=2 | |
| coveralls-finish: | |
| name: Finalize coveralls.io | |
| needs: [unit-tests, pypy-tests] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| - run: pip install coveralls | |
| - run: coveralls --service=github --finish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.github_token }} | |
| continue-on-error: true |