Skip to content

Commit db6fc08

Browse files
committed
Bump & optimize CI
Bump to Ubuntu-24.04 where possible Bump OpenCV versions Drop sccache for C/C++, the cache gets overloaded a lot Stop caching OpenCV distribution files
1 parent a29d222 commit db6fc08

File tree

7 files changed

+93
-69
lines changed

7 files changed

+93
-69
lines changed

.github/workflows/opencv-rust.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@ on:
66
pull_request:
77
branches:
88
- "*"
9+
permissions:
10+
contents: read
911
jobs:
1012
src:
1113
strategy:
1214
fail-fast: false
1315
matrix:
1416
os-image:
15-
- ubuntu-22.04
17+
- ubuntu-24.04
1618
- macos-14
1719
opencv-version:
1820
- 4.11.0
1921
linkage:
2022
- dynamic
2123
include:
22-
- os-image: ubuntu-22.04
24+
- os-image: ubuntu-24.04
2325
opencv-version: 4.11.0
2426
linkage: static
25-
- os-image: ubuntu-22.04
27+
- os-image: ubuntu-24.04
2628
opencv-version: 5.0.0-alpha
2729
linkage: dynamic
2830
- os-image: ubuntu-22.04
@@ -38,16 +40,10 @@ jobs:
3840
OPENCV_LINKAGE: ${{ matrix.linkage }}
3941
SCCACHE_GHA_ENABLED: "true"
4042
RUSTC_WRAPPER: "sccache"
41-
CMAKE_C_COMPILER_LAUNCHER: "sccache"
42-
CMAKE_CXX_COMPILER_LAUNCHER: "sccache"
4343
steps:
4444
- uses: actions/checkout@v4
4545
- uses: dtolnay/rust-toolchain@stable
4646
- uses: mozilla-actions/sccache-action@v0.0.7
47-
- uses: actions/cache@v4
48-
with:
49-
path: ~/dist
50-
key: dist-${{ matrix.opencv-version }}
5147

5248
- uses: actions/cache@v4
5349
with:
@@ -67,11 +63,11 @@ jobs:
6763
fail-fast: false
6864
matrix:
6965
os-image:
70-
- ubuntu-22.04
66+
- ubuntu-24.04
7167
- windows-2022
7268
- macos-14
7369
vcpkg-version:
74-
- 2024.12.16
70+
- 2025.01.13 # https://github.com/microsoft/vcpkg/releases
7571
runs-on: ${{ matrix.os-image }}
7672
env:
7773
VCPKG_VERSION: ${{ matrix.vcpkg-version }}
@@ -102,8 +98,11 @@ jobs:
10298
- windows-2022
10399
version:
104100
- opencv: 3.4.16
105-
- opencv: 4.10.0
101+
- opencv: 4.11.0 # https://community.chocolatey.org/packages/OpenCV#versionhistory
106102
include:
103+
- os-image: ubuntu-24.04
104+
version:
105+
opencv: 4.6.0
107106
- os-image: ubuntu-22.04
108107
version:
109108
opencv: 4.5.4
@@ -133,7 +132,7 @@ jobs:
133132
shell: bash
134133

135134
docs-rs:
136-
runs-on: ubuntu-22.04
135+
runs-on: ubuntu-24.04
137136
steps:
138137
- uses: actions/checkout@v4
139138
- uses: dtolnay/rust-toolchain@stable
@@ -143,26 +142,19 @@ jobs:
143142
shell: bash
144143

145144
msrv:
146-
runs-on: ubuntu-20.04
145+
runs-on: ubuntu-24.04
147146
env:
148147
OPENCV_VERSION: 4.11.0
149148
SCCACHE_GHA_ENABLED: "true"
150149
RUSTC_WRAPPER: "sccache"
151-
CMAKE_C_COMPILER_LAUNCHER: "sccache"
152-
CMAKE_CXX_COMPILER_LAUNCHER: "sccache"
153150
steps:
154151
- uses: actions/checkout@v4
155152
- uses: mozilla-actions/sccache-action@v0.0.7
156153

157-
- uses: actions/cache@v4
158-
with:
159-
path: ~/dist
160-
key: dist-${{ env.OPENCV_VERSION }}
161-
162154
- uses: actions/cache@v4
163155
with:
164156
path: ~/build
165-
key: build-${{ env.OPENCV_VERSION }}-ubuntu-20.04
157+
key: build-${{ env.OPENCV_VERSION }}-dynamic-ubuntu-24.04
166158

167159
- name: Get MSRV package metadata
168160
id: metadata

ci/check.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

