Skip to content

Merge pull request #2936 from faucetsdn/dependabot/pip/lib/poseidon_c… #1681

Merge pull request #2936 from faucetsdn/dependabot/pip/lib/poseidon_c…

Merge pull request #2936 from faucetsdn/dependabot/pip/lib/poseidon_c… #1681

Workflow file for this run

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