-
Notifications
You must be signed in to change notification settings - Fork 125
75 lines (65 loc) · 3.33 KB
/
ci-test.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
name: CI Test
on: [push, pull_request]
jobs:
ci-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
version: 1.4.2
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends gcc git g++ libev-dev libyaml-dev
cd lib/poseidon_api && poetry install --no-interaction && cd ../../
cd lib/poseidon_cli && poetry install --no-interaction && cd ../../
cd lib/poseidon_core && poetry install --no-interaction && cd ../../
- name: Code Quality - Black
run: |
cd lib/poseidon_api && poetry run black . --check && cd ../../
cd lib/poseidon_cli && poetry run black . --check && cd ../../
cd lib/poseidon_core && poetry run black . --check && cd ../../
- name: Code Quality - Pytype
run: |
cd lib/poseidon_api && poetry run pytype poseidon_api/ && cd ../../
cd lib/poseidon_cli && poetry run pytype poseidon_cli/ && cd ../../
cd lib/poseidon_core && poetry run pytype poseidon_core/ && cd ../../
- name: Code Quality - Pylint
run: |
cd lib/poseidon_api && poetry run pylint --fail-under=4 poseidon_api/ && cd ../../
cd lib/poseidon_cli && poetry run pylint --fail-under=4 poseidon_cli/ && cd ../../
cd lib/poseidon_core && poetry run pylint --fail-under=4 poseidon_core/ && cd ../../
- name: Test with pytest
# https://github.com/python-poetry/poetry/issues/4511
# TODO: setuptools needed by c65faucet, but poetry < 1.2.0 does not allow adding setuptools.
run: |
export POSEIDON_CONFIG=$PWD/config/poseidon.config
cd lib/poseidon_api && poetry run pip install 'setuptools==64.0.3' && poetry run pytest --cov-report term-missing --cov=. --cov-report=xml && cd ../../
cd lib/poseidon_cli && poetry run pip install 'setuptools==64.0.3' && poetry run pytest --cov-report term-missing --cov=. --cov-report=xml && cd ../../
cd lib/poseidon_core && poetry run pip install 'setuptools==64.0.3' && poetry run pytest --cov-report term-missing --cov=. --cov-report=xml && cd ../../
- name: Upload coverage
uses: codecov/codecov-action@v4
if: github.repository == 'faucetsdn/poseidon' && github.ref_name == 'main'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: /home/runner/work/poseidon/poseidon/lib/poseidon_api/coverage.xml,/home/runner/work/poseidon/poseidon/lib/poseidon_cli/coverage.xml,/home/runner/work/poseidon/poseidon/lib/poseidon_core/coverage.xml
fail_ci_if_error: true