Add code coverage measurement with Codecov integration #2415
Workflow file for this run
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| integration: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: integration-${{ github.ref }}-${{ matrix.python-version }}-${{ matrix.protobuf-version }} | |
| cancel-in-progress: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| protobuf-version: [proto3, proto4, proto5, proto6] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install tox | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tox==4.2.6 | |
| - name: Run unit tests | |
| run: tox -e py-${{ matrix.protobuf-version }} -- tests | |
| unit: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: unit-${{ github.ref }}-${{ matrix.python-version }} | |
| cancel-in-progress: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install tox | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tox==4.2.6 | |
| - name: Run unit tests | |
| run: tox -e py -- ydb | |
| coverage: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: coverage-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install tox | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tox==4.2.6 | |
| # sysmon (PEP 669) keeps tracer overhead low so timing-sensitive chaos | |
| # tests (which kill/restart YDB) still pass under coverage. Requires py3.12+. | |
| - name: Unit tests with coverage | |
| env: | |
| COVERAGE_CORE: sysmon | |
| run: tox -e cov -- ydb | |
| - name: Upload unit coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unit | |
| name: unit | |
| # The gate is enforced via Codecov status checks (branch protection), | |
| # so don't fail CI on transient upload errors. | |
| fail_ci_if_error: false | |
| - name: Integration tests with coverage | |
| env: | |
| COVERAGE_CORE: sysmon | |
| run: tox -e cov -- tests | |
| - name: Upload integration coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: integration | |
| name: integration | |
| fail_ci_if_error: false |