Merge pull request #60 from Abdullah0297445/patch-1 #352
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Test Package | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
pull_request: | |
branches: | |
- dev | |
- master | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install -e .[dev,test] | |
- name: Lint package | |
run: mypy . | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install -e .[dev] | |
- name: Run pre-commit | |
run: pre-commit run --show-diff-on-failure --color=always --all-files | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
pydantic-version: ["1.10.*", "2.*"] | |
services: | |
postgres: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: pass | |
POSTGRES_DB: test_db | |
ports: | |
- 5432:5432 | |
mariadb: | |
image: mariadb:11-jammy | |
env: | |
MARIADB_DATABASE: test_db | |
MYSQL_ROOT_PASSWORD: pass | |
ports: | |
- 3306:3306 | |
env: | |
POSTGRES_DSN: postgresql://postgres:[email protected]:5432/test_db | |
MYSQL_DSN: mysql://root:[email protected]:3306/test_db | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt update && sudo apt install -qy python3-dev default-libmysqlclient-dev build-essential | |
python -m pip install --upgrade pip | |
python -m pip install -e .[dev,test,ci] | |
- name: Install Pydantic ${{ matrix.pydantic-version }} | |
run: python -m pip install "pydantic==${{ matrix.pydantic-version }}" | |
- name: Test package | |
run: pytest |