-
Notifications
You must be signed in to change notification settings - Fork 93
171 lines (150 loc) · 7.13 KB
/
Copy pathbuild_and_test_linux.yml
File metadata and controls
171 lines (150 loc) · 7.13 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# This workflow builds and tests Ocean on Linux (static) using the
# Python-based build system (build/python/).
#
# Pipeline: build-thirdparty → build-ocean → test-ocean
# Each stage waits for the previous one to succeed via `needs:`.
name: Build and test Ocean on Linux (Python, static)
on:
schedule:
# Mon-Sun, every 24 hours at 6 am (UTC)
- cron: '0 6 * * *'
push:
branches: [main]
paths:
- 'build/python/**'
workflow_dispatch:
env:
OCEAN_THIRDPARTY_INSTALL_PATH: ${{ github.workspace }}/ocean_thirdparty_install
OCEAN_BUILD_PATH: ${{ github.workspace }}/ocean_build
OCEAN_INSTALL_PATH: ${{ github.workspace }}/ocean_install
jobs:
# ---------- Stage 1: Build third-party libraries ----------
build-thirdparty:
name: 3P · Linux (${{ matrix.build_config }}, static)
runs-on: ubuntu-latest
strategy:
matrix:
build_config: [debug, release]
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install -r build/python/requirements.txt
- name: Cache third-party install
id: cache-thirdparty
uses: actions/cache@v5
with:
key: thirdparty-python-${{ matrix.build_config }}-${{ hashFiles('build/python/') }}
path: ${{ env.OCEAN_THIRDPARTY_INSTALL_PATH }}
- name: Install system dependencies
if: ${{ steps.cache-thirdparty.outputs.cache-hit != 'true' }}
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y -o Acquire::Retries=5 \
git ninja-build zip libx11-dev libgtk-3-dev \
liblzma-dev libgl1-mesa-dev libxcb-glx0-dev \
libdeflate-dev libudev-dev zlib1g-dev
- name: Build third-party libraries
if: ${{ steps.cache-thirdparty.outputs.cache-hit != 'true' }}
run: |
python build/python/build_ocean_3rdparty.py \
--target linux_x86_64 \
--config ${{ matrix.build_config }} \
--link static \
--install-dir ${{ env.OCEAN_THIRDPARTY_INSTALL_PATH }}
# ---------- Stage 2: Build Ocean ----------
build-ocean:
name: Ocean · Linux (${{ matrix.build_config }}, static)
needs: build-thirdparty
runs-on: ubuntu-latest
strategy:
matrix:
build_config: [debug, release]
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install -r build/python/requirements.txt
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y -o Acquire::Retries=5 \
git ninja-build zip libx11-dev libgtk-3-dev \
liblzma-dev libgl1-mesa-dev libxcb-glx0-dev \
libdeflate-dev libudev-dev zlib1g-dev
- name: Restore third-party cache
uses: actions/cache/restore@v5
with:
key: thirdparty-python-${{ matrix.build_config }}-${{ hashFiles('build/python/') }}
path: ${{ env.OCEAN_THIRDPARTY_INSTALL_PATH }}
fail-on-cache-miss: true
- name: Cache Ocean build
id: cache-ocean
uses: actions/cache@v5
with:
key: ocean-python-build-${{ matrix.build_config }}-${{ github.sha }}
path: ${{ env.OCEAN_BUILD_PATH }}
- name: Build Ocean
if: ${{ steps.cache-ocean.outputs.cache-hit != 'true' }}
run: |
python build/python/build_ocean.py \
--target linux_x86_64 \
--config ${{ matrix.build_config }} \
--link static \
--third-party-dir ${{ env.OCEAN_THIRDPARTY_INSTALL_PATH }} \
--build-dir ${{ env.OCEAN_BUILD_PATH }} \
--install-dir ${{ env.OCEAN_INSTALL_PATH }}
# ---------- Stage 3: Test Ocean ----------
test-ocean:
name: "${{ matrix.suite.id }} (${{ matrix.build_config }})"
needs: build-ocean
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
suite:
- { id: testbase, test-directory: impl/ocean/test/testbase, ctest-args: "-E TestHighPerformanceTimer|TestSignal" }
- { id: testcv-AdvancedFrame, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -R TestAdvancedFrame" }
- { id: testcv-FrameConverter, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -R TestFrameConverter" }
- { id: testcv-FrameFilterScharr, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -R TestFrameFilterScharr" }
- { id: testcv-FrameFilter-Other, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -R TestFrameFilter -E TestFrameFilterScharr" }
- { id: testcv-FrameVariance, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -R TestFrameVariance" }
- { id: testcv-Frame-Other, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -R TestFrame -E TestFrameConverter|TestFrameFilter|TestFrameVariance|TestFrameInterpolator.ResizeUseCase_" }
- { id: testcv-Other, test-directory: impl/ocean/test/testcv, ctest-args: "-j 16 -E TestAdvancedFrame|TestFrame|TestFASTDetector.StandardStrength" }
- { id: testdevices, test-directory: impl/ocean/test/testdevices }
- { id: testgeometry, test-directory: impl/ocean/test/testgeometry, ctest-args: "-E TestStereoscopicGeometry.CameraPose_6DOF_100" }
- { id: testio, test-directory: impl/ocean/test/testio, ctest-args: "-E TestBasemap" }
- { id: testmath, test-directory: impl/ocean/test/testmath, ctest-args: "-E TestEquation.CubicEquation" }
- { id: testmedia, test-directory: impl/ocean/test/testmedia, ctest-args: "-E TestMovieGTestInstance" }
- { id: testnetwork, test-directory: impl/ocean/test/testnetwork }
- { id: testtracking, test-directory: impl/ocean/test/testtracking, ctest-args: "-E TestHomographyImageAlignmentDense.InverseCompositional_2" }
build_config: [debug, release]
steps:
- uses: actions/checkout@v5
- name: Restore Ocean build cache
uses: actions/cache/restore@v5
with:
path: ${{ env.OCEAN_BUILD_PATH }}
key: ocean-python-build-${{ matrix.build_config }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Run tests
run: |
mkdir -p $INSTALL_PATH/bin
cd $TEST_PATH
if !(ctest --output-on-failure $CTEST_ARGS); then
echo "::warning::Re-running failed tests"
ctest --output-on-failure $CTEST_ARGS --rerun-failed
fi
env:
INSTALL_PATH: ${{ env.OCEAN_INSTALL_PATH }}/linux_x86_64_static${{ matrix.build_config == 'debug' && '_debug' || '' }}
TEST_PATH: ${{ env.OCEAN_BUILD_PATH }}/linux_x86_64_static${{ matrix.build_config == 'debug' && '_debug' || '' }}/${{ matrix.suite.test-directory }}
CTEST_ARGS: ${{ matrix.suite.ctest-args }}