-
Notifications
You must be signed in to change notification settings - Fork 598
86 lines (73 loc) · 2.88 KB
/
test.yml
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
name: test pymavlink
on: [push, pull_request]
# paths:
# - "*"
# - "!README.md" <-- don't rebuild on doc change
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false # don't cancel if a job from the matrix fails
matrix:
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-mock numpy
if [ "${{ matrix.python-version }}" != "2.7" ] && [ "${{ matrix.python-version }}" != "3.5" ]
then
pip install mypy
fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
sudo apt update
sudo apt install -y libgtest-dev g++
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Lint with flake8
run: |
# 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 web ui editor is 127 chars wide
SELECT=C,E10,E11,E401,E502,E703,E8,E9,F,W191,W291,W292,W293,W391
flake8 . --count --exit-zero --select=${SELECT} --max-complexity=10 --max-line-length=127 --statistics
# NOTE: we must do all testing on the installed python package, not
# on the build tree. Otherwise the testing is invalid and may not
# indicate the code actually works
#
# Set pythonpath
# install
- name: Install mavlink message
run: |
git clone https://github.com/ArduPilot/mavlink.git
ln -s $PWD/mavlink/message_definitions ../
- name: Install pymavlink
run: |
python setup.py build install
- name: Lint generated python code
run: |
if [ "${{ matrix.python-version }}" = "2.7" ] || [ "${{ matrix.python-version }}" = "3.5" ]
then
flake8 --ignore='W503,E203,E501,E741' --statistics dialects/v10/python2/*.py dialects/v20/python2/*.py
else
flake8 --ignore='W503,E203,E501,E741' --statistics dialects/
mypy --config-file ./.github/workflows/mypy-generated.ini dialects/v10/*.py dialects/v20/*.py
fi
- name: Generate messages
run: |
./test_generate_all.sh
- name : Test generators
run: |
./test_generator.sh
- name : Test JavaScript Bindings - generated tests and Mocha tests
run: |
./test_gen_js.sh && cd generator/javascript && npm test && cd -
- name: Test with pytest
run: |
python -m pytest