Skip to content

Commit d2459de

Browse files
committed
d
1 parent 1878d9c commit d2459de

File tree

4 files changed

+66
-54
lines changed

4 files changed

+66
-54
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: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,44 @@ jobs:
1616
strategy:
1717
matrix:
1818
config: [
19-
19+
{
20+
os: ubuntu-24.04,
21+
cmakeBuildType: RelWithDebInfo,
22+
asanEnabled: false,
23+
cudaEnabled: false,
24+
e2eTests: false,
25+
checkCodeFormat: true,
26+
},
2027
{
2128
os: ubuntu-22.04,
2229
cmakeBuildType: Release,
2330
asanEnabled: false,
2431
cudaEnabled: false,
32+
e2eTests: true,
2533
checkCodeFormat: true,
2634
},
2735
{
2836
os: ubuntu-22.04,
2937
cmakeBuildType: Release,
3038
asanEnabled: false,
3139
cudaEnabled: true,
40+
e2eTests: false,
3241
checkCodeFormat: false,
3342
},
3443
{
3544
os: ubuntu-22.04,
3645
cmakeBuildType: Release,
3746
asanEnabled: true,
38-
cudaEnabled: true,
47+
cudaEnabled: false,
48+
e2eTests: false,
3949
checkCodeFormat: false,
4050
},
4151
{
4252
os: ubuntu-22.04,
4353
cmakeBuildType: ClangTidy,
4454
asanEnabled: false,
4555
cudaEnabled: false,
56+
e2eTests: false,
4657
checkCodeFormat: false,
4758
},
4859
]
@@ -62,14 +73,15 @@ jobs:
6273
key: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}-${{ github.run_id }}-${{ github.run_number }}
6374
restore-keys: v${{ env.COMPILER_CACHE_VERSION }}-${{ matrix.config.os }}-${{ matrix.config.cmakeBuildType }}-${{ matrix.config.asanEnabled }}--${{ matrix.config.cudaEnabled }}
6475
path: ${{ env.COMPILER_CACHE_DIR }}
65-
6676
- name: Install compiler cache
6777
run: |
6878
mkdir -p "$CCACHE_DIR" "$CTCACHE_DIR"
6979
echo "$COMPILER_CACHE_DIR/bin" >> $GITHUB_PATH
80+
7081
if [ -f "$COMPILER_CACHE_DIR/bin/ccache" ]; then
7182
exit 0
7283
fi
84+
7385
set -x
7486
wget https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
7587
echo "0b33f39766fe9db67f40418aed6a5b3d7b2f4f7fab025a8213264b77a2d0e1b1 ccache-4.8.2-linux-x86_64.tar.xz" | sha256sum --check
@@ -81,26 +93,26 @@ jobs:
8193
echo "108b087f156a9fe7da0c796de1ef73f5855d2a33a27983769ea39061359a40fc ${ctcache_commit_id}.zip" | sha256sum --check
8294
unzip "${ctcache_commit_id}.zip"
8395
mv ctcache-${ctcache_commit_id}/clang-tidy* "$COMPILER_CACHE_DIR/bin"
96+
8497
- name: Check code format
8598
if: matrix.config.checkCodeFormat
8699
run: |
87100
set +x -euo pipefail
88-
sudo apt-get update && sudo apt-get install -y clang-format-14 black
89-
./scripts/format/clang_format.sh
101+
python -m pip install clang-format==19.1.0
102+
./scripts/format/c++.sh
90103
git diff --name-only
91104
git diff --exit-code || (echo "Code formatting failed" && exit 1)
105+
92106
- name: Setup Ubuntu
93107
run: |
94108
sudo apt-get update && sudo apt-get install -y \
95109
build-essential \
96110
cmake \
97111
ninja-build \
98112
libboost-program-options-dev \
99-
libboost-filesystem-dev \
100113
libboost-graph-dev \
101114
libboost-system-dev \
102115
libeigen3-dev \
103-
libsuitesparse-dev \
104116
libceres-dev \
105117
libflann-dev \
106118
libfreeimage-dev \
@@ -116,7 +128,9 @@ jobs:
116128
libcgal-qt5-dev \
117129
libgl1-mesa-dri \
118130
libunwind-dev \
131+
libcurl4-openssl-dev \
119132
xvfb
133+
120134
if [ "${{ matrix.config.cudaEnabled }}" == "true" ]; then
121135
if [ "${{ matrix.config.os }}" == "ubuntu-20.04" ]; then
122136
sudo apt-get install -y \
@@ -134,16 +148,19 @@ jobs:
134148
echo "CUDAHOSTCXX=/usr/bin/g++-10" >> $GITHUB_ENV
135149
fi
136150
fi
151+
137152
if [ "${{ matrix.config.asanEnabled }}" == "true" ]; then
138153
sudo apt-get install -y clang-15 libomp-15-dev
139154
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV
140155
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV
141156
fi
157+
142158
if [ "${{ matrix.config.cmakeBuildType }}" == "ClangTidy" ]; then
143159
sudo apt-get install -y clang-15 clang-tidy-15 libomp-15-dev
144160
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV
145161
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV
146162
fi
163+
147164
- name: Upgrade CMake
148165
run: |
149166
CMAKE_VERSION=3.28.6
@@ -152,6 +169,7 @@ jobs:
152169
tar -xzf ${CMAKE_DIR}.tar.gz
153170
sudo cp -r ${CMAKE_DIR}/* /usr/local/
154171
rm -rf ${CMAKE_DIR}*
172+
155173
- name: Configure and build
156174
run: |
157175
set -x
@@ -167,6 +185,7 @@ jobs:
167185
-DTESTS_ENABLED=ON \
168186
-DASAN_ENABLED=${{ matrix.config.asanEnabled }}
169187
ninja -k 10000
188+
170189
- name: Run tests
171190
if: ${{ matrix.config.cmakeBuildType != 'ClangTidy' }}
172191
run: |
@@ -176,15 +195,17 @@ jobs:
176195
sleep 3
177196
cd build
178197
ctest --output-on-failure -E .+colmap_.*
198+
179199
- name: Cleanup compiler cache
180200
run: |
181201
set -x
182202
ccache --show-stats --verbose
183203
ccache --evict-older-than 1d
184204
ccache --show-stats --verbose
205+
185206
echo "Size of ctcache before: $(du -sh $CTCACHE_DIR)"
186207
echo "Number of ctcache files before: $(find $CTCACHE_DIR | wc -l)"
187208
# Delete cache older than 10 days.
188209
find "$CTCACHE_DIR"/*/ -mtime +10 -print0 | xargs -0 rm -rf
189210
echo "Size of ctcache after: $(du -sh $CTCACHE_DIR)"
190-
echo "Number of ctcache files after: $(find $CTCACHE_DIR | wc -l)"''
211+
echo "Number of ctcache files after: $(find $CTCACHE_DIR | wc -l)"

.github/workflows/windows.yml

Lines changed: 31 additions & 20 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,
@@ -45,17 +38,34 @@ jobs:
4538
CCACHE_DIR: ${{ github.workspace }}/compiler-cache/ccache
4639
CCACHE_BASEDIR: ${{ github.workspace }}
4740
VCPKG_COMMIT_ID: bc3512a509f9d29b37346a7e7e929f9a26e66c7e
48-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
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: |
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)