-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (93 loc) · 2.5 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Continuous Integration
on:
push:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- '.github/workflows/ci.yaml'
- '.github/actions/asdf_tools/action.yaml'
- '.github/actions/python_dependencies/action.yaml'
- '.tool-versions'
pull_request:
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- '.github/workflows/ci.yaml'
- '.github/actions/asdf_tools/action.yaml'
- '.github/actions/python_dependencies/action.yaml'
- '.tool-versions'
defaults:
run:
shell: bash
concurrency:
group: ci-$ {{github.ref }}
cancel-in-progress: true
jobs:
setup:
name: Python Setup
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/python_dependencies
black:
name: Format Python with Black
runs-on: ubuntu-22.04
needs: setup
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/python_dependencies
# returns an error if black would reformat any file
- run: poetry run black . --check
mypy:
name: Type Check with MyPy
runs-on: ubuntu-22.04
needs: setup
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/python_dependencies
# returns an error if mypy detects a type error
- run: poetry run mypy .
pylint:
name: Lint Python using pylint
runs-on: ubuntu-22.04
needs: setup
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/python_dependencies
# returns an error if pylint detects any issues
- run: poetry run pylint src tests
pytest:
name: Run Tests with pytest
runs-on: ubuntu-22.04
needs: setup
# env variables setup for connecting tests to postgres db
env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: dmap_import_test
DB_USER: postgres
DB_PASSWORD: postgres
# standup postgres db to test against
services:
postgres:
image: postgres:15.4
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD}}
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_DB: ${{ env.DB_NAME }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/python_dependencies
# returns an error if pytests fail
- run: poetry run pytest