fix memory overflow #6545
This file contains hidden or 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-24.04 | |
| steps: | |
| # checkout | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Run clang-format style check for C/C++ programs. | |
| uses: DoozyX/clang-format-lint-action@v0.18 | |
| 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 src/otel/trace.pb-c.h src/otel/trace.pb-c.c src/otel/resource.pb-c.h src/otel/resource.pb-c.c src/otel/common.pb-c.c src/otel/common.pb-c.h plugins/mqtt/ptformat.pb-c.h plugins/mqtt/ptformat.pb-c.c' | |
| style: file | |
| clangFormatVersion: 10 | |
| cppcheck: | |
| runs-on: ubuntu-24.04 | |
| container: ghcr.io/neugates/build:x86_64-v2.12 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: cppcheck | |
| run: | | |
| sudo apt install -y cppcheck | |
| cppcheck --enable=all --error-exitcode=2 --inline-suppr --suppress=missingInclude --suppress=unusedFunction --suppress=*:src/otel/trace.pb-c.c --suppress=*:src/otel/common.pb-c.c --suppress=*:src/otel/resource.pb-c.c ./plugins ./src | |
| cppcheck --enable=all --error-exitcode=2 --inline-suppr --suppress=missingInclude --suppress=variableScope ./simulator | |
| flawfinder: | |
| name: Flawfinder Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: flawfinder_scan | |
| uses: david-a-wheeler/flawfinder@2.0.20 | |
| with: | |
| arguments: '--minlevel=3 .' | |
| build: | |
| runs-on: ubuntu-24.04 | |
| container: ghcr.io/neugates/build:x86_64-v2.12 | |
| 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 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: neuron-build | |
| path: | | |
| build | |
| ut: | |
| runs-on: ubuntu-24.04 | |
| container: ghcr.io/neugates/build:x86_64-v2.12 | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: neuron-build | |
| path: ./build | |
| - name: unit test | |
| run: | | |
| chmod -R +x ./build/ | |
| cd build | |
| cmake -DUSE_GCOV=1 .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-linux-gnu.cmake | |
| 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@v4 | |
| with: | |
| verbose: true | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: ./cov_report/ | |
| files: ./cov_report/cov-ut.info | |
| pft: | |
| runs-on: ubuntu-24.04 | |
| container: ghcr.io/neugates/build:x86_64-v2.12 | |
| needs: [build] | |
| strategy: | |
| matrix: | |
| plugin: [core, ekuiper, modbus, mqtt, azure, metrics, launch] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: setup dependencies | |
| run: | | |
| sudo apt-get install -y mosquitto | |
| pip install -U pytest requests prometheus-client gmqtt pynng sniffio | |
| sudo apt-get install -y socat | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: neuron-build | |
| path: ./build | |
| - name: function test | |
| run: | | |
| chmod -R +x ./build/ | |
| cd build | |
| cmake -DUSE_GCOV=1 .. -DCMAKE_TOOLCHAIN_FILE=../cmake/x86_64-linux-gnu.cmake | |
| cd .. | |
| 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/app/test_azure.py \ | |
| --ignore=tests/ft/driver/test_modbus.py \ | |
| --ignore=tests/ft/metrics/test_metrics.py \ | |
| --ignore=tests/ft/login/test_launch.py \ | |
| --ignore=tests/ft/login/test_filter_error.py \ | |
| --ignore=tests/ft/login/test_login.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" | |
| elif [ "${{ matrix.plugin }}" = "azure" ]; then | |
| pytest -s -v tests/ft/app/"test_azure.py" | |
| #elif [ "${{ matrix.plugin }}" = "launch" ]; then | |
| #pytest -s -v tests/ft/login | |
| else | |
| pytest -s -v tests/ft/metrics/"test_metrics.py" | |
| fi | |
| - name: create cov report | |
| if: ${{ matrix.plugin != 'launch' }} | |
| 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@v4 | |
| if: ${{ matrix.plugin != 'launch' }} | |
| with: | |
| verbose: true | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: ./cov_report/ | |
| files: ./cov_report/cov-${{ matrix.plugin }}.info |