Skip to content

Commit e02a801

Browse files
authored
Update vcpkg and CI pipeline with latest changes in colmap (#193)
* Update vcpkg to latest version * d * d * d
1 parent 484667b commit e02a801

File tree

5 files changed

+66
-56
lines changed

5 files changed

+66
-56
lines changed

.github/workflows/install-ccache.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ param (
44
[string] $Destination
55
)
66

7-
$version = "4.8"
8-
$folder = "ccache-$version-windows-x86_64"
7+
$version = "4.10.2"
8+
$folder="ccache-$version-windows-x86_64"
99
$url = "https://github.com/ccache/ccache/releases/download/v$version/$folder.zip"
10-
$expectedSha256 = "A2B3BAB4BB8318FFC5B3E4074DC25636258BC7E4B51261F7D9BEF8127FDA8309"
10+
$expectedSha256 = "6252F081876A9A9F700FAE13A5AEC5D0D486B28261D7F1F72AC11C7AD9DF4DA9"
1111

1212
$ErrorActionPreference = "Stop"
1313

.github/workflows/ubuntu.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ jobs:
1616
strategy:
1717
matrix:
1818
config: [
19-
19+
{
20+
os: ubuntu-24.04,
21+
cmakeBuildType: RelWithDebInfo,
22+
asanEnabled: false,
23+
cudaEnabled: false,
24+
checkCodeFormat: true,
25+
},
2026
{
2127
os: ubuntu-22.04,
2228
cmakeBuildType: Release,
@@ -35,7 +41,7 @@ jobs:
3541
os: ubuntu-22.04,
3642
cmakeBuildType: Release,
3743
asanEnabled: true,
38-
cudaEnabled: true,
44+
cudaEnabled: false,
3945
checkCodeFormat: false,
4046
},
4147
{
@@ -62,14 +68,15 @@ jobs:
6268
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ github.run_id }}-${{ github.run_number }}
6369
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}
6470
path: ${{ env.COMPILER_CACHE_DIR }}
65-
6671
- name: Install compiler cache
6772
run: |
6873
mkdir -p "$CCACHE_DIR" "$CTCACHE_DIR"
6974
echo "$COMPILER_CACHE_DIR/bin" >> $GITHUB_PATH
75+
7076
if [ -f "$COMPILER_CACHE_DIR/bin/ccache" ]; then
7177
exit 0
7278
fi
79+
7380
set -x
7481
wget https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
7582
echo "0b33f39766fe9db67f40418aed6a5b3d7b2f4f7fab025a8213264b77a2d0e1b1 ccache-4.8.2-linux-x86_64.tar.xz" | sha256sum --check
@@ -81,26 +88,26 @@ jobs:
8188
echo "108b087f156a9fe7da0c796de1ef73f5855d2a33a27983769ea39061359a40fc ${ctcache_commit_id}.zip" | sha256sum --check
8289
unzip "${ctcache_commit_id}.zip"
8390
mv ctcache-${ctcache_commit_id}/clang-tidy* "$COMPILER_CACHE_DIR/bin"
91+
8492
- name: Check code format
8593
if: matrix.config.checkCodeFormat
8694
run: |
8795
set +x -euo pipefail
88-
sudo apt-get update && sudo apt-get install -y clang-format-14 black
89-
./scripts/format/clang_format.sh
96+
python -m pip install clang-format==19.1.0
97+
./scripts/format/c++.sh
9098
git diff --name-only
9199
git diff --exit-code || (echo "Code formatting failed" && exit 1)
100+
92101
- name: Setup Ubuntu
93102
run: |
94103
sudo apt-get update && sudo apt-get install -y \
95104
build-essential \
96105
cmake \
97106
ninja-build \
98107
libboost-program-options-dev \
99-
libboost-filesystem-dev \
100108
libboost-graph-dev \
101109
libboost-system-dev \
102110
libeigen3-dev \
103-
libsuitesparse-dev \
104111
libceres-dev \
105112
libflann-dev \
106113
libfreeimage-dev \
@@ -116,7 +123,9 @@ jobs:
116123
libcgal-qt5-dev \
117124
libgl1-mesa-dri \
118125
libunwind-dev \
126+
libcurl4-openssl-dev \
119127
xvfb
128+
120129
if [ "${{ matrix.config.cudaEnabled }}" == "true" ]; then
121130
if [ "${{ matrix.config.os }}" == "ubuntu-20.04" ]; then
122131
sudo apt-get install -y \
@@ -134,16 +143,19 @@ jobs:
134143
echo "CUDAHOSTCXX=/usr/bin/g++-10" >> $GITHUB_ENV
135144
fi
136145
fi
146+
137147
if [ "${{ matrix.config.asanEnabled }}" == "true" ]; then
138148
sudo apt-get install -y clang-15 libomp-15-dev
139149
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV
140150
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV
141151
fi
152+
142153
if [ "${{ matrix.config.cmakeBuildType }}" == "ClangTidy" ]; then
143154
sudo apt-get install -y clang-15 clang-tidy-15 libomp-15-dev
144155
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV
145156
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV
146157
fi
158+
147159
- name: Upgrade CMake
148160
run: |
149161
CMAKE_VERSION=3.28.6
@@ -152,6 +164,7 @@ jobs:
152164
tar -xzf ${CMAKE_DIR}.tar.gz
153165
sudo cp -r ${CMAKE_DIR}/* /usr/local/
154166
rm -rf ${CMAKE_DIR}*
167+
155168
- name: Configure and build
156169
run: |
157170
set -x
@@ -167,6 +180,7 @@ jobs:
167180
-DTESTS_ENABLED=ON \
168181
-DASAN_ENABLED=${{ matrix.config.asanEnabled }}
169182
ninja -k 10000
183+
170184
- name: Run tests
171185
if: ${{ matrix.config.cmakeBuildType != 'ClangTidy' }}
172186
run: |
@@ -176,15 +190,17 @@ jobs:
176190
sleep 3
177191
cd build
178192
ctest --output-on-failure -E .+colmap_.*
193+
179194
- name: Cleanup compiler cache
180195
run: |
181196
set -x
182197
ccache --show-stats --verbose
183198
ccache --evict-older-than 1d
184199
ccache --show-stats --verbose
200+
185201
echo "Size of ctcache before: $(du -sh $CTCACHE_DIR)"
186202
echo "Number of ctcache files before: $(find $CTCACHE_DIR | wc -l)"
187203
# Delete cache older than 10 days.
188204
find "$CTCACHE_DIR"/*/ -mtime +10 -print0 | xargs -0 rm -rf
189205
echo "Size of ctcache after: $(du -sh $CTCACHE_DIR)"
190-
echo "Number of ctcache files after: $(find $CTCACHE_DIR | wc -l)"''
206+
echo "Number of ctcache files after: $(find $CTCACHE_DIR | wc -l)"

