-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (60 loc) · 1.89 KB
/
code-checks.yaml
File metadata and controls
62 lines (60 loc) · 1.89 KB
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
name: Code checks
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
static_code_checks:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11.10'
- name: Install poetry
run: |
POETRY_VERSION=$(grep -E '^requires-poetry = ' pyproject.toml | sed -E 's/requires-poetry = "(.*)"/\1/')
pip install poetry==$POETRY_VERSION
- name: Install dependencies
run: poetry install
- name: Ruff check
run: poetry run ruff check .
- name: Ruff format check
run: poetry run ruff format --check .
- name: Mypy check
run: poetry run mypy .
tests:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11.10'
- name: Install poetry
run: |
POETRY_VERSION=$(grep -E '^requires-poetry = ' pyproject.toml | sed -E 's/requires-poetry = "(.*)"/\1/')
pip install poetry==$POETRY_VERSION
- name: Install dependencies
run: poetry install
- name: configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.TESTS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.TESTS_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Run tests
run: |
poetry run pytest -m "aws or not(aws)" --junitxml=pytest.xml --cov-report=term-missing --cov=api | tee pytest-coverage.txt
echo "test_exit_code=${PIPESTATUS[0]}" >> $GITHUB_ENV
- name: Coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
- name: Fail on test failure
run: exit ${{ env.test_exit_code }}