Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package takes a while to run in GitHub workflow CI #599

Open
nh916 opened this issue Jun 20, 2023 · 1 comment
Open

Package takes a while to run in GitHub workflow CI #599

nh916 opened this issue Jun 20, 2023 · 1 comment

Comments

@nh916
Copy link

nh916 commented Jun 20, 2023

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
@aylusltd
Copy link

aylusltd commented Sep 21, 2023

It just hangs in windows

name: "Python Release"
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  release:
    types: [created]
jobs:
  unit-tests:
    strategy:
        matrix:
            os: [ubuntu-latest, windows-latest, macos-latest]
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v3
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.x"
      - name: Set up Node
        uses: actions/setup-node@v3
        with:
          node-version: 20
      - name: Install pypa/build
        run: >-
          python3 -m
          pip install
          build hatchling
          --user
      - name: Make VERSION
        run: python make_version.py
      - name: install self
        run: pip install -e .
      - name: Unit Tests
        run: pytest
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3.1.1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
      - name: Style Guide
        run: flake8

If you let it run it times out, but force kill and you can see the tests completed in the same 10s it takes on Mac and Ubuntu.

For example run on open source project: https://github.com/StartupOS/verinfast/actions/runs/6263214547/job/17007095128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants