-
Notifications
You must be signed in to change notification settings - Fork 32
49 lines (47 loc) · 1.37 KB
/
run-tests.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
name: Run Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
run-checks:
runs-on: ubuntu-latest
name: Run Unit Tests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: Setup poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ vars.POETRY_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry install
- name: Lint with flake8
id: flake8
continue-on-error: true
run: |
poetry run flake8 . | tee lint.log
rescode=${PIPESTATUS[0]}
echo "::set-output name=lint::$(cat lint.log)"
exit $rescode
- name: Run pytest
id: pytest
continue-on-error: true
run: |
poetry run python -m pytest --cov=. --cov-report=xml --cov-config=.coveragerc . | tee test.log
rescode=${PIPESTATUS[0]}
echo "::set-output name=tests::$(cat test.log)"
exit $rescode
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}