-
Notifications
You must be signed in to change notification settings - Fork 4
99 lines (81 loc) · 2.24 KB
/
ci.yml
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
---
name: CI
env:
PYTHON_VERSION: 3.9
POETRY_VERSION: 1.8.3
# Run this build workflow for every new PR
on:
pull_request:
branches: [main]
merge_group:
permissions:
contents: read
pull-requests: write
defaults:
run:
shell: bash
jobs:
check-py:
name: Check Python code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Setup dev libs
run: |
sudo apt-get install libsasl2-dev libpq-dev
- name: Lint & Type Check
run: |
poetry install -E all
poetry run flake8
poetry run black --check .
poetry run isort --check .
poetry run mypy . --explicit-package-bases
poetry run bandit -r . -c pyproject.toml
- name: Test
run: |
poetry run coverage run -m pytest
poetry run coverage xml
- name: Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Pytest coverage comment
uses: orgoro/coverage@v3
with:
coverageFile: ./coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.85
thresholdNew: 0.85
thresholdModified: 0.0
- name: Check bumped version
run: bash .github/scripts/check_version.sh
docker:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Export requirements.txt
run: poetry export -E all -f requirements.txt --output requirements.txt
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
push: false