From bd80e220b9eaea8085236c37b32c839e649846e9 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 12 Apr 2022 19:00:00 -0700 Subject: [PATCH] [ci] Upgrade CMake actions (#4161) --- .github/workflows/cmake.yml | 56 ++++++++++++++++++++------------ .github/workflows/sanitizers.yml | 8 ++++- vcpkg.json | 7 ++++ 3 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 vcpkg.json diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1b9804c81d..57295955e5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -20,50 +20,64 @@ jobs: name: macOS container: "" flags: "-DWITH_JAVA=OFF" + name: "Build - ${{ matrix.name }}" runs-on: ${{ matrix.os }} container: ${{ matrix.container }} steps: - uses: actions/checkout@v2 - - name: Install Dependencies - run: | - if [ "$RUNNER_OS" == "macOS" ]; then - brew install opencv - fi + + - name: Install opencv (macOS) + run: brew install opencv + if: runner.os == 'macOS' + - name: Set up Python 3.8 uses: actions/setup-python@v2 with: python-version: 3.8 + - name: Install jinja run: python -m pip install jinja2 + - name: configure run: mkdir build && cd build && cmake ${{ matrix.flags }} .. + - name: build working-directory: build - run: cmake --build . -j$(nproc) + run: cmake --build . --parallel $(nproc) + - name: test working-directory: build run: ctest --output-on-failure - build-vcpkg: + build-windows: + env: + VCPKG_DEFAULT_TRIPLET: x64-windows name: "Build - Windows" runs-on: windows-2019 steps: - uses: actions/checkout@v2 - - name: Prepare vcpkg - uses: lukka/run-vcpkg@v7 + + - name: Install CMake + uses: lukka/get-cmake@v3.23.0 + + - name: Run vcpkg + uses: lukka/run-vcpkg@v10.2 with: - vcpkgArguments: opencv vcpkgDirectory: ${{ runner.workspace }}/vcpkg - vcpkgTriplet: x64-windows - vcpkgGitCommitId: d781bd9ca77ac3dc2f13d88169021d48459c665f # HEAD on 2021-07-25 - - name: Configure & Build - uses: lukka/run-cmake@v3 - with: - buildDirectory: ${{ runner.workspace }}/build - cmakeAppendedArgs: -DWITH_JAVA=OFF - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - useVcpkgToolchainFile: true - - name: Run Tests + vcpkgGitCommitId: f6af75acc923c833a5620943e3fc7d5e4930f0df # HEAD on 2022-04-10 + runVcpkgInstall: true + + - name: Install jinja + run: python -m pip install jinja2 + + - name: configure + run: mkdir build && cd build && cmake -DWITH_JAVA=OFF -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake .. + + - name: build + working-directory: build + run: cmake --build . --parallel $(nproc) + + - name: test + working-directory: build run: ctest -C "Debug" --output-on-failure - working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index c5f79518d8..332c312c87 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -29,6 +29,7 @@ jobs: container: wpilib/roborio-cross-ubuntu:2022-20.04 steps: - uses: actions/checkout@v2 + - name: Install Dependencies run: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test @@ -37,17 +38,22 @@ jobs: --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 \ --slave /usr/bin/g++ g++ /usr/bin/g++-11 sudo update-alternatives --set gcc /usr/bin/gcc-11 + - name: Set up Python 3.8 uses: actions/setup-python@v2 with: python-version: 3.8 + - name: Install jinja run: python -m pip install jinja2 + - name: configure run: mkdir build && cd build && cmake ${{ matrix.cmake-flags }} .. + - name: build working-directory: build - run: cmake --build . -j$(nproc) + run: cmake --build . --parallel $(nproc) + - name: test working-directory: build run: ${{ matrix.ctest-env }} ctest --output-on-failure ${{ matrix.ctest-flags }} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000000..e32635901f --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "main", + "version-string": "latest", + "dependencies": [ + "opencv" + ] +}