Skip to content

Commit 0a73b8f

Browse files
Lucas BeloLucas Belo
authored andcommitted
Add test job
1 parent 47f8edd commit 0a73b8f

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/api.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: API Test and deploy
2+
on:
3+
push:
4+
paths:
5+
- 'services/tasks_api/**'
6+
- '.github/workflows/api.yml'
7+
8+
jobs:
9+
test:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
python-version: [3.11]
14+
poetry-version: [1.3.2]
15+
os: [ubuntu-latest]
16+
runs-on: ${{ matrix.os }}
17+
defaults:
18+
run:
19+
working-directory: services/tasks_api
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v3
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install poetry
26+
uses: abatilo/actions-poetry@v2.0.0
27+
with:
28+
poetry-version: ${{ matrix.poetry-version }}
29+
- name: Install dependencies
30+
run: poetry install --no-root
31+
- name: Run tests
32+
run: poetry run pytest tests.py --cov=./ --cov-report=xml
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v3
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
code-quality:
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
python-version: [3.11]
42+
poetry-version: [1.3.2]
43+
os: [ubuntu-latest]
44+
runs-on: ${{ matrix.os }}
45+
defaults:
46+
run:
47+
working-directory: services/tasks_api
48+
steps:
49+
- uses: actions/checkout@v3
50+
- uses: actions/setup-python@v3
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
- name: Install poetry
54+
uses: abatilo/actions-poetry@v2.0.0
55+
with:
56+
poetry-version: ${{ matrix.poetry-version }}
57+
- name: Install dependencies
58+
run: poetry install --no-root
59+
- name: Run black
60+
run: poetry run black . --check
61+
- name: Run isort
62+
run: poetry run isort . --check-only
63+
- name: Run flake8
64+
run: poetry run flake8 .
65+
- name: Run bandit
66+
run: poetry run bandit .

0 commit comments

Comments
 (0)