chore: improve parameter validation for API #3872
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: check | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
jobs: | |
clang_format_check: | |
runs-on: ubuntu-20.04 | |
steps: | |
# checkout | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Run clang-format style check for C/C++ programs. | |
uses: DoozyX/[email protected] | |
with: | |
source: 'src plugins include tests' | |
exclude: 'include/neuron/utils/uthash.h include/neuron/utils/utarray.h include/neuron/utils/utlist.h include/neuron/utils/zlog.h' | |
clangFormatVersion: 10 | |
style: file | |
cppcheck: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: cppcheck | |
run: | | |
sudo apt install cppcheck | |
cppcheck --enable=all --error-exitcode=2 --inline-suppr --suppress=missingInclude --suppress=unusedFunction ./plugins ./src | |
cppcheck --enable=all --error-exitcode=2 --inline-suppr --suppress=missingInclude --suppress=unusedFunction --suppress=variableScope ./simulator | |
ut: | |
runs-on: ubuntu-20.04 | |
container: ghcr.io/neugates/build:x86_64-main | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: compile | |
run: | | |
git config --global --add safe.directory $(pwd) | |
mkdir -p build && cd build | |
cmake -DUSE_GCOV=1 .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-linux-gnu.cmake | |
make -j4 | |
- name: unit test | |
run: | | |
cd build | |
ctest --output-on-failure | |
- name: create cov report | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install lcov | |
mkdir -p cov_report | |
./create_cov_report.sh ut | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true | |
fail_ci_if_error: true | |
directory: ./cov_report/ | |
files: cov-ut.info | |
ft: | |
runs-on: ubuntu-20.04 | |
container: ghcr.io/neugates/build:x86_64-main | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: compile | |
run: | | |
git config --global --add safe.directory $(pwd) | |
mkdir -p build && cd build | |
cmake -DUSE_GCOV=1 .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-linux-gnu.cmake | |
make -j4 | |
- name: function test | |
run: | | |
sudo apt-get install -y mosquitto | |
mosquitto -v & | |
python3 -m pip install -U pip | |
python3 -m pip install -r ft/requirements.txt | |
python3 -m robot --maxerrorlines=600 -P ft/ -d ft/reports ft | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ft_result | |
path: | | |
build/neuron.log | |
- name: create cov report | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install lcov | |
mkdir -p cov_report | |
./create_cov_report.sh ft | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true | |
fail_ci_if_error: true | |
directory: ./cov_report/ | |
files: cov-ft.info | |
pft: | |
runs-on: ubuntu-20.04 | |
container: ghcr.io/neugates/build:x86_64-main | |
strategy: | |
matrix: | |
plugin: [core, ekuiper, modbus, mqtt, metrics] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: setup dependencies | |
run: | | |
if [ "${{ matrix.plugin }}" = "mqtt" ]; then | |
sudo apt-get install -y mosquitto | |
fi | |
pip install -U pytest requests prometheus-client gmqtt pynng sniffio | |
- name: compile | |
run: | | |
git config --global --add safe.directory $(pwd) | |
mkdir -p build && cd build | |
cmake -DUSE_GCOV=1 .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-linux-gnu.cmake | |
make -j4 | |
- name: function test | |
run: | | |
if [ "${{ matrix.plugin }}" = "core" ]; then | |
pytest -s -v tests/ft \ | |
--ignore=tests/ft/app/test_ekuiper.py \ | |
--ignore=tests/ft/app/test_mqtt.py \ | |
--ignore=tests/ft/driver/test_modbus.py \ | |
--ignore=tests/ft/metrics/test_metrics.py | |
elif [ "${{ matrix.plugin }}" = "ekuiper" ]; then | |
pytest -s -v tests/ft/app/"test_ekuiper.py" | |
elif [ "${{ matrix.plugin }}" = "modbus" ]; then | |
pytest -s -v tests/ft/driver/"test_modbus.py" | |
elif [ "${{ matrix.plugin }}" = "mqtt" ]; then | |
pytest -s -v tests/ft/app/"test_mqtt.py" | |
else | |
pytest -s -v tests/ft/metrics/"test_metrics.py" | |
fi | |
- name: create cov report | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install lcov | |
mkdir -p cov_report | |
./create_cov_report.sh ${{ matrix.plugin }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true | |
directory: ./cov_report/ | |
files: cov-${{ matrix.plugin }}.info |