Skip to content

ext

ext #1243

Workflow file for this run

name: Python CI
on: [push]
jobs:
test:
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12, 3.13]
env:
MOLER_DEBUG_THREADS: True
PYTHON_COVERAGE: '3.15'
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.os }} ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get -y install sshpass
python -m pip install --upgrade pip setuptools wheel
pip install -Ur requirements/test.txt
- name: Create local users required by integration tests
run: |
cat /etc/passwd | grep home
sudo useradd molerssh -c MolerSshTest -s /bin/bash -l -m
echo 'molerssh:moler_password' | sudo chpasswd
sudo useradd sshproxy -c Proxy4SshTest -s /bin/bash -l -m
echo 'sshproxy:proxy_password' | sudo chpasswd
sudo useradd adbshell -c AdbShell4SshTest -s /bin/bash -l -m
echo 'adbshell:adb_password' | sudo chpasswd
cat /etc/passwd | grep home
echo ---- try logging as integration tests users via ssh
sshpass -p moler_password ssh -oStrictHostKeyChecking=no molerssh@localhost pwd
sshpass -p proxy_password ssh -oStrictHostKeyChecking=no sshproxy@localhost pwd
sshpass -p adb_password ssh -oStrictHostKeyChecking=no adbshell@localhost pwd
- name: Upload adb simulator
run: |
sudo cp adb_simulation.sh /usr/bin/adb
sudo chmod +x /usr/bin/adb
sudo ls -l /usr/bin/adb
which adb
echo ----------- test adb simulator
adb devices
- name: Test with pytest
if: ${{ matrix.python-version != env.PYTHON_COVERAGE }}
timeout-minutes: 14
run: |
python -m pytest -vvvsss test/
# python -m pytest -c py3pytest.ini -vvvsss test/
- name: Test with pytest and coverage
if: ${{ matrix.python-version == env.PYTHON_COVERAGE }}
timeout-minutes: 49
run: |
pip list
python --version
coverage --version
coverage run -m pytest -vvvsss test/
ls -l .coverage
- name: Validate moler overall coverage
if: ${{ matrix.python-version == env.PYTHON_COVERAGE }}
run: |
coverage report -m --fail-under=91
- name: Validate coverage for moler commands
if: ${{ matrix.python-version == env.PYTHON_COVERAGE }}
run: |
coverage report -m --fail-under=100 --include="moler/cmd/**/*.py"
- name: Validate coverage for moler events
if: ${{ matrix.python-version == env.PYTHON_COVERAGE }}
run: |
coverage report -m --fail-under=100 --include="moler/events/**/*.py"
- name: Upload pytest test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: pytest-${{ matrix.os }}-${{ matrix.python-version }}
path: |
moler*.log
.coverage
retention-days: 5
style:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.12]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.os }} ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -Ur requirements/test.txt
- name: Check PyCodeStyle
run: |
pycodestyle --statistics --count moler
# - name: Check PyDocStyle
# run: |
# pydocstyle --count moler
- name: Check PyLint
run: |
pylint moler --fail-under=8.4 --rcfile=./pylint.cfg || (exit $(($? % 4)))
- name: Check flake8
run: |
flake8 moler --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 moler --count --exit-zero --max-complexity=10 --max-line-length=160 --statistics