Support mqtts #65
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| # Linux Build and Test | |
| linux-build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| compiler: [gcc, clang] | |
| build_type: [debug, release] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libssl-dev cmake | |
| - name: Setup ${{ matrix.compiler }} | |
| if: matrix.compiler == 'clang' | |
| run: | | |
| sudo apt-get install -y clang | |
| - name: Configure and build | |
| run: | | |
| export CC=${{ matrix.compiler }} | |
| if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
| export CXX=g++ | |
| else | |
| export CXX=${{ matrix.compiler }}++ | |
| fi | |
| ./build.sh -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DONESDK_WITH_TEST=ON | |
| - name: Run tests | |
| run: | | |
| cd build | |
| ctest --output-on-failure | |
| - name: Build examples | |
| env: | |
| OPENSSL_ROOT_DIR: /opt/homebrew/opt/openssl@3 | |
| OPENSSL_LIBRARIES: /opt/homebrew/opt/openssl@3/lib | |
| OPENSSL_INCLUDE_DIR: /opt/homebrew/opt/openssl@3/include | |
| run: | | |
| ./build.sh -DONESDK_WITH_EXAMPLE=ON -DONESDK_WITH_TEST=OFF | |
| # macOS Build and Test | |
| macos-build: | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| arch: [x64, arm64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| brew install openssl | |
| # Install CMake 3.26.4 from Kitware | |
| curl -L https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-macos-universal.dmg -o cmake.dmg | |
| hdiutil attach cmake.dmg | |
| sudo cp -R /Volumes/cmake-3.26.4-macos-universal/CMake.app /Applications/ | |
| sudo /Applications/CMake.app/Contents/bin/cmake-gui --install | |
| hdiutil detach /Volumes/cmake-3.26.4-macos-universal | |
| rm cmake.dmg | |
| - name: Configure and build | |
| env: | |
| OPENSSL_ROOT_DIR: /opt/homebrew/opt/openssl@3 | |
| OPENSSL_LIBRARIES: /opt/homebrew/opt/openssl@3/lib | |
| OPENSSL_INCLUDE_DIR: /opt/homebrew/opt/openssl@3/include | |
| run: | | |
| ./build.sh -DCMAKE_BUILD_TYPE=debug -DONESDK_WITH_TEST=ON | |
| - name: Run tests | |
| run: | | |
| cd build | |
| ctest --output-on-failure | |
| - name: Build examples | |
| env: | |
| OPENSSL_ROOT_DIR: /opt/homebrew/opt/openssl@3 | |
| OPENSSL_LIBRARIES: /opt/homebrew/opt/openssl@3/lib | |
| OPENSSL_INCLUDE_DIR: /opt/homebrew/opt/openssl@3/include | |
| run: | | |
| ./build.sh -DONESDK_WITH_EXAMPLE=ON -DONESDK_WITH_TEST=OFF | |
| # Windows Build | |
| windows-build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| choco install mingw | |
| choco install openssl | |
| # Install CMake 3.31.6 | |
| choco install cmake --version=3.31.6 | |
| - name: Configure and build with PowerShell | |
| shell: pwsh | |
| env: | |
| OPENSSL_ROOT_DIR: C:/Program Files/OpenSSL/ | |
| OPENSSL_LIBRARIES: C:/Program Files/OpenSSL/lib | |
| OPENSSL_INCLUDE_DIR: C:/Program Files/OpenSSL/include | |
| run: | | |
| .\build.ps1 -BuildType Debug -CMakeOptions @("-DONESDK_WITH_EXAMPLE=ON") | |
| - name: Test build with batch script | |
| shell: cmd | |
| env: | |
| OPENSSL_ROOT_DIR: C:/Program Files/OpenSSL/ | |
| OPENSSL_LIBRARIES: C:/Program Files/OpenSSL/lib | |
| OPENSSL_INCLUDE_DIR: C:/Program Files/OpenSSL/include | |
| run: | | |
| build.bat -DCMAKE_BUILD_TYPE=Debug -DONESDK_WITH_EXAMPLE=ON | |
| # ESP32 Build (using ESP-IDF) | |
| esp32-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libssl-dev git wget flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake | |
| - name: Extract onesdk source code | |
| run: | | |
| ./build.sh -DONESDK_EXTRACT_SRC=ON -DONESDK_WITH_TEST=OFF -DONESDK_WITH_EXAMPLE=OFF | |
| bash ./scripts/copy_onesdk_src.sh | |
| ls -la examples/onesdk_esp32/components/ | |
| ls -la examples/onesdk_esp32_audio/components/ | |
| - name: Setup ESP-IDF | |
| run: | | |
| mkdir -p ~/esp | |
| cd ~/esp | |
| git clone --recursive https://github.com/espressif/esp-idf.git | |
| cd esp-idf | |
| git checkout v5.5 | |
| ./install.sh esp32s3 | |
| cd .. | |
| pwd | |
| echo "IDF_PATH=$PWD/esp-idf" >> $GITHUB_ENV | |
| - name: Build ESP32 examples | |
| run: | | |
| pwd | |
| ls -la | |
| cd $IDF_PATH | |
| . ./export.sh | |
| cd - | |
| cd ./examples/onesdk_esp32 | |
| idf.py set-target esp32s3 | |
| idf.py build | |
| # Code Quality Checks | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libssl-dev cppcheck cmake | |
| - name: Static analysis | |
| run: | | |
| cppcheck --enable=all --suppress=missingIncludeSystem src/ include/ platform/ | |
| - name: Build with strict mode | |
| run: | | |
| ./build.sh -DONESDK_WITH_STRICT_MODE=ON -DONESDK_WITH_TEST=ON | |
| # Documentation Build | |
| docs-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libssl-dev cmake | |
| - name: Build with documentation | |
| run: | | |
| ./build.sh -DONESDK_WITH_EXAMPLE=ON | |
| - name: Check documentation files | |
| run: | | |
| test -f README.md | |
| test -f README.zh_CN.md | |
| test -f docs/develop.md | |
| # Release Build | |
| release-build: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libssl-dev cmake | |
| - name: Build release version | |
| run: | | |
| ./build.sh -DCMAKE_BUILD_TYPE=release -DONESDK_WITH_EXAMPLE=ON -DONESDK_WITH_TEST=OFF | |
| - name: Extract source files | |
| run: | | |
| ./build.sh -DONESDK_EXTRACT_SRC=ON | |
| - name: Create release artifacts | |
| run: | | |
| mkdir -p release | |
| cp -r build/output release/ || true | |
| cp -r include release/ | |
| # 查找所有.a/.so/.dylib文件并拷贝到release/lib | |
| mkdir -p release/lib | |
| find build -type f \( -name "*.a" -o -name "*.so" -o -name "*.dylib" \) -exec cp {} release/lib/ \; | |
| tar -czf onesdk-release.tar.gz release/ | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: onesdk-release | |
| path: onesdk-release.tar.gz |