Skip to content

BUG FIX: port4me --skip=<invalid> would not given an error [#69] #121

BUG FIX: port4me --skip=<invalid> would not given an error [#69]

BUG FIX: port4me --skip=<invalid> would not given an error [#69] #121

Workflow file for this run

on:
push:
paths:
- 'python/**/*'
- .github/workflows/check-python.yml
pull_request:
paths:
- 'python/**/*'
- .github/workflows/check-python.yml
name: "Python checks"
permissions:
contents: read
jobs:
check:
if: "! contains(github.event.head_commit.message, '[ci skip]')"
timeout-minutes: 5
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (Python ${{ matrix.config.python }})
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, python: '3.7' }
- {os: ubuntu-latest, python: '3.8' }
- {os: ubuntu-latest, python: '3.9' }
- {os: ubuntu-latest, python: '3.10' }
- {os: ubuntu-latest, python: '3.11' }
- {os: ubuntu-latest, python: '3.12' }
- {os: macOS-latest, python: '3.11' }
- {os: windows-latest, python: '3.11' }
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.config.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install port4me
run: |
cd python/
pip install .
- name: Session information
run: |
python -c "import os; print('EUID='+str(os.geteuid()))"
python --version
python -m port4me --version
- name: Test with pytest
run: |
pip install pytest
pytest
- name: Check CLI
if: runner.os != 'Windows'
run: |
curl -L -O https://github.com/bats-core/bats-core/archive/refs/tags/v1.10.0.tar.gz && tar xf v1.10.0.tar.gz
curl -L -O https://github.com/bats-core/bats-support/archive/refs/tags/v0.3.0.tar.gz && tar xf v0.3.0.tar.gz
curl -L -O https://github.com/bats-core/bats-assert/archive/refs/tags/v2.1.0.tar.gz && tar xf v2.1.0.tar.gz
export BATS_SUPPORT_HOME=$PWD/bats-support-0.3.0
export BATS_ASSERT_HOME=$PWD/bats-assert-2.1.0
export PATH=$PWD/bats-core-1.10.0/bin:$PATH
bash --version
bats --version
cd python/
make check-cli
- name: Lint with flake8
if: matrix.config.python == '3.10'
run: |
pip install flake8
cd python/
flake8 --version
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Generate coverage report
if: matrix.config.python == '3.10'
run: |
pip install pytest-cov
cd python
pytest --cov=port4me ## output summarize in GitHub logs
pytest --cov=port4me --cov-report=xml:coverage.xml
## AD HOC: Make reported paths relative to the root of repository
sed -i 's/filename="/filename="python\/port4me\//g' coverage.xml
- name: Upload Coverage to Codecov
if: matrix.config.python == '3.10'
uses: codecov/codecov-action@v3
with:
env_vars: OS,PYTHON
files: python/coverage.xml
fail_ci_if_error: true
flags: python
name: codecov-umbrella-python
verbose: true