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: Build and Test | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 90 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
| sudo apt-get clean | |
| df -h | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| bison \ | |
| flex \ | |
| build-essential \ | |
| cmake \ | |
| autoconf \ | |
| autoconf-archive \ | |
| automake \ | |
| libtool \ | |
| libltdl-dev \ | |
| libx11-dev \ | |
| libxft-dev \ | |
| libxext-dev \ | |
| libxtst-dev \ | |
| libxrandr-dev \ | |
| libxi-dev \ | |
| ninja-build \ | |
| pkg-config | |
| sudo apt-get clean | |
| - name: Cache vcpkg | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/vcpkg | |
| ${{ github.workspace }}/build/vcpkg_installed | |
| key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vcpkg- | |
| - name: Bootstrap vcpkg | |
| run: | | |
| if [ ! -f vcpkg/vcpkg ]; then | |
| chmod +x ./vcpkg/bootstrap-vcpkg.sh | |
| ./vcpkg/bootstrap-vcpkg.sh | |
| fi | |
| - name: Set vcpkg environment | |
| run: | | |
| echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV | |
| echo "VCPKG_DEFAULT_TRIPLET=x64-linux-release" >> $GITHUB_ENV | |
| - name: Configure CMake | |
| run: | | |
| cmake -S . -B build \ | |
| -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
| -DVCPKG_TARGET_TRIPLET=x64-linux-release | |
| - name: Build project | |
| run: cmake --build build --parallel 2 | |
| - name: List built executables | |
| run: | | |
| echo "=== Built C++ executables ===" | |
| find build -type f -executable -name "ceres_*" -o -name "manif_*" -o -name "sophus_*" -o -name "rerun" -o -name "*SfM" -o -name "bundle_adjuster" -o -name "pose_graph_2d" | sort | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: robotic-notes-executables | |
| path: | | |
| build/ceres_* | |
| build/manif_* | |
| build/sophus_* | |
| build/rerun | |
| build/*SfM | |
| build/bundle_adjuster | |
| build/snavely_reprojection_error | |
| build/simple_snavely_reprojection_error | |
| build/pose_graph_2d | |
| build/minimal_camera_ray_test | |
| retention-days: 7 | |
| if-no-files-found: warn |