.github/workflows/windows.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ jobs:
1616
strategy:
1717
matrix:
1818
config: [
19-
{
20-
os: windows-2019,
21-
cmakeBuildType: Release,
22-
cudaEnabled: false,
23-
testsEnabled: true,
24-
exportPackage: false,
25-
},
2619
{
2720
os: windows-2022,
2821
cmakeBuildType: Release,
@@ -44,18 +37,35 @@ jobs:
4437
COMPILER_CACHE_DIR: ${{ github.workspace }}/compiler-cache
4538
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache
4639
CCACHE_BASEDIR: ${{ github.workspace }}
47-
VCPKG_COMMIT_ID: e01906b2ba7e645a76ee021a19de616edc98d29f
48-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
40+
VCPKG_COMMIT_ID: bc3512a509f9d29b37346a7e7e929f9a26e66c7e
41+
GLOG_v: 1
42+
GLOG_logtostderr: 1
4943

5044
steps:
5145
- uses: actions/checkout@v4
52-
53-
- name: Export GitHub Actions cache env
54-
uses: actions/github-script@v7
55-
with:
56-
script: |
57-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
58-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
46+
47+
# We define the vcpkg binary sources using separate variables for read and
48+
# write operations:
49+
# * Read sources are defined as inline. These can be read by anyone and,
50+
# in particular, pull requests from forks. Unfortunately, we cannot
51+
# define these as action environment variables. See:
52+
# https://github.com/orgs/community/discussions/44322
53+
# * Write sources are defined as action secret variables. These cannot be
54+
# read by pull requests from forks but only from pull requests from
55+
# within the target repository (i.e., created by a repository owner).
56+
# This protects us from malicious actors accessing our secrets and
57+
# gaining write access to our binary cache. For more information, see:
58+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
59+
- name: Setup vcpkg binary cache
60+
shell: pwsh
61+
run: |
62+
# !!!PLEASE!!! be nice and don't use this cache for your own purposes. This is only meant for CI purposes in this repository.
63+
$VCPKG_BINARY_SOURCES = "clear;x-azblob,https://colmap.blob.core.windows.net/github-actions-cache,sp=r&st=2024-12-10T17:29:32Z&se=2030-12-31T01:29:32Z&spr=https&sv=2022-11-02&sr=c&sig=bWydkilTMjRn3LHKTxLgdWrFpV4h%2Finzoe9QCOcPpYQ%3D,read"
64+
if ("${{ secrets.VCPKG_BINARY_CACHE_AZBLOB_URL }}") {
65+
# The secrets are only accessible in runs triggered from within the target repository and not forks.
66+
$VCPKG_BINARY_SOURCES += ";x-azblob,${{ secrets.VCPKG_BINARY_CACHE_AZBLOB_URL }},${{ secrets.VCPKG_BINARY_CACHE_AZBLOB_SAS }},write"
67+
}
68+
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" >> "${env:GITHUB_ENV}"
5969
6070
- name: Compiler cache
6171
uses: actions/cache@v4
@@ -70,11 +80,9 @@ jobs:
7080
run: |
7181
New-Item -ItemType Directory -Force -Path "${{ env.CCACHE_DIR }}"
7282
echo "${{ env.COMPILER_CACHE_DIR }}/bin" | Out-File -Encoding utf8 -Append -FilePath $env:GITHUB_PATH
73-
7483
if (Test-Path -PathType Leaf "${{ env.COMPILER_CACHE_DIR }}/bin/ccache.exe") {
7584
exit
7685
}
77-
7886
.github/workflows/install-ccache.ps1 -Destination "${{ env.COMPILER_CACHE_DIR }}/bin"
7987
8088
- name: Install CUDA
@@ -86,9 +94,6 @@ jobs:
8694
sub-packages: '["nvcc", "nvtx", "cudart", "curand", "curand_dev", "nvrtc_dev"]'
8795
method: 'network'
8896

89-
- name: Install CMake and Ninja
90-
uses: lukka/get-cmake@latest
91-
9297
- name: Setup vcpkg
9398
shell: pwsh
9499
run: |
@@ -99,6 +104,12 @@ jobs:
99104
git reset --hard ${{ env.VCPKG_COMMIT_ID }}
100105
./bootstrap-vcpkg.bat
101106
107+
- name: Install CMake and Ninja
108+
uses: lukka/get-cmake@latest
109+
with:
110+
cmakeVersion: "3.31.0"
111+
ninjaVersion: "1.12.1"
112+
102113
- name: Configure and build
103114
shell: pwsh
104115
run: |

cmake/FindDependencies.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
22

33
find_package(Eigen3 3.4 REQUIRED)
4-
find_package(SuiteSparse COMPONENTS CHOLMOD REQUIRED)
4+
find_package(CHOLMOD QUIET)
5+
if(NOT TARGET SuiteSparse::CHOLMOD)
6+
find_package(SuiteSparse COMPONENTS CHOLMOD REQUIRED)
7+
endif()
58
find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
69
find_package(Boost REQUIRED)
710

scripts/format/clang_format.sh renamed to scripts/format/c++.sh

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,9 @@
22

33
# This script applies clang-format to the whole repository.
44

5-
# Find clang-format
6-
tools='
7-
clang-format
8-
'
9-
10-
clang_format=''
11-
for tool in ${tools}; do
12-
if type -p "${tool}" > /dev/null; then
13-
clang_format=$tool
14-
break
15-
fi
16-
done
17-
18-
if [ -z "$clang_format" ]; then
19-
echo "Could not locate clang-format"
20-
exit 1
21-
fi
22-
echo "Found clang-format: $(which ${clang_format})"
23-
245
# Check version
25-
version_string=$($clang_format --version | sed -E 's/^.*(\d+\.\d+\.\d+-.*).*$/\1/')
26-
expected_version_string='14.0.0'
6+
version_string=$(clang-format --version | sed -E 's/^.*(\d+\.\d+\.\d+-.*).*$/\1/')
7+
expected_version_string='19.1.0'
278
if [[ "$version_string" =~ "$expected_version_string" ]]; then
289
echo "clang-format version '$version_string' matches '$expected_version_string'"
2910
else
@@ -40,5 +21,4 @@ all_files=$( \
4021
num_files=$(echo $all_files | wc -w)
4122
echo "Formatting ${num_files} files"
4223

43-
# Run clang-format
44-
${clang_format} -i $all_files
24+
clang-format -i $all_files

0 commit comments

Comments
 (0)