hadialqattan/pycln

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
########[CI PIPELINE FLOW]########
# Run pre-commit:                #
#   | failure ~> stop.           #
#   | pass:                      #
#       Run tests:               #
#          | failure ~> stop.    #
#          | pass:               #
#             Upload coverage.   #
##################################
# Requiered Github secrets:      #
#   - CODECOV_TOKEN              #
##################################

name: CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  pre-commit:
    name: Pre-commit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.10"
      - uses: pre-commit/action@v3.0.0

  test:
    name: Test
    needs: pre-commit
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-20.04, windows-latest, macos-13]
        python-version: ["3.7", "3.8", "3.9", "3.10", "3.12"]

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
          architecture: x64

      - name: Install  Dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install poetry
          python -m poetry install --no-root --with=dev

      - name: Test with pytest by poetry
        run: |
          python -m poetry run pytest tests/ .github/ -vv --cov=./ --cov-report=xml

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3.1.4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          name: ${{ matrix.os }}, ${{ matrix.python-version }}
          version: v0.7.3