Skip to content

Commit 9ebe98a

Browse files
committed
Make CI run multiple combinations of OS and OpenVINO versions
1 parent db221ec commit 9ebe98a

File tree

3 files changed

+40
-34
lines changed

3 files changed

+40
-34
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ jobs:
1919
submodules: true
2020
- run: rustup component add rustfmt
2121
- run: cargo fmt --all -- --check
22+
- run: cd crates/openvino-tensor-converter && cargo fmt --all -- --check
2223

23-
build:
24-
name: Build from OpenVINO source
24+
# Build and test from the git-submodule-included OpenVINO source code.
25+
source:
26+
name: From source
2527
runs-on: ubuntu-20.04
2628
steps:
2729
- uses: actions/checkout@v2
@@ -31,15 +33,25 @@ jobs:
3133
- name: Checkout LFS obects
3234
run: git lfs checkout
3335
- name: Install system dependencies
34-
run: sudo apt update && sudo apt install -y clang cmake libclang-dev gnupg2 libdrm2 libglib2.0-0 libusb-1.0-0-dev lsb-release libgtk-3-0 libtool libopencv-dev libopencv-core4.2 udev unzip dos2unix
36+
run: sudo apt update && sudo apt install -y clang cmake libclang-dev gnupg2 libdrm2 libglib2.0-0 libusb-1.0-0-dev lsb-release libgtk-3-0 libtool udev unzip dos2unix
3537
- name: Build (openvino-sys from source)
3638
run: cargo build --verbose
3739
- name: Run tests
3840
run: cargo test --verbose
3941

42+
# Build and test from an existing OpenVINO installation inside a Docker image (i.e. download the
43+
# binaries, then compile against these).
4044
docker:
41-
name: Build from OpenVINO installation inside a Docker image
45+
name: From binaries
4246
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
os: [ubuntu18, ubuntu20]
51+
version: [2020.4, 2021.1, 2021.2, 2021.3]
52+
exclude:
53+
- os: ubuntu20
54+
version: 2020.4
4355
steps:
4456
- uses: actions/checkout@v2
4557
with:
@@ -48,10 +60,13 @@ jobs:
4860
- name: Checkout LFS obects
4961
run: git lfs checkout
5062
- name: Build the Docker image
51-
run: docker build . --tag openvino-rs:$(date +%s)
63+
run: docker build . --tag openvino-rs:${{ matrix.OS }}-${{ matrix.version }}-$(date +%s) --build-arg OS=${{ matrix.os }} --build-arg VERSION=${{ matrix.version }}
5264

65+
# Build and test the openvino-tensor-converter tool separately from the regular library builds;
66+
# the OpenCV dependency is a bit fragile so the crate is not included by the default workspace
67+
# commands.
5368
converter:
54-
name: Build and test the openvino-tensor-converter tool
69+
name: Converter tool
5570
runs-on: ubuntu-latest
5671
defaults:
5772
run:
@@ -61,7 +76,7 @@ jobs:
6176
with:
6277
submodules: recursive
6378
- name: Install OpenCV
64-
run: sudo apt update && sudo apt install libopencv-dev libopencv-core4.2
79+
run: sudo apt update && sudo apt install libclang-dev libopencv-dev libopencv-core4.2
6580
- name: Build
6681
run: cargo build -v
6782
- name: test

Dockerfile

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
1-
# This Dockerfile demonstrates how to build the openvino bindings using an installation of OpenVINO. For instructions
2-
# to install OpenVINO see the OpenVINO documentation, e.g.
1+
# This Dockerfile demonstrates how to build the openvino bindings using an installation of OpenVINO.
2+
# For instructions to install OpenVINO see the OpenVINO documentation, e.g.
33
# https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_apt.html.
4-
FROM rust:1.50
4+
ARG OS=ubuntu18
5+
ARG VERSION=2020.4
6+
FROM openvino/${OS}_runtime:${VERSION} AS builder
57

6-
# Setup Rust.
7-
RUN rustup component add rustfmt
8+
# OpenVINO's images use a default user, `openvino`, that disallows root access.
9+
USER root
810

9-
# Install OpenVINO.
10-
WORKDIR /tmp
11-
RUN wget https://apt.repos.intel.com/openvino/2020/GPG-PUB-KEY-INTEL-OPENVINO-2020 && \
12-
echo '5f5cff8a2d26ba7de91942bd0540fa4d GPG-PUB-KEY-INTEL-OPENVINO-2020' > CHECKSUM && \
13-
md5sum --check CHECKSUM && \
14-
apt-key add GPG-PUB-KEY-INTEL-OPENVINO-2020 && \
15-
echo "deb https://apt.repos.intel.com/openvino/2020 all main" | tee /etc/apt/sources.list.d/intel-openvino-2020.list && \
16-
apt update && \
17-
apt install -y intel-openvino-runtime-ubuntu18-2020.4.287
11+
# Install Rust.
12+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
13+
ENV PATH=/root/.cargo/bin:$PATH
14+
RUN rustup component add rustfmt
1815

1916
# Install build dependencies (for bindgen).
20-
RUN apt install -y clang libclang-dev
17+
RUN apt update && apt install -y clang libclang-dev
2118

22-
# Install OpenCV (for openvino-tensor-converter).
23-
RUN apt install -y libopencv-dev libopencv-core3.2
24-
25-
# Copy in OpenVINO source
26-
WORKDIR /usr/src/openvino
19+
# Copy in source code.
20+
WORKDIR /usr/src/openvino-rs
2721
COPY . .
2822

29-
# Hack to allow the opencv crate to build with an older version of the OpenCV libraries (FIXME).
30-
RUN sed -i 's/"opencv-4"/"opencv-32"/g' crates/openvino-tensor-converter/Cargo.toml
31-
3223
# Build openvino libraries.
33-
WORKDIR /usr/src/openvino/inference-engine/ie_bridges/rust
3424
RUN OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo build -vv
3525

36-
# Test; note that we need to setup the library paths before using them since the OPENVINO_INSTALL_DIR can only affect
37-
# the build library search path.
26+
# Test; note that we need to setup the library paths before using them since the
27+
# OPENVINO_INSTALL_DIR can only affect the build library search path.
3828
RUN ["/bin/bash", "-c", "source /opt/intel/openvino/bin/setupvars.sh && OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo test -v"]

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ cargo test
6767
```
6868

6969
[openvino] and [openvino-sys] can also be built directly from OpenVINO™'s source code using CMake.
70-
This build process can be quite slow and there are quite a few dependencies. Some notes:
70+
This is not tested across all OS and OpenVINO™ versions--use at your own risk! Also, this build
71+
process can be quite slow and there are quite a few dependencies. Some notes:
7172
- first, install the necessary packages to build OpenVINO™; steps are included in the [CI
7273
workflow](.github/workflows)
7374
but reference the [OpenVINO™ build documentation](https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md)

0 commit comments

Comments
 (0)