Skip to content

Fix typing issues. #901

Fix typing issues.

Fix typing issues. #901

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: ci
on:
push:
branches: [ "*" ]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 10 # stop runaway job after 10 minutes
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -qq
sudo apt-get -y install graphviz graphviz-dev valgrind
pip install --require-hashes -r ./ci/requirements-dev.txt -r ./ci/requirements-demonet.txt
- name: Install dependencies (MacOS)
if: matrix.os == 'macos-latest'
run: |
pip install --require-hashes -r ./ci/requirements-dev.txt
- name: Lint Check
run: |
ruff check --exit-zero .
pylint --fail-under 9.0 finsy
pyright || echo "Errors ignored for now."
- name: Run Tests
run: |
pytest
- name: Run Code Coverage
run: |
FINSY_TEST_NO_BENCHMARK=1 COVERAGE_RUN=true pytest --cov finsy
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- name: Format Check
run: |
black --check .
isort --check .
- name: Type Check
run: |
PYTHONPATH=. pyright --ignoreexternal --verifytypes finsy || echo "Not yet 100%."
- name: MemCheck Tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
FINSY_TEST_NO_BENCHMARK=1 valgrind pytest -k 'not test_p4info_repr'
test-examples:
runs-on: ubuntu-latest
container:
image: ghcr.io/byllyfish/demonet:23.08
options: --privileged
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install dependencies
run: |
. /etc/os-release
echo "$PRETTY_NAME"
mn --version
python3 -m venv venv
. venv/bin/activate
pip install --require-hashes --no-cache-dir -r ./ci/requirements-dev.txt
- name: Run tests
run: |
. venv/bin/activate
FINSY_TEST_NO_BENCHMARK=1 pytest
- name: Run example tests
run: |
. venv/bin/activate
cd examples
export PYTHONPATH=..
pytest -v -s || (echo "::warning title=Run Examples Warning::Re-running failed tests" && pytest -v -s --last-failed)
- name: Run example tests with coverage (simple only)
run: |
. venv/bin/activate
cd examples; PYTHONPATH=.. COVERAGE_RUN=true pytest -k simple --cov ../finsy --cov-report xml --cov-config ../.coveragerc
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
token: ${{ secrets.FINSY_CODECOV_TOKEN }}
directory: ./examples/
root_dir: ${{ github.workspace }}