Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache the dependencies in the CI #223

Merged
merged 26 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .github/workflows/build-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ jobs:
{os: macos-13, arch: arm64},
{os: windows-latest},
]
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
- name: Set macOS env
if: ${{ startsWith(matrix.config.os, 'macos') }}
- uses: actions/cache@v3
id: cache-builds
with:
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.run_id }}-${{ github.run_number }}
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.arch }}
path: ${{ env.COMPILER_CACHE_DIR }}
- name: Set env (macOS)
if: runner.os == 'macOS'
run: |
if [[ ${{ matrix.config.arch }} == "x86_64" ]]; then
VCPKG_TARGET_TRIPLET="x64-osx"
Expand All @@ -48,19 +59,30 @@ jobs:
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}"
CONFIG_SETTINGS="${CONFIG_SETTINGS} cmake.define.CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
echo "CIBW_CONFIG_SETTINGS_MACOS=${CONFIG_SETTINGS}" >> "$GITHUB_ENV"
- name: Set Windows env
if: ${{ startsWith(matrix.config.os, 'windows') }}

# vcpkg binary caching
VCPKG_CACHE_DIR="${COMPILER_CACHE_DIR}/vcpkg"
VCPKG_BINARY_SOURCES="clear;files,${VCPKG_CACHE_DIR},readwrite"
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "$GITHUB_ENV"
- name: Set env (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$CMAKE_TOOLCHAIN_FILE = "${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
echo "CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" >> "${env:GITHUB_ENV}"
$VCPKG_TARGET_TRIPLET = "x64-windows"
echo "VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" >> "${env:GITHUB_ENV}"

# Fix: cibuildhweel cannot interpolate env variables.
$CMAKE_TOOLCHAIN_FILE = $CMAKE_TOOLCHAIN_FILE.replace('\', '/')
$CONFIG_SETTINGS = "cmake.define.CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
$CONFIG_SETTINGS = "${CONFIG_SETTINGS} cmake.define.VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}"
echo "CIBW_CONFIG_SETTINGS_WINDOWS=${CONFIG_SETTINGS}" >> "${env:GITHUB_ENV}"

# vcpkg binary caching
$VCPKG_CACHE_DIR = "${env:COMPILER_CACHE_DIR}/vcpkg"
$VCPKG_BINARY_SOURCES = "clear;files,${VCPKG_CACHE_DIR},readwrite"
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "${env:GITHUB_ENV}"
- name: Build wheels
uses: pypa/[email protected]
env:
Expand Down
4 changes: 2 additions & 2 deletions package/install-colmap-centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ yum install -y \

# ------ Install boost ------
cd ${CURRDIR}
export BOOST_FILENAME=boost_1_71_0
wget -nv https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/${BOOST_FILENAME}.tar.gz
export BOOST_FILENAME="boost-1.84.0"
wget -nv https://github.com/boostorg/boost/releases/download/${BOOST_FILENAME}/${BOOST_FILENAME}.tar.gz
tar xzf ${BOOST_FILENAME}.tar.gz
cd ${BOOST_FILENAME}
./bootstrap.sh --with-libraries=filesystem,system,program_options,graph,test --without-icu
Expand Down
8 changes: 7 additions & 1 deletion package/install-colmap-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ brew remove swiftlint
brew remove node@18

brew update
brew install git cmake ninja llvm
brew install git cmake ninja llvm ccache

cd ${CURRDIR}
#git clone https://github.com/microsoft/vcpkg ${VCPKG_INSTALLATION_ROOT}
Expand Down Expand Up @@ -51,8 +51,14 @@ export ARCHFLAGS="-arch ${CIBW_ARCHS_MACOS}"
cmake .. -GNinja -DGUI_ENABLED=OFF \
-DCUDA_ENABLED=OFF \
-DCGAL_ENABLED=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCCACHE_ENABLED=ON \
-DCMAKE_TOOLCHAIN_FILE="${CMAKE_TOOLCHAIN_FILE}" \
-DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} \
`if [[ ${CIBW_ARCHS_MACOS} == "arm64" ]]; then echo "-DSIMD_ENABLED=OFF"; fi`
ninja install

ccache --show-stats --verbose
ccache --evict-older-than 1d
ccache --show-stats --verbose
34 changes: 29 additions & 5 deletions package/install-colmap-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
$CURRDIR = $PWD
echo "CMAKE_TOOLCHAIN_FILE = ${env:CMAKE_TOOLCHAIN_FILE}"
echo "CIBW_CONFIG_SETTINGS_WINDOWS = ${env:CIBW_CONFIG_SETTINGS_WINDOWS}"

curl.exe -L -o "ninja.zip" "https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip"
Expand-Archive -LiteralPath "${CURRDIR}/ninja.zip" -DestinationPath ${CURRDIR}
$NINJA_PATH = "${CURRDIR}/ninja.exe"
$COMPILER_TOOLS_DIR = "${env:COMPILER_CACHE_DIR}/bin"
New-Item -ItemType Directory -Force -Path ${COMPILER_TOOLS_DIR}
$env:Path = "${COMPILER_TOOLS_DIR};" + $env:Path

$NINJA_PATH = "${COMPILER_TOOLS_DIR}/ninja.exe"
If (!(Test-Path -path ${NINJA_PATH} -PathType Leaf)) {
$zip_path = "${env:TEMP}/ninja.zip"
$url = "https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip"
curl.exe -L -o ${zip_path} ${url}
Expand-Archive -LiteralPath ${zip_path} -DestinationPath ${COMPILER_TOOLS_DIR}
Remove-Item ${zip_path}
}
If (!(Test-Path -path "${COMPILER_TOOLS_DIR}/ccache.exe" -PathType Leaf)) {
# For some reason this CI runs an earlier PowerShell version that is
# not compatible with colmap/.azure-pipelines/install-ccache.ps1
$folder = "ccache-4.8-windows-x86_64"
$url = "https://github.com/ccache/ccache/releases/download/v4.8/${folder}.zip"
$zip_path = "${env:TEMP}/${folder}.zip"
$folder_path = "${env:TEMP}/${folder}"
curl.exe -L -o ${zip_path} ${url}
Expand-Archive -LiteralPath ${zip_path} -DestinationPath "$env:TEMP"
Move-Item -Force "${folder_path}/ccache.exe" ${COMPILER_TOOLS_DIR}
Remove-Item ${zip_path}
Remove-Item -Recurse ${folder_path}
}

cd ${CURRDIR}
git clone https://github.com/colmap/colmap.git
Expand Down Expand Up @@ -32,3 +52,7 @@ cmake .. `
-DCMAKE_TOOLCHAIN_FILE="${env:CMAKE_TOOLCHAIN_FILE}" `
-DVCPKG_TARGET_TRIPLET="x64-windows"
& ${NINJA_PATH} install

ccache --show-stats --verbose
ccache --evict-older-than 1d
ccache --show-stats --verbose
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wheel.expand-macos-universal-tags = true
[tool.cibuildwheel]
build = "cp3{8,9,10,11}-{macosx,manylinux,win}*"
archs = ["auto64"]
environment = { COLMAP_COMMIT_ID="c206c7a333c8b2ef818135bdfe9d31a28bd2eb2b" }
environment = { COLMAP_COMMIT_ID="3.9" }
test-command = "python -c \"import pycolmap; print(pycolmap.__version__)\""

[tool.cibuildwheel.linux]
Expand Down
Loading