Skip to content

Commit

Permalink
Add build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanf committed Apr 5, 2024
1 parent a67c849 commit ff66f63
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 1 deletion.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build

on: [push]

jobs:

build:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8"]

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build Linux
run: bazel build -- //...
if: matrix.os != 'windows-latest'
- name: Build Windows
run: bazel build --cxxopt=/MT -- //...
if: matrix.os == 'windows-latest'
- name: Copy CLP libraries (Darwin)
run: |
mkdir -p "/Users/runner/work/Osi/Osi/dist/lib"
cp -rf "${GITHUB_WORKSPACE}/bazel-packingsolver/external/osi_darwin/lib/" "/Users/runner/work/Osi/Osi/dist/lib"
mkdir -p "/Users/runner/work/CoinUtils/CoinUtils/dist/lib"
cp -rf "${GITHUB_WORKSPACE}/bazel-packingsolver/external/coinutils_darwin/lib/" "/Users/runner/work/CoinUtils/CoinUtils/dist/lib"
mkdir -p "/Users/runner/work/Clp/Clp/dist/lib"
cp -rf "${GITHUB_WORKSPACE}/bazel-packingsolver/external/clp_darwin/lib/" "/Users/runner/work/Clp/Clp/dist/lib"
if: matrix.os == 'macos-latest'
- name: Run tests
run: python3 -u scripts/run_tests.py test_results
- name: Checkout main branch
run: |
git remote set-branches origin '*'
git fetch --depth 1
git checkout main
- name: Build Linux
run: bazel build -- //...
if: matrix.os != 'windows-latest'
- name: Build Windows
run: bazel build --cxxopt=/MT -- //...
if: matrix.os == 'windows-latest'
- name: Run tests
run: python3 -u scripts/run_tests.py test_results_ref
- name: Process tests
run: python3 -u ./bazel-packingsolver/external/optimizationtools/scripts/process_tests.py --ref test_results_ref --new test_results
46 changes: 46 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ cc_library(
""",
)

http_archive(
name = "osi_darwin",
urls = ["https://github.com/coin-or/Osi/releases/download/releases%2F0.108.8/Osi-releases.0.108.8-x86_64-macos106-clang140.tar.gz"],
sha256 = "4ddc1ee5cd5088aeb7795bfebc66beec8d7a0a3baec3dd3e8bbbdff17f93cd3f",
build_file_content = """
cc_library(
name = "osi",
hdrs = glob(["include/coin/Osi*.h*"], exclude_directories = 0),
strip_include_prefix = "include/coin/",
srcs = ["lib/libOsi.dylib", "lib/libOsiCommonTests.dylib"],
visibility = ["//visibility:public"],
)
""",
)

http_archive(
name = "coinutils_linux",
urls = ["https://github.com/coin-or/CoinUtils/releases/download/releases%2F2.11.9/CoinUtils-releases.2.11.9-x86_64-ubuntu20-gcc940-static.tar.gz"],
Expand Down Expand Up @@ -136,6 +151,21 @@ cc_library(
""",
)

http_archive(
name = "coinutils_darwin",
urls = ["https://github.com/coin-or/CoinUtils/releases/download/releases%2F2.11.9/CoinUtils-releases.2.11.9-x86_64-macos106-clang140.tar.gz"],
sha256 = "3d0bdaf7bb748bfbec059fc8ff6ff17d2354c334710db3cd532af6a9c942f762",
build_file_content = """
cc_library(
name = "coinutils",
hdrs = glob(["include/coin/Coin*.h*"], exclude_directories = 0),
strip_include_prefix = "include/coin/",
srcs = ["lib/libCoinUtils.dylib"],
visibility = ["//visibility:public"],
)
""",
)

http_archive(
name = "clp_linux",
urls = ["https://github.com/coin-or/Clp/releases/download/releases%2F1.17.8/Clp-releases.1.17.8-x86_64-ubuntu20-gcc940-static.tar.gz"],
Expand Down Expand Up @@ -168,6 +198,22 @@ cc_library(
""",
)

http_archive(
name = "clp_darwin",
urls = ["https://github.com/coin-or/Clp/releases/download/releases%2F1.17.8/Clp-releases.1.17.8-x86_64-macos106-clang140.tar.gz"],
sha256 = "fe9ce251cd3e0324d64f0e3956d722c73b7568685c25eb7559c327818b39b86b",
build_file_content = """
cc_library(
name = "clp",
hdrs = glob(["include/coin/*Clp*.h*"], exclude_directories = 0),
strip_include_prefix = "include/coin",
srcs = ["lib/libClp.dylib", "lib/libOsiClp.dylib"],
deps = ["@osi_darwin//:osi", "@coinutils_darwin//:coinutils"],
visibility = ["//visibility:public"],
)
""",
)

new_local_repository(
name = "cplex",
path = "/opt/ibm/ILOG/CPLEX_Studio129/",
Expand Down
6 changes: 5 additions & 1 deletion packingsolver/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ selects.config_setting_group(
match_all = [":clp_build", "@bazel_tools//src/conditions:windows"],
)

selects.config_setting_group(
name = "clp_darwin",
match_all = [":clp_build", "@bazel_tools//src/conditions:darwin"],
)

config_setting(
name = "cplex_build",
values = {"define": "cplex=true"},
Expand Down Expand Up @@ -45,4 +50,3 @@ load("//packingsolver:variables.bzl", "STDCPP",
"CPLEX_COPTS", "CPLEX_DEP",
"GUROBI_COPTS", "GUROBI_DEP",
"XPRESS_COPTS", "XPRESS_DEP")

3 changes: 3 additions & 0 deletions packingsolver/variables.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ CLP_DEP = select({
"//conditions:default": []
}) + select({
"//packingsolver:clp_linux": ["@clp_linux//:clp"],
"//conditions:default": []
}) + select({
"//packingsolver:clp_darwin": ["@clp_darwin//:clp"],
"//conditions:default": []})

CPLEX_COPTS = select({
Expand Down

0 comments on commit ff66f63

Please sign in to comment.