ci/docs-rs.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ set -xeu
55
sudo apt-get update
66
sudo apt-get install -y clang libclang-dev
77

8-
# workaround to make clang_sys crate detect installed libclang
9-
sudo ln -fs libclang.so.1 /usr/lib/llvm-14/lib/libclang.so
10-
118
export RUST_BACKTRACE=full DOCS_RS=1
129
cargo doc -vv

ci/install-macos-framework.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ set -xeu
55
macos_version="$(sw_vers -productVersion)"
66

77
dist_dir="$HOME/dist/"
8-
base_dir="$HOME/build/opencv/"
9-
build_dir="$base_dir/opencv-$OPENCV_VERSION-build/"
10-
mkdir -p "$dist_dir" "$base_dir" "$build_dir"
8+
build_dir="$HOME/build/opencv/opencv-$OPENCV_VERSION-build/"
119

12-
# if the build framework already present assume it's the current version and skip build to save time
10+
# if the build dir already present, assume it's the current version and skip download & build to save time
1311
# the build_framework.py doesn't seem to handle the rebuild with unchanged sources too well and does a full rebuild
14-
if [[ -d "$build_dir/opencv2.framework" ]]; then
12+
if [[ -d "$build_dir" ]]; then
1513
exit 0
1614
fi
1715

16+
mkdir -p "$dist_dir" "$build_dir"
17+
1818
opencv_src="$dist_dir/opencv-$OPENCV_VERSION"
1919
if [ ! -d "$opencv_src" ]; then
2020
curl -L "https://github.com/opencv/opencv/archive/$OPENCV_VERSION.tar.gz" | tar -xz -C "$dist_dir"

ci/install-ubuntu-vcpkg.sh

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,35 @@ if [[ "${VCPKG_VERSION:-}" == "" ]]; then
88
fi
99

1010
sudo apt-get update
11-
sudo apt-get install -y clang libharfbuzz0b git curl zip unzip tar bison gperf libx11-dev libxft-dev libxext-dev \
12-
libgles2-mesa-dev autoconf libtool build-essential libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev \
13-
libdbus-1-dev libxtst-dev sudo python3-jinja2 cmake
14-
15-
# workaround to make clang_sys crate detect installed libclang
16-
sudo ln -fs libclang.so.1 /usr/lib/llvm-14/lib/libclang.so
11+
sudo apt-get install -y \
12+
autoconf \
13+
bison \
14+
build-essential \
15+
clang \
16+
cmake \
17+
curl \
18+
git \
19+
gperf \
20+
libclang-dev \
21+
libdbus-1-dev \
22+
libgles2-mesa-dev \
23+
libharfbuzz0b \
24+
libltdl-dev \
25+
libtool \
26+
libx11-dev \
27+
libxcursor-dev \
28+
libxdamage-dev \
29+
libxext-dev \
30+
libxft-dev \
31+
libxi-dev \
32+
libxinerama-dev \
33+
libxrandr-dev \
34+
libxtst-dev \
35+
python3-jinja2 \
36+
sudo \
37+
tar \
38+
unzip \
39+
zip
1740

1841
export VCPKG_ROOT="$HOME/build/vcpkg"
1942
export VCPKG_DISABLE_METRICS=1
@@ -38,7 +61,7 @@ export VCPKG_DEFAULT_TRIPLET=x64-linux
3861
which cmake
3962
cmake --version
4063
if ! ./vcpkg install --clean-after-build --recurse "opencv[contrib,nonfree,ade,opencl]"; then
41-
for log in "$VCPKG_ROOT/buildtrees"/**/*out.log; do
64+
for log in "$VCPKG_ROOT/buildtrees"/**/*-{out,err}.log; do
4265
echo "=== $log"
4366
cat "$log"
4467
done

ci/install-ubuntu.sh

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ ubuntu_version="$(cat /etc/os-release | sed -nr 's:^VERSION_ID="(.+?)":\1: p')"
88

99
sudo apt-get install -y clang libclang-dev
1010
case "$ubuntu_version" in
11-
"18.04")
12-
# workaround to make clang_sys crate detect installed libclang
13-
sudo ln -fs libclang.so.1 /usr/lib/llvm-6.0/lib/libclang.so
14-
;;
15-
1611
"20.04")
1712
# workaround to make clang_sys crate detect installed libclang
1813
sudo ln -fs libclang.so.1 /usr/lib/llvm-10/lib/libclang.so
@@ -30,6 +25,13 @@ case "$ubuntu_version" in
3025
exit 0
3126
fi
3227
;;
28+
29+
"24.04")
30+
if [[ "$OPENCV_VERSION" == "4.6.0" ]]; then
31+
sudo apt-get -y install "libopencv-dev=${OPENCV_VERSION}*"
32+
exit 0
33+
fi
34+
;;
3335
esac
3436

