mirror of https://github.com/stijndcl/didier
124 lines
3.7 KiB
YAML
124 lines
3.7 KiB
YAML
name: Python CI
|
|
|
|
on:
|
|
push:
|
|
|
|
jobs:
|
|
dependencies:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9.5'
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dependencies
|
|
run: pip3 install -r requirements.txt -r requirements-dev.txt
|
|
tests:
|
|
needs: [dependencies]
|
|
runs-on: ubuntu-20.04
|
|
services:
|
|
postgres:
|
|
image: postgres:14
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5433:5432
|
|
env:
|
|
POSTGRES_DB: didier_pytest
|
|
POSTGRES_USER: pytest
|
|
POSTGRES_PASSWORD: pytest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9.5'
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dependencies
|
|
run: pip3 install -r requirements.txt -r requirements-dev.txt
|
|
- name: Run Pytest
|
|
run: |
|
|
coverage run -m pytest
|
|
coverage xml
|
|
- name: Upload coverage report to CodeCov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
token: ${{ secrets.CODECOV }}
|
|
linting:
|
|
needs: [tests]
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9.5'
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dependencies
|
|
run: pip3 install -r requirements.txt -r requirements-dev.txt
|
|
- name: Linting
|
|
run: flake8
|
|
typing:
|
|
needs: [tests]
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9.5'
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dependencies
|
|
run: pip3 install -r requirements.txt -r requirements-dev.txt
|
|
- name: Typing
|
|
run: mypy
|
|
formatting:
|
|
needs: [tests]
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9.5'
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install dependencies
|
|
run: pip3 install -r requirements.txt -r requirements-dev.txt
|
|
- name: Formatting
|
|
run: black --check didier database
|