fsync slave mode examples #3791
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: DepthAI Core CI/CD | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| types: [opened, synchronize, reopened, labeled] | |
| jobs: | |
| # The precheck job determines whether a workflow should be run in full | |
| precheck: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should_run }} | |
| steps: | |
| - name: Evaluate trigger condition | |
| id: check | |
| run: | | |
| EVENT_NAME="${{ github.event_name }}" | |
| RAW_LABELS='${{ toJson(github.event.pull_request.labels) }}' | |
| if [[ "$RAW_LABELS" == "null" || -z "$RAW_LABELS" ]]; then | |
| LABELS="[]" | |
| else | |
| LABELS="$RAW_LABELS" | |
| fi | |
| SHOULD_RUN="true" | |
| if [[ "$EVENT_NAME" == "pull_request" ]]; then | |
| if ! echo "$LABELS" | jq -r '.[].name' | grep -q "testable"; then | |
| SHOULD_RUN="false" | |
| fi | |
| fi | |
| echo "should_run=$SHOULD_RUN" >> "$GITHUB_OUTPUT" | |
| style: | |
| runs-on: ubuntu-24.04 | |
| needs: [precheck] | |
| if: needs.precheck.outputs.should_run == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Install format dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install clang-format-18 libopencv-dev libudev-dev | |
| - name: configure | |
| run: cmake . -Bbuild -DDEPTHAI_CLANG_FORMAT=ON -DCLANG_FORMAT_BIN=/usr/bin/clang-format-18 | |
| - name: check style | |
| run: ci/check_format.sh build | |
| tidy: | |
| runs-on: ubuntu-24.04 | |
| needs: [precheck] | |
| if: needs.precheck.outputs.should_run == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install clang-tidy-18 libopencv-dev libudev-dev | |
| - name: configure | |
| run: cmake . -Bbuild -DDEPTHAI_CLANG_TIDY=ON -DCLANG_TIDY_BIN=/usr/bin/clang-tidy-18 | |
| - name: Run clang-tidy | |
| run: cmake --build build --parallel 4 | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| needs: [precheck] | |
| if: needs.precheck.outputs.should_run == 'true' | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| cmake: ['3.22.x', '4.0.x'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Setup cmake | |
| uses: jwlawson/[email protected] | |
| with: | |
| cmake-version: ${{ matrix.cmake }} | |
| - name: Install dependencies | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install opencv | |
| - name: Install dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libopencv-dev libudev-dev libusb-1.0-0-dev | |
| - name: Install dependencies | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| choco install opencv | |
| echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Build | |
| run: | | |
| cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON ${{ env.CMAKE_ARGS }} | |
| cmake --build build --parallel 4 --config Release | |
| integration: | |
| runs-on: ${{ matrix.os }} | |
| needs: [precheck] | |
| if: needs.precheck.outputs.should_run == 'true' | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| build-type: [Debug, Release] | |
| # shared: [true, false] | |
| shared: [true] | |
| platform: [x64] | |
| # TODO(Morato) - add back Win32 and shared builds to CI | |
| # include: | |
| # - platform: Win32 | |
| # os: windows-latest | |
| # shared: true | |
| # build-type: Debug | |
| # - platform: Win32 | |
| # os: windows-latest | |
| # shared: true | |
| # build-type: Release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Install dependencies | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| brew install opencv | |
| - name: Install dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libopencv-dev libudev-dev libusb-1.0-0-dev | |
| - name: Install dependencies | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| choco install opencv | |
| echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "CMAKE_GENERATOR=Visual Studio 17 2022" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.platform }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Setup cmake | |
| uses: jwlawson/[email protected] | |
| with: | |
| cmake-version: '3.29.x' | |
| - name: Configure ${{ matrix.build-type }}, shared ${{ matrix.shared }}, ${{ matrix.platform }} | |
| run: cmake -S . -B build -D BUILD_SHARED_LIBS=${{ matrix.shared}} -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install ${{ env.CMAKE_ARGS }} | |
| - name: Set path to shared library dll (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: echo "$GITHUB_WORKSPACE/depthai_install/bin/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Build and install | |
| run: cmake --build build --config ${{ matrix.build-type }} --target install --parallel 4 | |
| - name: Upload Win64 shared library | |
| if: matrix.os == 'windows-latest' && matrix.shared && matrix.platform == 'x64' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-prebuilt-win64-${{ matrix.build-type }} | |
| path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/ | |
| # TODO(Morato) - add back Win32 and shared builds to CI | |
| # - name: Upload Win32 shared library | |
| # if: matrix.os == 'windows-latest' && matrix.shared && matrix.platform == 'Win32' | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: windows-prebuilt-win32-no-opencv-${{ matrix.build-type }} | |
| # path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/ | |
| # - name: Build and test add_subdirectory | |
| # run: | | |
| # cmake -S tests/integration/ -B tests/integration/build_add_subdirectory -D TEST_FIND_PACKAGE=OFF ${{ env.CMAKE_ARGS }} | |
| # cmake --build tests/integration/build_add_subdirectory --config ${{ matrix.build-type }} --parallel 4 | |
| # cd tests/integration/build_add_subdirectory | |
| # ctest -C ${{ matrix.build-type }} --output-on-failure --no-tests=error | |
| - name: Build and test find_package (installed) | |
| run: | | |
| cmake -S tests/integration/ -B tests/integration/build_find_package -D TEST_FIND_PACKAGE=ON -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/depthai_install/ ${{ env.CMAKE_ARGS }} | |
| cmake --build tests/integration/build_find_package --config ${{ matrix.build-type }} --parallel 4 | |
| cd tests/integration/build_find_package | |
| ctest -C ${{ matrix.build-type }} --output-on-failure --no-tests=error | |
| # - name: Build and test find_package (build directory) | |
| # run: | | |
| # cmake -S tests/integration/ -B tests/integration/build_find_package_2 -D TEST_FIND_PACKAGE=ON -D depthai_DIR=$GITHUB_WORKSPACE/build ${{ env.CMAKE_ARGS }} | |
| # cmake --build tests/integration/build_find_package_2 --config ${{ matrix.build-type }} --parallel 4 | |
| # cd tests/integration/build_find_package_2 | |
| # ctest -C ${{ matrix.build-type }} --output-on-failure --no-tests=error | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [build, style, integration] | |
| runs-on: ubuntu-latest | |
| # Clone repository | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| # Get tag version | |
| # TODO(themarpe) - Node12, has to be updated | |
| - name: Get latest release version number | |
| id: tag | |
| uses: battila7/get-version-action@v2 | |
| # Check if version matches (TODO) | |
| #- name: Check if version matches | |
| # run: | | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.8' | |
| - name: Install dependencies | |
| run: python3.8 -m pip install git-archive-all | |
| - name: Download Win64 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: windows-prebuilt-win64* | |
| merge-multiple: true | |
| path: depthai-core-${{ steps.tag.outputs.version }}-win64 | |
| # - name: Download Win32 artifacts | |
| # uses: actions/download-artifact@v4 | |
| # with: | |
| # pattern: windows-prebuilt-win32-no-opencv* | |
| # merge-multiple: true | |
| # path: depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv | |
| - name: Create release assets | |
| run: | | |
| git-archive-all depthai-core-${{ steps.tag.outputs.version }}.tar.gz | |
| git-archive-all depthai-core-${{ steps.tag.outputs.version }}.zip | |
| zip -r depthai-core-${{ steps.tag.outputs.version }}-win64.zip depthai-core-${{ steps.tag.outputs.version }}-win64 | |
| # zip -r depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv | |
| # Create GitHub release | |
| - uses: actions/create-release@master | |
| id: createRelease | |
| name: Create ${{ steps.tag.outputs.version }} depthai-core release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| body: | | |
| ## Features | |
| ## Bug fixes | |
| ## Misc | |
| draft: true | |
| # Upload release assets | |
| - name: Upload source package (zip) | |
| uses: actions/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.createRelease.outputs.upload_url }} | |
| asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}.zip | |
| asset_name: depthai-core-${{ steps.tag.outputs.version }}.zip | |
| asset_content_type: application/octet-stream | |
| - name: Upload source package (tar.gz) | |
| uses: actions/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.createRelease.outputs.upload_url }} | |
| asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}.tar.gz | |
| asset_name: depthai-core-${{ steps.tag.outputs.version }}.tar.gz | |
| asset_content_type: application/octet-stream | |
| - name: Upload Win64 package (zip) | |
| uses: actions/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.createRelease.outputs.upload_url }} | |
| asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}-win64.zip | |
| asset_name: depthai-core-${{ steps.tag.outputs.version }}-win64.zip | |
| asset_content_type: application/octet-stream | |
| # - name: Upload Win32 package (zip) | |
| # uses: actions/[email protected] | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # with: | |
| # upload_url: ${{ steps.createRelease.outputs.upload_url }} | |
| # asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip | |
| # asset_name: depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip | |
| # asset_content_type: application/octet-stream |