3537
BUILD_FLAGS="
@@ -136,7 +138,6 @@ BUILD_FLAGS="
136138
sudo apt-get -y install build-essential cmake
137139

138140
if [[ "${OPENCV_LINKAGE:-dynamic}" == "static" ]]; then # static build
139-
# bring back -D BUILD_TBB=ON when updated to Ubuntu-24.04 (https://github.com/opencv/opencv/issues/25187)
140141
BUILD_FLAGS="$BUILD_FLAGS
141142
-D BUILD_JPEG=ON
142143
-D BUILD_OPENJPEG=ON
@@ -160,7 +161,7 @@ if [[ "${OPENCV_LINKAGE:-dynamic}" == "static" ]]; then # static build
160161
"
161162
else # dynamic build
162163
case "$ubuntu_version" in
163-
"18.04" | "20.04")
164+
"20.04")
164165
sudo apt-get -y install \
165166
libatlas-base-dev \
166167
libavcodec-dev \
@@ -256,13 +257,45 @@ else # dynamic build
256257
libwebp-dev \
257258
qtbase5-dev
258259
;;
260+
261+
"24.04")
262+
# runtime deps
263+
sudo apt-get -y install \
264+
libatlas-base-dev \
265+
libavcodec-dev \
266+
libavformat-dev \
267+
libceres-dev \
268+
libdc1394-dev \
269+
libeigen3-dev \
270+
libfreetype6-dev \
271+
libgdal-dev \
272+
libgflags-dev \
273+
libgoogle-glog-dev \
274+
libgphoto2-dev \
275+
libgstreamer-plugins-base1.0-dev \
276+
libharfbuzz-dev \
277+
libhdf5-dev \
278+
libjpeg-dev \
279+
liblapacke64-dev \
280+
libleptonica-dev \
281+
libopenexr-dev \
282+
libpng-dev \
283+
libswscale-dev \
284+
libtbb-dev \
285+
libtesseract-dev \
286+
libtiff-dev \
287+
libunwind-dev \
288+
libvtk9-dev \
289+
libwebp-dev \
290+
qtbase5-dev
291+
;;
259292
esac
260293
fi
261294

262295
dist_dir="$HOME/dist/"
263-
base_dir="$HOME/build/opencv/"
264-
build_dir="$base_dir/opencv-$OPENCV_VERSION-build/"
265-
mkdir -p "$dist_dir" "$base_dir" "$build_dir"
296+
build_dir="$HOME/build/opencv/opencv-$OPENCV_VERSION-build/"
297+
298+
mkdir -p "$dist_dir" "$build_dir"
266299

267300
opencv_src="$dist_dir/opencv-$OPENCV_VERSION"
268301
if [ ! -d "$opencv_src" ]; then

ci/install.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,9 @@ else
1717
fi
1818

1919
if [[ "$os_family" == "Linux" ]]; then
20-
# free up disk space in Github Actions image: https://github.com/actions/runner-images/issues/2840
21-
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost
2220
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
2321
"$ci_dir/install-ubuntu-vcpkg.sh"
2422
else
25-
# workaround for mozilla/sccache action problem /bin/sh: 1: sccache: not found when running `sudo make install`
26-
if [[ "${CMAKE_C_COMPILER_LAUNCHER:-}" == "sccache" ]]; then
27-
export CMAKE_C_COMPILER_LAUNCHER="$(which sccache)"
28-
fi
29-
if [[ "${CMAKE_CXX_COMPILER_LAUNCHER:-}" == "sccache" ]]; then
30-
export CMAKE_CXX_COMPILER_LAUNCHER="$(which sccache)"
31-
fi
3223
"$ci_dir/install-ubuntu.sh"
3324
fi
3425
elif [[ "$os_family" == "macOS" ]]; then
@@ -40,7 +31,7 @@ elif [[ "$os_family" == "macOS" ]]; then
4031
"$ci_dir/install-macos-framework.sh"
4132
fi
4233
elif [[ "$os_family" == "Windows" ]]; then
43-
export CHOCO_LLVM_VERSION=19.1.5
34+
export CHOCO_LLVM_VERSION=19.1.5 # https://community.chocolatey.org/packages/llvm#versionhistory
4435
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
4536
"$ci_dir/install-windows-vcpkg.sh"
4637
else # chocolatey build

0 commit comments

Comments
 (0)