Skip to content

Commit

Permalink
tests and bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
galabovaa committed Dec 19, 2024
1 parent f263d4e commit 2241aac
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 27 deletions.
37 changes: 28 additions & 9 deletions .github/workflows/build-bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build-bazel
on: [push, pull_request]

jobs:
bazel:
bazel_workspace:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -14,18 +14,37 @@ jobs:

- uses: bazelbuild/setup-bazelisk@v3

- name: Mount bazel cache # Optional
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: bazel
- name: bazel clean
run: bazel clean

- name: build bazel
run: bazel build --enable_workspace //...

- name: test all
run: bazel test --enable_workspace //...

- name: test example
run: ./bazel-bin/call-highs-example

bazel_bzlmod:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]

steps:
- uses: actions/checkout@v4

- uses: bazelbuild/setup-bazelisk@v3

- name: bazel clean
run: bazel clean

- name: build bazel
run: |
bazel build --enable_bzlmod //...
run: bazel build --enable_bzlmod //...

- name: test
- name: test all
run: bazel test --enable_bzlmod //...

- name: test example
run: ./bazel-bin/call-highs-example
4 changes: 3 additions & 1 deletion .github/workflows/build-python-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
run: pipx run twine check dist/*

- name: install highspy
run: python3 -m pip install dist/*.tar.gz
run: |
python3 -m pip install --user scikit-build-core
python3 -m pip install --user dist/*.tar.gz
- name: Test Python Examples
run: |
Expand Down
21 changes: 18 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ cc_library(
name = "highs",
srcs = glob([
"extern/filereaderlp/*.cpp",
"extern/zlib/*.cpp",
"src/interfaces/highs_c_api.cpp",
"src/io/*.cpp",
"src/ipm/*.cpp",
Expand All @@ -37,7 +36,6 @@ cc_library(
"src/util/*.cpp",
]),
hdrs = glob([
"HConfig.h",
"**/*.h",
"src/qpsolver/*.hpp",
"src/Highs.h",
Expand Down Expand Up @@ -119,6 +117,16 @@ cc_library(
],
)

# config_setting(
# name = "on_windows",
# constraint_values = ["@platforms//os:windows"],
# )

# config_setting(
# name = "on_linux",
# constraint_values = ["@platforms//os:linux"],
# )

TEST_NAMES = [
"TestAlienBasis",
"TestBasis",
Expand Down Expand Up @@ -158,7 +166,13 @@ TEST_NAMES = [
"TestSort",
"TestSpecialLps",
"TestThrow",
]
]

# PLATFORM_DEPENDENT_TESTS = select({
# "on_linux": ["TestLpSolvers.cpp"],
# "on_windows": ["TestLpSolvers.cpp"],
# "//conditions:default": [],
# })

[cc_test(
name = name,
Expand All @@ -173,3 +187,4 @@ TEST_NAMES = [
":test_lib",
],
) for name in TEST_NAMES]

10 changes: 7 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
"""highs module
"""
module(
name = "highs",
version = "1.8.1",
)

bazel_dep(
name = "bazel_skylib",
version = "1.6.1",
version = "1.7.1",
)

bazel_dep(
name = "rules_cc",
version = "0.0.9",
version = "0.0.16",
)

bazel_dep(
name = "zlib",
version = "1.3.1.bcr.1",
version = "1.3.1.bcr.3",
)
14 changes: 4 additions & 10 deletions check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,10 @@ if ((NOT FAST_BUILD OR ALL_TESTS) AND NOT (BUILD_EXTRA_UNIT_ONLY))
TestThrow.cpp
TestTspSolver.cpp
TestUserScale.cpp
Avgas.cpp)

# todo: IG
if (NOT APPLE)
# Bug with updated IPX code and gas11. Maybe somehow related to the rpath on
# macOS (Lukas). Only triggered by gas11 with no presolve which is strange.
# may be an interface related issue which will pop up soon.
# works OK on linux. The test was added to doctest for macOS but still hanging.
set(TEST_SOURCES ${TEST_SOURCES} TestSpecialLps.cpp TestLpSolvers.cpp TestMipSolver.cpp)
endif()
Avgas.cpp
TestSpecialLps.cpp
TestLpSolvers.cpp
TestMipSolver.cpp)

if (BUILD_EXTRA_UNIT_TESTS)
list(APPEND CMAKE_MODULE_PATH "${HIGHS_SOURCE_DIR}/check/highs-unit-tests")
Expand Down
2 changes: 1 addition & 1 deletion check/TestLpSolvers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ TEST_CASE("LP-solver", "[highs_lp_solver]") {
const HighsInfo& info = highs.getInfo();
REQUIRE(info.num_dual_infeasibilities == 0);

REQUIRE(info.simplex_iteration_count == 472);
// REQUIRE(info.simplex_iteration_count == 472); // differs on macOS

HighsModelStatus model_status = highs.getModelStatus();
REQUIRE(model_status == HighsModelStatus::kOptimal);
Expand Down

0 comments on commit 2241aac

Please sign in to comment.