Added readme shields #2120
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: DepthAI Core CI/CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
- gen2 | |
- gen2_develop | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
- develop | |
- gen2 | |
- gen2_develop | |
env: | |
CMAKE_WINDOWS_SDK_VERSION: '10.0.18362.0' | |
jobs: | |
style: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Install format dependencies | |
run: | | |
sudo apt-get install clang-format-10 | |
sudo apt-get install libusb-1.0-0-dev | |
- name: configure | |
run: cmake . -Bbuild -DDEPTHAI_CLANG_FORMAT=ON -DCLANG_FORMAT_BIN=clang-format-10 | |
- name: check style | |
run: ci/check_format.sh build | |
tidy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libusb-1.0-0-dev clang-tidy-10 | |
- name: configure | |
run: cmake . -Bbuild -DDEPTHAI_CLANG_TIDY=ON -DCLANG_TIDY_BIN=clang-tidy-10 | |
- name: Run clang-tidy | |
run: cmake --build build --parallel 4 | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
cmake: ['3.10.x', ''] # Older version (Ubuntu 18.04) and newest | |
exclude: | |
- os: windows-latest | |
cmake: '3.10.x' | |
steps: | |
- name: Cache .hunter folder | |
if: matrix.os != 'windows-latest' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.hunter/ | |
key: hunter-${{ matrix.os }}-${{ matrix.cmake }} | |
- name: Cache .hunter folder | |
if: matrix.os == 'windows-latest' | |
uses: actions/cache@v2 | |
with: | |
path: C:/.hunter/ | |
key: hunter-${{ matrix.os }}-${{ matrix.cmake }} | |
- uses: actions/checkout@v2 | |
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 update | |
brew install libusb opencv | |
- name: Install dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libusb-1.0-0-dev libopencv-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 "C:\tools\opencv\build\x64\vc15\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "CMAKE_ARGS=-D'CMAKE_SYSTEM_VERSION=${{ env.CMAKE_WINDOWS_SDK_VERSION }}'" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Build (old CMake, gcc/Clang) | |
if: matrix.cmake == '3.10.x' && matrix.os != 'windows-latest' | |
run: | | |
cmake -H. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' ${{ env.CMAKE_ARGS }} | |
cmake --build build -- -j4 | |
# CMake binaries unavailable | |
# - name: Build (old CMake, MSVC) | |
# if: matrix.cmake == '3.10.x' && matrix.os == 'windows-latest' | |
# run: | | |
# cmake -H. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' | |
# cmake --build build | |
- name: Build (newest CMake) | |
if: matrix.cmake != '3.10.x' | |
run: | | |
cmake -S . -B build -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON ${{ env.CMAKE_ARGS }} | |
cmake --build build --parallel 4 | |
integration: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
build-type: [Debug, Release] | |
shared: [Shared, Static] | |
platform: [x64] | |
include: | |
- platform: Win32 | |
os: windows-latest | |
shared: Shared | |
build-type: Debug | |
- platform: Win32 | |
os: windows-latest | |
shared: Shared | |
build-type: Release | |
steps: | |
- name: Cache .hunter folder | |
if: matrix.os != 'windows-latest' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.hunter/ | |
key: hunter-${{ matrix.os }}-${{ matrix.shared }} | |
- name: Cache .hunter folder | |
if: matrix.os == 'windows-latest' | |
uses: actions/cache@v2 | |
with: | |
path: C:/.hunter/ | |
key: hunter-${{ matrix.os }}-${{ matrix.shared }} | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Install dependencies | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew update | |
brew install libusb opencv | |
- name: Install dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libusb-1.0-0-dev libopencv-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 "C:\tools\opencv\build\x64\vc15\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "CMAKE_ARGS=-D'CMAKE_SYSTEM_VERSION=${{ env.CMAKE_WINDOWS_SDK_VERSION }}'" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Configure ${{ matrix.build-type }}, ${{ matrix.shared }}, ${{ matrix.platform }} | |
if: matrix.shared == 'Shared' && matrix.os == 'windows-latest' | |
run: cmake -A ${{ matrix.platform }} -S . -B build -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install ${{ env.CMAKE_ARGS }} | |
- name: Configure ${{ matrix.build-type }}, ${{ matrix.shared }} | |
if: matrix.shared == 'Shared' && matrix.os != 'windows-latest' | |
run: cmake -S . -B build -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install ${{ env.CMAKE_ARGS }} | |
- name: Configure ${{ matrix.build-type }}, ${{ matrix.shared }} | |
if: matrix.shared == 'Static' | |
run: cmake -S . -B build -D BUILD_SHARED_LIBS=OFF -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 == 'Shared' && matrix.platform == 'x64' | |
uses: actions/[email protected] | |
with: | |
name: windows-prebuilt-win64 | |
path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/ | |
- name: Upload Win32 shared library | |
if: matrix.os == 'windows-latest' && matrix.shared == 'Shared' && matrix.platform == 'Win32' | |
uses: actions/[email protected] | |
with: | |
name: windows-prebuilt-win32-no-opencv | |
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 }} | |
- name: Build and test find_package (installed) | |
run: | | |
cmake -S tests/integration/ -B tests/integration/build_find_package -D TEST_FIND_PACKAGE=ON -D depthai_DIR=$GITHUB_WORKSPACE/depthai_install/lib/cmake/depthai ${{ 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 }} | |
- 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 }} | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [build, style, integration] | |
runs-on: ubuntu-latest | |
# Clone repository | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
# Get tag version | |
- 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@v2 | |
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@v2 | |
with: | |
name: 'windows-prebuilt-win64' | |
path: depthai-core-${{ steps.tag.outputs.version }}-win64 | |
- name: Download Win32 artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: 'windows-prebuilt-win32-no-opencv' | |
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 |