aburrell/aacgmv2

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
# This workflow will install Python dependencies, run tests and lint with a
# variety of Python versions. For more information see:
# https://help.github.com/actions/language-and-framework-guides/
# using-python-with-github-actions

name: pytest with flake8

on: [push, pull_request]

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ["3.7", "3.8", "3.9", "3.10"]

    name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
        architecture: 'x64'

    - name: Install standard and test dependencies
      run: pip install build coverage coveralls flake8 numpy pytest

    - name: Install on Linux/Windows
      if: ${{ matrix.os != 'macos-latest' }}
      run: |
          python -m build .
          pip install -e .

    - name: Install on MacOS
      if: ${{ matrix.os == 'macos-latest' }}
      run: |
          brew reinstall gcc
          python -m build .
          pip install -e .

    - name: Test PEP8 compliance
      run: flake8 . --count --select=D,E,F,H,W --show-source --statistics

    - name: Evaluate complexity
      run: flake8 . --count --exit-zero --max-complexity=10 --statistics

    - name: Run unit and integration tests
      run: coverage run --rcfile=setup.cfg -m pytest

    - name: Publish results to coveralls upon success
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
           coverage combine
           coverage report -m
           coveralls --rcfile=setup.cfg --service=github

    - name: Upload wheels
      uses: actions/upload-artifact@v3
      with:
         path: dist/*.whl
         if-no-files-found: warn