julien-duponchelle/python-mysql-replication

add code coverage test

Closed this issue · 3 comments

name: Python Coverage

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Check out code
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Run coverage
      run: |
        coverage run -m unittest discover
        coverage xml

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        file: ./coverage.xml

create coverage test github actions
@BORA040126

name: Python Coverage and Smokeshow Test

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Check out code
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Run coverage
      run: |
        coverage run -m unittest discover
        coverage html

    - name: Install smokeshow
      run: |
        pip install smokeshow

    - name: Host and test with smokeshow
      run: |
        smokeshow --serve htmlcov/

replace Codecov to smokeshow
@BORA040126

name: Python Coverage

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Check out code
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Run coverage
      run: |
        coverage run -m unittest discover
        coverage html

  - run: smokeshow upload cli/htmlcov
    env:
      SMOKESHOW_GITHUB_STATUS_DESCRIPTION: CLI Coverage {coverage-percentage}
      SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50
      SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}

Great job. This will help us remove dead codes.