Skip to content

Commit dd66745

Browse files
authored
Merge pull request #3085 from amontoison/am/hipo-c
Add reverse CI to test Uno with HiGHS and HiPO
2 parents 7363d01 + 4c0d806 commit dd66745

1 file changed

Lines changed: 188 additions & 0 deletions

File tree

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# Check that the current HiGHS PR does not break Uno.
2+
#
3+
# uno-highs: current LP / QP solver interface of HiGHS vs the latest Uno release.
4+
# uno-hipo: HiPO linear solver interface (still in flight) vs Uno's `hipo` branch.
5+
name: uno-reverse-ci
6+
7+
on:
8+
push:
9+
branches: [hipo-c, latest, master]
10+
pull_request:
11+
branches: [hipo-c, latest, master]
12+
workflow_dispatch:
13+
inputs:
14+
uno_repository:
15+
description: "Uno repository (owner/name)"
16+
default: "cvanaret/Uno"
17+
uno_highs_ref:
18+
description: "uno-highs job: Uno tag/branch/SHA to test (empty = latest Uno release)"
19+
default: ""
20+
uno_hipo_ref:
21+
description: "uno-hipo job: Uno tag/branch/SHA to test (the in-flight HiPO branch)"
22+
default: "hipo"
23+
schedule:
24+
- cron: "0 6 * * 1"
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
30+
jobs:
31+
uno-highs:
32+
runs-on: ${{ matrix.os }}
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: [ubuntu-latest, macos-latest]
37+
steps:
38+
- name: Checkout HiGHS (current branch)
39+
uses: actions/checkout@v4
40+
with:
41+
path: HiGHS
42+
43+
- name: Install dependencies (Linux)
44+
if: runner.os == 'Linux'
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y cmake g++ git libopenblas-dev liblapack-dev
48+
49+
- name: Install dependencies (macOS)
50+
if: runner.os == 'macOS'
51+
run: brew install cmake openblas lapack gcc
52+
53+
- name: Build and install HiGHS
54+
run: |
55+
echo "HiGHS commit: $(git -C HiGHS rev-parse --short HEAD)"
56+
cmake -S HiGHS -B HiGHS/build \
57+
-DCMAKE_BUILD_TYPE=Release \
58+
-DFAST_BUILD=ON \
59+
-DALL_TESTS=OFF \
60+
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/highs-install
61+
cmake --build HiGHS/build --parallel
62+
cmake --install HiGHS/build
63+
64+
- name: Resolve latest Uno release tag
65+
id: uno_release
66+
run: |
67+
ref="${{ github.event.inputs.uno_highs_ref }}"
68+
if [ -z "$ref" ]; then
69+
repo="${{ github.event.inputs.uno_repository || 'cvanaret/Uno' }}"
70+
ref=$(curl -fsSL \
71+
-H "Authorization: Bearer ${{ github.token }}" \
72+
-H "Accept: application/vnd.github+json" \
73+
"https://api.github.com/repos/${repo}/releases/latest" | jq -r .tag_name)
74+
fi
75+
[ -n "$ref" ] && [ "$ref" != "null" ] || { echo "no Uno release found"; exit 1; }
76+
echo "ref=$ref" >> "$GITHUB_OUTPUT"
77+
echo "Uno release ref: $ref"
78+
79+
- name: Checkout Uno (latest release)
80+
uses: actions/checkout@v4
81+
with:
82+
repository: ${{ github.event.inputs.uno_repository || 'cvanaret/Uno' }}
83+
ref: ${{ steps.uno_release.outputs.ref }}
84+
path: Uno
85+
86+
- name: Build Uno against HiGHS
87+
run: |
88+
echo "Uno commit: $(git -C Uno rev-parse --short HEAD)"
89+
# macOS: point the linker at libgfortran (Uno links -lgfortran without its -L path).
90+
ldflags=""
91+
if [ "$RUNNER_OS" = "macOS" ]; then
92+
gfdir=$(dirname "$(gfortran -print-file-name=libgfortran.dylib)")
93+
ldflags="-DCMAKE_EXE_LINKER_FLAGS=-L${gfdir} -DCMAKE_SHARED_LINKER_FLAGS=-L${gfdir}"
94+
fi
95+
cmake -S Uno -B Uno/build \
96+
-DCMAKE_BUILD_TYPE=Release \
97+
-DENABLE_TESTS=ON \
98+
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/highs-install \
99+
-DHIGHS_INCLUDE_DIR=${{ github.workspace }}/highs-install/include/highs \
100+
$ldflags
101+
cmake --build Uno/build --target run_unotest --parallel
102+
103+
- name: Run Uno tests (HiGHS solver)
104+
run: |
105+
libdir="${{ github.workspace }}/highs-install/lib"
106+
if [ "$RUNNER_OS" = "macOS" ]; then
107+
export DYLD_LIBRARY_PATH="$libdir:$DYLD_LIBRARY_PATH"
108+
else
109+
export LD_LIBRARY_PATH="$libdir:$LD_LIBRARY_PATH"
110+
fi
111+
# --no-tests=error fails if HiGHS was not built into Uno (no test matched).
112+
ctest --test-dir Uno/build -R HiGHSSolver --output-on-failure --no-tests=error
113+
114+
uno-hipo:
115+
runs-on: ${{ matrix.os }}
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
# ON = shared extras (libhighs_extras.so, dlopen'd), OFF = static extras (linked in).
120+
os: [ubuntu-latest]
121+
extras: ["ON", "OFF"]
122+
include:
123+
- os: macos-latest
124+
extras: "ON"
125+
steps:
126+
- name: Checkout HiGHS (current branch)
127+
uses: actions/checkout@v4
128+
with:
129+
path: HiGHS
130+
131+
- name: Install dependencies (Linux)
132+
if: runner.os == 'Linux'
133+
run: |
134+
sudo apt-get update
135+
sudo apt-get install -y cmake g++ git libopenblas-dev liblapack-dev
136+
137+
- name: Install dependencies (macOS)
138+
if: runner.os == 'macOS'
139+
run: brew install cmake openblas lapack gcc
140+
141+
- name: Build and install HiGHS with HiPO (BUILD_SHARED_EXTRAS_LIB=${{ matrix.extras }})
142+
run: |
143+
echo "HiGHS commit: $(git -C HiGHS rev-parse --short HEAD)"
144+
cmake -S HiGHS -B HiGHS/build \
145+
-DCMAKE_BUILD_TYPE=Release \
146+
-DHIPO=ON \
147+
-DFAST_BUILD=ON \
148+
-DBUILD_SHARED_EXTRAS_LIB=${{ matrix.extras }} \
149+
-DALL_TESTS=OFF \
150+
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/highs-install
151+
cmake --build HiGHS/build --parallel
152+
cmake --install HiGHS/build
153+
154+
- name: Checkout Uno (HiPO branch)
155+
uses: actions/checkout@v4
156+
with:
157+
repository: ${{ github.event.inputs.uno_repository || 'cvanaret/Uno' }}
158+
ref: ${{ github.event.inputs.uno_hipo_ref || 'hipo' }}
159+
path: Uno
160+
161+
- name: Build Uno against HiGHS with HiPO
162+
run: |
163+
echo "Uno commit: $(git -C Uno rev-parse --short HEAD)"
164+
# macOS: point the linker at libgfortran (Uno links -lgfortran without its -L path).
165+
ldflags=""
166+
if [ "$RUNNER_OS" = "macOS" ]; then
167+
gfdir=$(dirname "$(gfortran -print-file-name=libgfortran.dylib)")
168+
ldflags="-DCMAKE_EXE_LINKER_FLAGS=-L${gfdir} -DCMAKE_SHARED_LINKER_FLAGS=-L${gfdir}"
169+
fi
170+
cmake -S Uno -B Uno/build \
171+
-DCMAKE_BUILD_TYPE=Release \
172+
-DENABLE_TESTS=ON \
173+
-DHIGHS_WITH_HIPO=ON \
174+
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/highs-install \
175+
-DHIGHS_INCLUDE_DIR=${{ github.workspace }}/highs-install/include/highs \
176+
$ldflags
177+
cmake --build Uno/build --target run_unotest --parallel
178+
179+
- name: Run Uno tests (HiPO solver)
180+
run: |
181+
libdir="${{ github.workspace }}/highs-install/lib:${{ github.workspace }}/HiGHS/build/lib"
182+
if [ "$RUNNER_OS" = "macOS" ]; then
183+
export DYLD_LIBRARY_PATH="$libdir:$DYLD_LIBRARY_PATH"
184+
else
185+
export LD_LIBRARY_PATH="$libdir:$LD_LIBRARY_PATH"
186+
fi
187+
# --no-tests=error fails if HiPO was not built into Uno (no test matched).
188+
ctest --test-dir Uno/build -R HiPOSolver --output-on-failure --no-tests=error

0 commit comments

Comments
 (0)