stvnksslr/dataslate-parser

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
# file: .github/workflows/build.yaml
name: Build

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main
    tags-ignore:
      - "*.*"

env:
  PYTHON_VERSION: "3.12"
  POETRY_VERSION: "1.8.3"

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      #----------------------------------------------
      #       check-out repo and set-up python
      #----------------------------------------------
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Set up python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PYTHON_VERSION }}
      #----------------------------------------------
      #  -----  install & configure poetry  -----
      #----------------------------------------------
      - name: Install Poetry
        uses: snok/install-poetry@v1.4.1
        with:
          version: ${{ env.POETRY_VERSION }}
          virtualenvs-create: true
          virtualenvs-in-project: true
      #----------------------------------------------
      #       load cached venv if cache exists
      #----------------------------------------------
      - name: Load cached venv
        id: cached-poetry-dependencies
        uses: actions/cache@v4
        with:
          path: .venv
          key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
      #----------------------------------------------
      # install dependencies if cache does not exist
      #----------------------------------------------
      - name: Install dependencies
        if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
        run: poetry install
      #----------------------------------------------
      #              run formatter
      #----------------------------------------------
      - name: Run formatter
        run: poetry run ruff format . --check
      #----------------------------------------------
      #              run linter
      #----------------------------------------------
      - name: Run linters
        run: poetry run ruff check .
      #----------------------------------------------
      #              run type check
      #----------------------------------------------
      - name: Run type check
        run: poetry run mypy src
      #----------------------------------------------
      #              run test suite
      #----------------------------------------------
      - name: Run tests
        run: poetry run pytest --cov