Baelfire18/snail_print

View on GitHub
.github/workflows/tests-and-linter.yml

Summary

Maintainability
Test Coverage
name: Tests and linter

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the "master" branch
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  test:
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.7", "3.8", "3.10"]
        poetry-version: [1.1]
        os: [ubuntu-latest, macos-latest, windows-latest]

    # The type of runner that the job will run on
    runs-on: ${{ matrix.os }}
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v3
      
      - name: Setup Python
        uses: actions/setup-python@v4.0.0
        with:
          # Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset.
          python-version: ${{ matrix.python-version }}

      - name: Install Poetry
        uses: abatilo/actions-poetry@v2.0.0
        with:
          poetry-version: ${{ matrix.poetry-version }}

      - name: Install dependencies
        run: poetry install

      # Runs a set of commands using the runners shell
      - name: Run unittest
        run: poetry run python -m unittest tests
  
  linter:

    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v3
      
      - name: Setup Python
        uses: actions/setup-python@v4.0.0
        with:
          # Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset.
          python-version: "3.10"

      - name: Install Poetry
        uses: abatilo/actions-poetry@v2.0.0
        with:
          poetry-version: 1.1

      - name: Install dependencies
        run: poetry install

      # Runs a set of commands using the runners shell
      - name: Run Linter
        run: poetry run flake8 .