|
| 1 | +name: Ubuntu-ogre-apt |
| 2 | + |
| 3 | +# https://www.jeffgeerling.com/blog/2020/running-github-actions-workflow-on-schedule-and-other-events |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + types: [opened, reopened, synchronize] |
| 7 | + schedule: |
| 8 | + - cron: '0 2 * * SUN' |
| 9 | + |
| 10 | +# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre#comment133398800_72408109 |
| 11 | +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + build-ubuntu-ogre-apt: |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + os: [ubuntu-22.04, ubuntu-latest] |
| 23 | + compiler: [ {CC: /usr/bin/gcc-9, CXX: /usr/bin/g++-9}, {CC: /usr/bin/gcc-10, CXX: /usr/bin/g++-10}, {CC: /usr/bin/clang, CXX: /usr/bin/clang++} ] |
| 24 | + standard: [ 11, 17 ] |
| 25 | + ogre: [ogre-1.9, ogre-1.12] |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Print system information |
| 32 | + run: lscpu |
| 33 | + |
| 34 | + - name: Print OS information |
| 35 | + run: lsb_release -a |
| 36 | + |
| 37 | + - name: Print compiler information |
| 38 | + run: dpkg --list | grep compiler |
| 39 | + |
| 40 | + - name: Install ViSP dependencies |
| 41 | + run: sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-dev libv4l-dev liblapack-dev libopenblas-dev libeigen3-dev libopencv-dev nlohmann-json3-dev |
| 42 | + |
| 43 | + - name: Install Ogre 1.9 |
| 44 | + if: matrix.ogre == 'ogre-1.9' && matrix.standard != '17' |
| 45 | + run: sudo apt-get update && sudo apt-get install -y libogre-1.9-dev |
| 46 | + |
| 47 | + - name: Install Ogre 1.12 |
| 48 | + if: matrix.ogre == 'ogre-1.12' |
| 49 | + run: sudo apt-get update && sudo apt-get install -y libogre-1.12-dev |
| 50 | + |
| 51 | + - name: Clone visp-images |
| 52 | + env: |
| 53 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 54 | + # https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/ |
| 55 | + run: | |
| 56 | + git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images |
| 57 | + echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV |
| 58 | + echo ${VISP_INPUT_IMAGE_PATH} |
| 59 | +
|
| 60 | + - name: Clone visp_sample |
| 61 | + run: | |
| 62 | + git clone --depth 1 https://github.com/lagadic/visp_sample ${HOME}/visp_sample |
| 63 | +
|
| 64 | + - name: Configure CMake |
| 65 | + run: | |
| 66 | + mkdir build |
| 67 | + cd build |
| 68 | + CC=${{ matrix.compiler.CC }} |
| 69 | + CXX=${{ matrix.compiler.CXX }} |
| 70 | + CXX_STANDARD=${{ matrix.standard }} |
| 71 | + echo "CC: $CC" |
| 72 | + echo "CXX: $CXX" |
| 73 | + echo "Standard: $CXX_STANDARD" |
| 74 | + cmake .. -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/usr/local -DCMAKE_VERBOSE_MAKEFILE=ON -DUSE_CXX_STANDARD=$CXX_STANDARD |
| 75 | + cat ViSP-third-party.txt |
| 76 | +
|
| 77 | + - name: Compile |
| 78 | + working-directory: build |
| 79 | + run: | |
| 80 | + make -j$(nproc) install |
| 81 | +
|
| 82 | + - name: Run unit tests |
| 83 | + working-directory: build |
| 84 | + run: ctest -j$(nproc) --output-on-failure |
| 85 | + |
| 86 | + - name: ViSP as 3rdparty with cmake |
| 87 | + run: | |
| 88 | + cd ${HOME}/visp_sample |
| 89 | + mkdir visp_sample-build |
| 90 | + cd visp_sample-build |
| 91 | + CC=${{ matrix.compiler.CC }} |
| 92 | + CXX=${{ matrix.compiler.CXX }} |
| 93 | + cmake .. -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DVISP_DIR=/tmp/usr/local/lib/cmake/visp -DCMAKE_VERBOSE_MAKEFILE=ON |
| 94 | + make -j$(nproc) |
| 95 | +
|
| 96 | + - name: ViSP as 3rdparty with visp.pc and pkg-config |
| 97 | + run: | |
| 98 | + cd ${HOME}/visp_sample |
| 99 | + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/usr/local/lib/pkgconfig |
| 100 | + CC=${{ matrix.compiler.CC }} |
| 101 | + CXX=${{ matrix.compiler.CXX }} |
| 102 | + pkg-config --cflags visp |
| 103 | + pkg-config --libs visp |
| 104 | + make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp.pc |
| 105 | + make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp.pc clean |
| 106 | +
|
| 107 | + - name: ViSP as 3rdparty with visp-config |
| 108 | + run: | |
| 109 | + cd ${HOME}/visp_sample |
| 110 | + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/usr/local/lib/pkgconfig |
| 111 | + export VISP_INSTALL_PREFIX=/tmp/usr/local |
| 112 | + CC=${{ matrix.compiler.CC }} |
| 113 | + CXX=${{ matrix.compiler.CXX }} |
| 114 | + $VISP_INSTALL_PREFIX/bin/visp-config --cflags |
| 115 | + $VISP_INSTALL_PREFIX/bin/visp-config --libs |
| 116 | + make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp-config |
| 117 | + make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp-config clean |
0 commit comments