Skip to content

generators: js: fix sinon dependency to 15.2.0, add node tests #939

generators: js: fix sinon dependency to 15.2.0, add node tests

generators: js: fix sinon dependency to 15.2.0, add node tests #939

Workflow file for this run

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: ['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 }}" != "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++ tshark
- 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 }}" = "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
node-tests:
name: Node ${{ matrix.node-version }} test
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
node-version: ['12', '14', '16', '18', '20']
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install future lxml
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install mavlink message
run: |
git clone https://github.com/ArduPilot/mavlink.git
ln -s $PWD/mavlink/message_definitions ../
- name: Install js dependencies
run: |
cd "generator/javascript"
npm ci
echo $PWD
git remote -v
git status
npm list || true
- name : Test mavlink
run: |
./test_gen_js.sh
cd generators/javascript && npm list
cd "generator/javascript" && npm test