Skip to content

Commit 24043b9

Browse files
committed
Improve CI
1 parent 636ef9a commit 24043b9

File tree

7 files changed

+45
-34
lines changed

7 files changed

+45
-34
lines changed

.github/workflows/opencv-rust.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
- macos-13
1717
opencv-version:
1818
- 3.4.20
19-
- 4.9.0
19+
- 4.10.0
2020
linkage:
2121
- dynamic
2222
include:
2323
- os-image: ubuntu-22.04
24-
opencv-version: 4.9.0
24+
opencv-version: 4.10.0
2525
linkage: static
2626
runs-on: ${{ matrix.os-image }}
2727
env:
@@ -47,14 +47,10 @@ jobs:
4747
key: build-${{ matrix.opencv-version }}-${{ matrix.linkage }}-${{ matrix.os-image }}
4848

4949
- name: Install dependencies
50-
env:
51-
OS_FAMILY: ${{ runner.os }}
5250
run: ci/install.sh
5351
shell: bash
5452

5553
- name: Test project
56-
env:
57-
OS_FAMILY: ${{ runner.os }}
5854
run: ci/script.sh
5955
shell: bash
6056

@@ -67,7 +63,7 @@ jobs:
6763
- windows-2022
6864
- macos-14
6965
vcpkg-version:
70-
- 2024.04.26
66+
- 2024.07.12
7167
runs-on: ${{ matrix.os-image }}
7268
env:
7369
VCPKG_VERSION: ${{ matrix.vcpkg-version }}
@@ -83,14 +79,10 @@ jobs:
8379
key: vcpkg-${{ matrix.vcpkg-version }}-${{ matrix.os-image }}
8480

8581
- name: Install dependencies
86-
env:
87-
OS_FAMILY: ${{ runner.os }}
8882
run: ci/install.sh
8983
shell: bash
9084

9185
- name: Test project
92-
env:
93-
OS_FAMILY: ${{ runner.os }}
9486
run: ci/script.sh
9587
shell: bash
9688

@@ -102,7 +94,7 @@ jobs:
10294
- windows-2022
10395
version:
10496
- opencv: 3.4.16
105-
- opencv: 4.9.0
97+
- opencv: 4.10.0
10698
include:
10799
- os-image: ubuntu-22.04
108100
version:
@@ -125,14 +117,10 @@ jobs:
125117
- uses: mozilla-actions/sccache-action@v0.0.5
126118

127119
- name: Install dependencies
128-
env:
129-
OS_FAMILY: ${{ runner.os }}
130120
run: ci/install.sh
131121
shell: bash
132122

133123
- name: Test project
134-
env:
135-
OS_FAMILY: ${{ runner.os }}
136124
run: ci/script.sh
137125
shell: bash
138126

@@ -149,7 +137,7 @@ jobs:
149137
msrv:
150138
runs-on: ubuntu-20.04
151139
env:
152-
OPENCV_VERSION: 4.9.0
140+
OPENCV_VERSION: 4.10.0
153141
SCCACHE_GHA_ENABLED: "true"
154142
RUSTC_WRAPPER: "sccache"
155143
CMAKE_C_COMPILER_LAUNCHER: "sccache"
@@ -177,13 +165,9 @@ jobs:
177165
toolchain: ${{ steps.metadata.outputs.msrv }}
178166

179167
- name: Install dependencies
180-
env:
181-
OS_FAMILY: ${{ runner.os }}
182168
run: ci/install.sh
183169
shell: bash
184170

185171
- name: Check project
186-
env:
187-
OS_FAMILY: ${{ runner.os }}
188172
run: ci/msrv.sh
189173
shell: bash

ci/install-ubuntu-vcpkg.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ fi
1010
sudo apt-get update
1111
sudo apt-get install -y clang libharfbuzz0b git curl zip unzip tar bison gperf libx11-dev libxft-dev libxext-dev \
1212
libgles2-mesa-dev autoconf libtool build-essential libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev \
13-
libdbus-1-dev libxtst-dev sudo
13+
libdbus-1-dev libxtst-dev sudo python3-jinja2 cmake
1414

1515
# workaround to make clang_sys crate detect installed libclang
1616
sudo ln -fs libclang.so.1 /usr/lib/llvm-14/lib/libclang.so
1717

1818
export VCPKG_ROOT="$HOME/build/vcpkg"
19+
export VCPKG_DISABLE_METRICS=1
1920
if [[ -e "$VCPKG_ROOT" && ! -e "$VCPKG_ROOT/.git" ]]; then
2021
rm -rf "$VCPKG_ROOT"
2122
fi

ci/install-ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ BUILD_FLAGS="
136136
sudo apt-get -y install build-essential cmake
137137

138138
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)
139140
BUILD_FLAGS="$BUILD_FLAGS
140141
-D BUILD_JPEG=ON
141142
-D BUILD_OPENJPEG=ON
142143
-D BUILD_PNG=ON
143144
-D BUILD_SHARED_LIBS=OFF
144-
-D BUILD_TBB=ON
145145
-D BUILD_TIFF=ON
146146
-D BUILD_WEBP=ON
147147
-D BUILD_ZLIB=ON

ci/install-windows-vcpkg.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rm -rf "$VCPKG_INSTALLATION_ROOT"
99
choco install -y llvm --version "$CHOCO_LLVM_VERSION"
1010

1111
export VCPKG_ROOT="$HOME/build/vcpkg"
12+
export VCPKG_DISABLE_METRICS=1
1213
if [[ -e "$VCPKG_ROOT" && ! -e "$VCPKG_ROOT/.git" ]]; then
1314
rm -rf "$VCPKG_ROOT"
1415
fi

