diff --git a/.github/workflows/build-mac.yml b/.github/workflows/build-mac.yml new file mode 100644 index 00000000..b12d6164 --- /dev/null +++ b/.github/workflows/build-mac.yml @@ -0,0 +1,98 @@ +name: limap (Mac) + +on: + push: + branches: + - main + - release/* + pull_request: + types: [ assigned, opened, synchronize, reopened ] + release: + types: [ published, edited ] + +jobs: + build: + name: ${{ matrix.config.os }} ${{ matrix.config.arch }} with Python ${{ matrix.config.python-version }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: [ + {os: macos-14, arch: arm64, python-version: "3.9"}, + {os: macos-14, arch: arm64, python-version: "3.10"}, + {os: macos-14, arch: arm64, python-version: "3.11"}, + ] + env: + COMPILER_CACHE_VERSION: 1 + COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache + CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache + CCACHE_BASEDIR: ${{ github.workspace }} + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + id: cache-builds + with: + key: limap-v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.run_id }}-${{ github.run_number }} + restore-keys: limap-v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }} + path: ${{ env.COMPILER_CACHE_DIR }} + + - name: Setup Mac + run: | + # Fix `brew link` error. + find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete + + brew install \ + cmake \ + ninja \ + boost \ + eigen \ + flann \ + freeimage \ + metis \ + glog \ + googletest \ + ceres-solver \ + qt5 \ + glew \ + cgal \ + sqlite3 \ + ccache \ + hdf5 + + - name: Set up Python ${{ matrix.config.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.config.python-version }} + + - name: Install Python dependencies + run: | + git submodule update --init --recursive + python -m pip install --upgrade pip + python -m pip install setuptools + python -m pip install -r requirements.txt + + - name: Build + run: | + python -m pip install -v . + + - name: Run Python tests + run: python -c "import limap; print(limap.__version__)" + + - name: Run localization test + run: | + python runners/tests/localization.py + + - name: Run E2E tests + run: | + bash scripts/quickstart.sh + python runners/hypersim/fitnmerge.py --default_config_file cfgs/fitnmerge/default_cpu.yaml \ + --output_dir outputs/quickstart_test --visualize 0 + python runners/hypersim/triangulation.py --default_config_file cfgs/triangulation/default_fast.yaml \ + --output_dir outputs/quickstart_test --triangulation.use_exhaustive_matcher --skip_exists --visualize 0 + + - name: Cleanup compiler cache + run: | + set -x + ccache --show-stats --verbose + ccache --evict-older-than 1d + ccache --show-stats --verbose diff --git a/.github/workflows/build.yml b/.github/workflows/build-ubuntu.yml similarity index 85% rename from .github/workflows/build.yml rename to .github/workflows/build-ubuntu.yml index a126a713..30788f2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-ubuntu.yml @@ -1,4 +1,4 @@ -name: limap +name: limap (Ubuntu) on: push: @@ -37,7 +37,6 @@ jobs: path: ${{ env.COMPILER_CACHE_DIR }} - name: Set env (Linux) - if: runner.os == 'Linux' run: | sudo apt-get update && sudo apt-get install -y \ git \ @@ -104,3 +103,17 @@ jobs: --output_dir outputs/quickstart_test_colmap --triangulation.use_exhaustive_matcher --visualize 0 \ --triangulation.use_pointsfm.enable --triangulation.use_pointsfm.colmap_folder outputs/quickstart_test/colmap_outputs/sparse + - name: Cleanup compiler cache + run: | + set -x + ccache --show-stats --verbose + ccache --evict-older-than 1d + ccache --show-stats --verbose + + echo "Size of ctcache before: $(du -sh $CTCACHE_DIR)" + echo "Number of ctcache files before: $(find $CTCACHE_DIR | wc -l)" + # Delete cache older than 10 days. + find "$CTCACHE_DIR"/*/ -mtime +10 -print0 | xargs -0 rm -rf + echo "Size of ctcache after: $(du -sh $CTCACHE_DIR)" + echo "Number of ctcache files after: $(find $CTCACHE_DIR | wc -l)" +