Skip to content

Commit 564c530

Browse files
author
Lionel Untereiner
authored
Create ci-tests.yml
1 parent 74238d6 commit 564c530

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/ci-tests.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
ame: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
static-analysis:
11+
name: Static analysis
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Install dependencies
19+
uses: ./.github/actions/prepare-poetry
20+
with:
21+
python-version: 3.9
22+
23+
# Post in-line comments for any issues found
24+
# Do not run if coming from a forked repo
25+
# See https://github.com/marketplace/actions/lint-action
26+
- name: Run linters (with annotations)
27+
if: github.event.pull_request.head.repo.full_name == github.repository
28+
uses: wearerequired/lint-action@v2
29+
with:
30+
flake8: true
31+
flake8_command_prefix: poetry run
32+
flake8_dir: etpproto
33+
mypy: true
34+
mypy_command_prefix: poetry run
35+
mypy_args: etpproto
36+
37+
# Alternative step that works with forked repo
38+
- name: Run linters (without annotations)
39+
if: github.event.pull_request.head.repo.full_name != github.repository
40+
run: |
41+
poetry run flake8 .
42+
poetry run mypy etpproto
43+
- name: Code formatting
44+
run: poetry run black --check .
45+
46+
unit-tests:
47+
name: Unit tests (Python ${{ matrix.python-version }})
48+
runs-on: ubuntu-latest
49+
50+
strategy:
51+
matrix:
52+
python-version: ["3.9", "3.10"]
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
57+
- name: Install dependencies
58+
uses: ./.github/actions/prepare-poetry
59+
with:
60+
python-version: ${{ matrix.python-version }}
61+
62+
- name: Run pytest
63+
run: poetry run pytest --cov=etpproto --cov-report=xml --junitxml=pytest.xml
64+
65+
- name: Upload pytest artifacts
66+
if: ${{ always() }}
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: Unit Test Results (Python ${{ matrix.python-version }})
70+
path: pytest.xml
71+
72+
- name: Upload coverage to Codecov
73+
uses: codecov/codecov-action@v2
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}
76+
files: coverage.xml
77+
fail_ci_if_error: true

0 commit comments

Comments
 (0)