ci/install.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,36 @@ set -xeu
44

55
ci_dir="$(dirname "$0")"
66

7-
if [[ "$OS_FAMILY" == "Linux" ]]; then
7+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
8+
os_family="Linux"
9+
elif [[ "$OSTYPE" == "darwin"* ]]; then
10+
os_family="macOS"
11+
elif [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
12+
os_family="Windows"
13+
elif [[ "$OSTYPE" == "freebsd"* ]]; then
14+
exit "FreeBSD is not supported"
15+
else
16+
exit "Unknown OS: $OSTYPE"
17+
fi
18+
19+
if [[ "$os_family" == "Linux" ]]; then
820
# free up disk space in Github Actions image: https://github.com/actions/runner-images/issues/2840
921
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost
1022
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
1123
"$ci_dir/install-ubuntu-vcpkg.sh"
1224
else
1325
"$ci_dir/install-ubuntu.sh"
1426
fi
15-
elif [[ "$OS_FAMILY" == "macOS" ]]; then
27+
elif [[ "$os_family" == "macOS" ]]; then
1628
if [[ "${BREW_OPENCV_VERSION:-}" != "" ]]; then # brew build
1729
"$ci_dir/install-macos-brew.sh"
1830
elif [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
1931
"$ci_dir/install-macos-vcpkg.sh"
2032
else
2133
"$ci_dir/install-macos-framework.sh"
2234
fi
23-
elif [[ "$OS_FAMILY" == "Windows" ]]; then
24-
export CHOCO_LLVM_VERSION=18.1.6
35+
elif [[ "$os_family" == "Windows" ]]; then
36+
export CHOCO_LLVM_VERSION=18.1.8
2537
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
2638
"$ci_dir/install-windows-vcpkg.sh"
2739
else # chocolatey build

ci/script.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22

33
set -xeu
44

5-
if [[ "$OS_FAMILY" == "Windows" ]]; then
5+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
6+
os_family="Linux"
7+
elif [[ "$OSTYPE" == "darwin"* ]]; then
8+
os_family="macOS"
9+
elif [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
10+
os_family="Windows"
11+
elif [[ "$OSTYPE" == "freebsd"* ]]; then
12+
exit "FreeBSD is not supported"
13+
else
14+
exit "Unknown OS: $OSTYPE"
15+
fi
16+
17+
if [[ "$os_family" == "Windows" ]]; then
618
export PATH="/C/Program Files/LLVM/bin:$PATH"
719
export LIBCLANG_PATH="C:/Program Files/LLVM/bin"
820
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
@@ -18,12 +30,13 @@ if [[ "$OS_FAMILY" == "Windows" ]]; then
1830
fi
1931
echo "=== Installed chocolatey packages:"
2032
choco list
21-
elif [[ "$OS_FAMILY" == "macOS" ]]; then
33+
elif [[ "$os_family" == "macOS" ]]; then
2234
xcode_select="xcode-select" # IDEA code highlighting workaround
2335
toolchain_path="$($xcode_select --print-path)/Toolchains/XcodeDefault.xctoolchain/"
2436
export DYLD_FALLBACK_LIBRARY_PATH="$toolchain_path/usr/lib/"
2537
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
2638
export VCPKG_ROOT="$HOME/build/vcpkg"
39+
export VCPKG_DISABLE_METRICS=1
2740
echo "=== Installed vcpkg packages:"
2841
"$VCPKG_ROOT/vcpkg" list
2942
elif [[ "${BREW_OPENCV_VERSION:-}" != "" ]]; then # brew build
@@ -36,20 +49,22 @@ elif [[ "$OS_FAMILY" == "macOS" ]]; then
3649
fi
3750
echo "=== Installed brew packages:"
3851
brew list --versions
39-
elif [[ "$OS_FAMILY" == "Linux" ]]; then
52+
elif [[ "$os_family" == "Linux" ]]; then
4053
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
4154
export VCPKG_ROOT="$HOME/build/vcpkg"
4255
echo "=== Installed vcpkg packages:"
4356
"$VCPKG_ROOT/vcpkg" list
57+
# fixes linking issue that started happening since 2024-07-04
58+
export OPENCV_LINK_LIBS="+freetype,bz2,brotlidec"
4459
else
4560
if [[ "${OPENCV_LINKAGE:-dynamic}" == "static" ]]; then # static build
46-
export OPENCV_LINK_LIBS=opencv_gapi,opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,opencv_imgproc,opencv_core,ade,ittnotify,tbb,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib
61+
export OPENCV_LINK_LIBS=opencv_gapi,opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,opencv_imgproc,opencv_core,ade,ittnotify,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib
4762
fi
4863
fi
4964
fi
5065

5166
# remove tests and examples that require the latest OpenCV version so that they don't fail due to missing modules
52-
if [[ "${OPENCV_VERSION:-}" != "4.9.0" ]]; then
67+
if [[ "${OPENCV_VERSION:-}" != "4.10.0" ]]; then
5368
rm -vf tests/*_only_latest_opencv.rs
5469
rm -vf examples/dnn_face_detect.rs examples/text_detection.rs
5570
fi

tools/test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ set -eu
55
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
66
cd "$script_dir/.."
77

8-
export OS_FAMILY="linux"
9-
108
(
119
. "$script_dir/env-34.sh"
1210
ci/script.sh

0 commit comments

Comments
 (0)