boromir674/semantic-version-check

View on GitHub
.github/workflows/test.yaml

Summary

Maintainability
Test Coverage
name: Test Python Package
# Stress Test against different platforms and python versions

on:
  push:
    branches:
      - master
      - dev
      - ci
  pull_request:
    branches:
      - master
      - dev
    tags:
      - v*


jobs:
  test_suite:
    runs-on: ${{ matrix.platform }}
    strategy:
      matrix:
        platform: [ubuntu-latest, macos-latest]
        python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install tox tox-gh-actions

    - name: Do Lint Checking
      run: tox -e lint -vv -s false

    - name: Do Type Checking
      run: tox -e type -vv -s false

    - name: Check for compliance with Python Best Practices
      run: tox -e check -vv -s false

    - name: Specify current package version to assist build tool
      run: echo "PKG_VERSION=$(python scripts/parse_version.py)" >> $GITHUB_ENV

    - name: Run Test Suite
      run: tox -vv -s false
      env:
        PLATFORM: ${{ matrix.platform }}

    - name: Install coverage.py
      run: python -m pip install coverage

    - name: Aggregate Test Suite Coverage Data
      run: |
        python -m pip install coverage
        tox -e coverage --sitepackages -vv -s false

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        directory: ./.tox/
        env_vars: OS,PYTHON
        fail_ci_if_error: true
        files: ./.tox/coverage.xml
        flags: unittests
        name: codecov-umbrella
        verbose: true