-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (100 loc) · 3.52 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Run the uPSP C++ build system and unit tests.
#
# Notes:
#
# - Initially considered installing all dependencies via system
# package manager, but encountered some GH-specific "pain points"
# (e.g., HDF5 v1.12 is not supported out-of-box by ubuntu-latest).
# Simpler and more robust to manage with third-party C/C++ package
# manager like vcpkg.
#
# - Some system dependencies may not be needed... accidentally tried
# vcpkg install without explicitly disabling default opencv4 features
# which include a LOT of extras with frontend library deps like x11.
# TODO consider pruning at a later date.
#
# - Making use of third-party actions for improved caching + invocation
# of CMake and vcpkg. Ref: https://github.com/marketplace/actions/run-vcpkg
# Recommendations from author highlight using vcpkg as a Git submodule...
# this is NOT desirable in our case because for native deployment to
# HPC clusters, oftentimes the user-supplied /home folder has quite limited
# storage and is not appropriate for caching lots of external submodules.
# Instead, we pin the vcpkg release here (vcpkgGitCommitId) and maintain
# consistency manually.
#
# - On NAS HECC systems, we build the C/C++ code with dynamic linkage due
# to the available system dependencies. This is *not* a default
# target supported by vcpkg, but it has a lot of community interest and
# "unofficial" testing support.
#
name: C/C++ unit tests
on:
push:
workflow_dispatch:
jobs:
job:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# Python v3.9 is latest version supported by NAS HECC systems
# Main obstacle to upgrading is "pinned" opencv 4.5.12 dependency
python-version: ['3.9.16']
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed
VCPKG_DEFAULT_TRIPLET: x64-linux-dynamic
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: lukka/get-cmake@latest
- name: Install dependencies (Linux)
run: |
sudo apt-get update -y
sudo apt-get install -y \
autoconf \
bison \
gperf \
nasm \
patchelf \
libdbus-1-dev \
libgles2-mesa-dev \
libopenmpi-dev \
libtool \
libx11-dev \
libxcursor-dev \
libxdamage-dev \
libxext-dev \
libxft-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
libxtst-dev
if: matrix.os == 'ubuntu-latest'
- name: Restore from cache and setup vcpkg executable and data files.
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: '.github/workflows/vcpkg.json'
runVcpkgInstall: true
# Release 2023.04.15
vcpkgGitCommitId: '501db0f17ef6df184fcdbfbe0f87cde2313b6ab1'
- name: Run CMake build
run: |
mkdir build
cd build
cmake \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET="x64-linux-dynamic" \
-DUPSP_BUILD_TESTING=ON \
-DUPSP_BUILD_APPLICATIONS=ON \
-DUPSP_BUILD_PYBIND11=ON \
..
make -j
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
- name: Run C/C++ unit tests
run: |
cd cpp/test
../../build/cpp/test/run_tests