Skip to content

Add schema validation to pre-commit #57

Add schema validation to pre-commit

Add schema validation to pre-commit #57

Workflow file for this run

---
name: CI
# Docs on poetry runner for github actions:
# https://github.com/marketplace/actions/install-poetry-action
on:
pull_request:
push:
branches: [main]
paths:
- dumbpw/**
- tests/**
- pyproject.toml
- poetry.lock
- .pre-commit-config.yaml
- .github/workflows/integration.yaml
jobs:
lint:
runs-on: ubuntu-latest
steps:
# ----------------------------------------------
# check-out repo and set-up python
# ----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# ----------------------------------------------
# build virtual environment and install
# ----------------------------------------------
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies if cached venv not found
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install module
run: poetry install --no-interaction
- name: Install pre-commit
run: pip install pre-commit
- name: cache
uses: actions/cache@v2
with:
key: pre-commit-dot-cache-{{ checksum ".pre-commit-config.yaml" }}
path: ~/.cache/pre-commit
- name: Pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure
test:
needs: lint
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
# ----------------------------------------------
# check-out repo and set-up python
# ----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# ----------------------------------------------
# build virtual environment and install
# ----------------------------------------------
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies if cached venv not found
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install module
run: poetry install --no-interaction
# ----------------------------------------------
# run tests
# ----------------------------------------------
- name: Run tests
run: poetry run pytest