pytest-cov icon indicating copy to clipboard operation
pytest-cov copied to clipboard

Package takes a while to run in GitHub workflow CI

Open nh916 opened this issue 1 year ago • 1 comments

Description

We are using the pytest-cov within our project in our GitHub workflow to check that our tests cover at least 90% of our code, and I noticed that for some reason this workflow takes the longest to complete, and sometimes takes over an hour to finish. I am not sure if this is something I am doing wrong, the package is slow, or GitHub workflow is just slow. Our project does have over 150 tests as well, not sure if that is an issue or not. When running the package locally it is pretty fast. Please let me know your thoughts when possible, I am trying to optimize the GitHub workflow.

# use pytest-cov to see what percentage of the code is being covered by tests
# WARNING: this workflow will fail if any of the tests within it fail

name: Test Coverage

on:
  push:
    branches:
      - main
      - develop
  pull_request:
    branches:
      - main
      - develop

jobs:
  test-coverage:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.11]

    steps:
      - uses: actions/checkout@v2

      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.11

      - name: upgrade pip
        run: pip install --upgrade pip

      - name: Install CRIPT Python SDK
        run: pip install -e .

      - name: Install requirements_dev.txt
        run: pip install -r requirements_dev.txt

      - name: Test Coverage
        run: pytest --cov --cov-fail-under=90

nh916 avatar Jun 20 '23 20:06 nh916