[build] Test each example in a new environment (#5662) #511
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: CMake | |
on: [pull_request, push] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
name: Linux | |
container: wpilib/roborio-cross-ubuntu:2023-22.04 | |
flags: "" | |
- os: macOS-12 | |
name: macOS | |
container: "" | |
flags: "-DWITH_JAVA=OFF" | |
name: "Build - ${{ matrix.name }}" | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java python-is-python3 ninja-build | |
- name: Install opencv (macOS) | |
run: brew install opencv ninja | |
if: runner.os == 'macOS' | |
- name: Set up Python 3.8 (macOS) | |
if: runner.os == 'macOS' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install jinja | |
run: python -m pip install jinja2 | |
- name: configure | |
run: cmake -S . -B build -G "Ninja" ${{ matrix.flags }} | |
- name: build | |
working-directory: build | |
run: cmake --build . | |
- name: test | |
working-directory: build | |
run: ctest --output-on-failure | |
build-windows: | |
name: "Build - Windows" | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install CMake | |
uses: lukka/[email protected] | |
- name: Run vcpkg | |
uses: lukka/[email protected] | |
with: | |
vcpkgDirectory: ${{ runner.workspace }}/vcpkg | |
vcpkgGitCommitId: 78b61582c9e093fda56a01ebb654be15a0033897 # HEAD on 2023-08-6 | |
- name: Install jinja | |
run: python -m pip install jinja2 | |
- name: configure | |
run: cmake -S . -B build -G "Ninja Multi-Config" -DWITH_JAVA=OFF -DWITH_TESTS=OFF -DUSE_SYSTEM_FMTLIB=ON -DUSE_SYSTEM_LIBUV=ON -DUSE_SYSTEM_EIGEN=ON -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--clean-after-build -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_HOST_TRIPLET=x64-windows-release | |
- name: build | |
working-directory: build | |
run: cmake --build . --parallel $(nproc) --config Release |