didier/.github/workflows/python.yml

124 lines
3.7 KiB
YAML
Raw Normal View History

2022-06-15 02:04:34 +02:00
name: Python CI
on:
push:
jobs:
dependencies:
2023-01-11 23:27:09 +01:00
runs-on: ubuntu-20.04
2022-06-15 02:04:34 +02:00
steps:
2022-06-17 01:14:22 +02:00
- uses: actions/checkout@v3
2022-06-15 02:04:34 +02:00
- name: Setup Python
2023-01-11 23:37:39 +01:00
uses: actions/setup-python@v4
2022-06-15 02:04:34 +02:00
with:
python-version: '3.9.5'
- name: Cache dependencies
2023-01-11 23:37:39 +01:00
uses: actions/cache@v3
2022-06-15 02:04:34 +02:00
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]
2023-01-11 23:30:49 +01:00
runs-on: ubuntu-20.04
2022-06-17 00:43:55 +02:00
services:
postgres:
image: postgres:14
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
2022-06-29 00:14:44 +02:00
- 5433:5432
2022-06-29 00:20:50 +02:00
env:
POSTGRES_DB: didier_pytest
POSTGRES_USER: pytest
POSTGRES_PASSWORD: pytest
2022-06-15 02:04:34 +02:00
steps:
2022-06-17 01:14:22 +02:00
- uses: actions/checkout@v3
2022-06-15 02:04:34 +02:00
- name: Setup Python
2023-01-11 23:37:39 +01:00
uses: actions/setup-python@v4
2022-06-15 02:04:34 +02:00
with:
python-version: '3.9.5'
- name: Cache dependencies
2023-01-11 23:37:39 +01:00
uses: actions/cache@v3
2022-06-15 02:04:34 +02:00
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
2022-07-01 14:25:15 +02:00
run: |
coverage run -m pytest
coverage xml
- name: Upload coverage report to CodeCov
uses: codecov/codecov-action@v3
2022-07-14 20:28:45 +02:00
with:
token: ${{ secrets.CODECOV }}
2022-06-15 02:04:34 +02:00
linting:
needs: [tests]
2023-01-11 23:30:49 +01:00
runs-on: ubuntu-20.04
2022-06-15 02:04:34 +02:00
steps:
2022-06-17 01:14:22 +02:00
- uses: actions/checkout@v3
2022-06-15 02:04:34 +02:00
- name: Setup Python
2023-01-11 23:37:39 +01:00
uses: actions/setup-python@v4
2022-06-15 02:04:34 +02:00
with:
python-version: '3.9.5'
- name: Cache dependencies
2023-01-11 23:37:39 +01:00
uses: actions/cache@v3
2022-06-15 02:04:34 +02:00
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
2022-07-11 22:23:38 +02:00
run: flake8
2022-06-15 02:04:34 +02:00
typing:
needs: [tests]
2023-01-11 23:30:49 +01:00
runs-on: ubuntu-20.04
2022-06-15 02:04:34 +02:00
steps:
2022-06-17 01:14:22 +02:00
- uses: actions/checkout@v3
2022-06-15 02:04:34 +02:00
- name: Setup Python
2023-01-11 23:37:39 +01:00
uses: actions/setup-python@v4
2022-06-15 02:04:34 +02:00
with:
python-version: '3.9.5'
- name: Cache dependencies
2023-01-11 23:37:39 +01:00
uses: actions/cache@v3
2022-06-15 02:04:34 +02:00
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
2022-07-19 21:33:18 +02:00
run: mypy
2022-06-15 02:04:34 +02:00
formatting:
needs: [tests]
2023-01-11 23:30:49 +01:00
runs-on: ubuntu-20.04
2022-06-15 02:04:34 +02:00
steps:
2022-06-17 01:14:22 +02:00
- uses: actions/checkout@v3
2022-06-15 02:04:34 +02:00
- name: Setup Python
2023-01-11 23:37:39 +01:00
uses: actions/setup-python@v4
2022-06-15 02:04:34 +02:00
with:
python-version: '3.9.5'
- name: Cache dependencies
2023-01-11 23:37:39 +01:00
uses: actions/cache@v3
2022-06-15 02:04:34 +02:00
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