ducminh-phan/reformat-gherkin

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Test

on:
  - push
  - pull_request

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

    runs-on: ${{ matrix.os }}

    env:
      poetry_version: 1.1.14

    defaults:
      run:
        shell: bash

    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Cache poetry
        uses: actions/cache@v3
        if: matrix.os != 'windows-latest'
        with:
          path: ~/.local
          key: poetry-${{ matrix.python-version }}-${{ matrix.os }}-${{ env.poetry_version }}

      - name: Install Poetry
        uses: snok/install-poetry@v1
        with:
          version: ${{ env.poetry_version }}
          virtualenvs-create: true
          virtualenvs-in-project: true

      - name: Cache dependencies
        uses: actions/cache@v3
        with:
          path: .venv
          key: deps-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('poetry.lock') }}

      - name: Install dependencies
        run: poetry install

      - name: Run tests
        run: poetry run pytest --cov

      - name: Coveralls
        uses: AndreMiras/coveralls-python-action@develop
        if: matrix.os == 'ubuntu-latest'
        with:
          parallel: true
          flag-name: test

  coveralls:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - name: Coveralls finished
        uses: AndreMiras/coveralls-python-action@develop
        with:
          parallel-finished: true