-
Notifications
You must be signed in to change notification settings - Fork 23
114 lines (111 loc) · 4.18 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Python CI
on: [push]
jobs:
test:
timeout-minutes: 50
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.13'
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.13]
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