Skip to content

Add code hygiene for python #494

Add code hygiene for python

Add code hygiene for python #494

Workflow file for this run

name: python-tests
on:
push:
pull_request:
jobs:
test-linux:
strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./experimental/cluster_migration_core
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies for Framework and Test Coverage
run: |
python -m pip install -r requirements.txt coverage pytest-cov
- name: Run Tests with Coverage
run: |
python -m pytest unit_tests/ --cov=cluster_migration_core --cov-report=xml --cov-branch
- name: Upload Coverage Report
uses: codecov/codecov-action@v4
with:
files: cluster_migration_core/coverage.xml
code-hygiene:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
location:
- FetchMigration/python
- TrafficCapture/dockerSolution/otelConfigs
- TrafficCapture/dockerSolution/src/main/docker/migrationConsole
- experimental
- test
defaults:
run:
working-directory: ${{ matrix.location }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python3 -m pip install -r dev-requirements.txt
continue-on-error: true # Not all projects have dev-requirements.txt, safe to ignore
- run: python3 -m pip install -r requirements.txt
continue-on-error: true # Not all projects have requirements.txt, safe to ignore
- run: python3 -m pip install isort flake8 mypy
- id: isort
continue-on-error: true # Success/failure checked in last job step
run: python3 -m isort --check .
- id: flake8
continue-on-error: true # Success/failure checked in last job step
run: python3 -m flake8 .
- id: mypy
continue-on-error: true # Success/failure checked in last job step
run: python3 -m mypy .
- name: Check previous steps
run: |
if [ "${{ steps.isort.outcome }}" != "success" ] || [ "${{ steps.flake8.outcome }}" != "success" ] || [ "${{ steps.mypy.outcome }}" != "success" ]; then
echo "One or more hygiene step failed"
exit 1
fi