-
Notifications
You must be signed in to change notification settings - Fork 4
99 lines (81 loc) · 2.23 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.8
POETRY_VERSION: 1.2.2
# 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@v2
- name: Setup python
uses: actions/setup-python@v2
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
- 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@v3
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@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Poetry
uses: abatilo/[email protected]
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