Skip to content

Commit ed44ef2

Browse files
authored
Merge pull request #7 from ERGO-Code/ortools-c
Ortools c
2 parents 23a3af3 + 9c06456 commit ed44ef2

File tree

4 files changed

+413
-0
lines changed

4 files changed

+413
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: ortools-macos
2+
3+
# on: [push, pull_request]
4+
5+
on:
6+
push:
7+
branches:
8+
- ortools
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{github.workflow}}-${{github.ref}}
14+
cancel-in-progress: true
15+
16+
# Building using the github runner environement directly.
17+
env:
18+
CCACHE_BASEDIR: ${{github.workspace}}
19+
CCACHE_DIR: ${{github.workspace}}/.ccache
20+
21+
jobs:
22+
run:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [macos-latest]
28+
cmake: [
29+
# {name: "Xcode", generator: "Xcode", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: install},
30+
{name: "Make", generator: "Unix Makefiles", config: Release, build_target: all, test_target: test, install_target: install},
31+
]
32+
name: CMake(${{matrix.cmake.name}})•C++
33+
env:
34+
deps_src_key: macos_cpp_deps_src
35+
deps_build_key: arm64_macos_cpp_deps_build_${{matrix.cmake.name}}
36+
ccache_key: arm64_macos_cpp_ccache_${{matrix.cmake.name}}
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Checkout ortools
42+
uses: actions/checkout@v4
43+
with:
44+
repository: google/or-tools
45+
ref: 9789365f574f5e4857117d410ff177bbbae622fd
46+
path: or-tools
47+
48+
- name: LS
49+
run: |
50+
pwd
51+
ls
52+
cd ${{github.workspace}}
53+
pwd
54+
ls
55+
56+
- name: Install Dependencies
57+
run: brew install ccache
58+
59+
# RESTORING CACHES
60+
- name: Restore CMake dependency source code
61+
uses: actions/cache/restore@v4
62+
id: deps_src_restore
63+
with:
64+
key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
65+
path: ${{github.workspace}}/or-tools/build/_deps/*-src
66+
- name: Restore CMake dependency build
67+
uses: actions/cache/restore@v4
68+
id: deps_build_restore
69+
with:
70+
key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
71+
path: |
72+
${{github.workspace}}/or-tools/build/_deps/*-build
73+
${{github.workspace}}/or-tools/build/_deps/*-subbuild
74+
- name: Restore CCache
75+
uses: actions/cache/restore@v4
76+
id: ccache_restore
77+
with:
78+
key: ${{env.ccache_key}}-${{github.sha}}
79+
restore-keys: ${{env.ccache_key}}-
80+
path: ${{env.CCACHE_DIR}}
81+
82+
- name: Patch OR-Tools
83+
run: |
84+
ls
85+
cd or-tools
86+
git apply ${{ github.workspace }}/patch.patch
87+
88+
- name: Create build and install dir
89+
run: |
90+
cmake -E make_directory ${{runner.workspace}}/installs
91+
92+
- name: Build OR-Tools
93+
run: |
94+
cd or-tools
95+
pwd
96+
cmake -S. -B build \
97+
-DBUILD_DEPS=ON \
98+
-DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/installs
99+
cmake --build build -v -j30
100+
cmake --install build
101+
102+
- name: CCache stats
103+
run: |
104+
ccache --show-stats
105+
ccache --zero-stats
106+
107+
# SAVING CACHES
108+
- name: Save CCache
109+
# if: github.ref == 'refs/heads/main'
110+
uses: actions/cache/save@v4
111+
with:
112+
key: ${{steps.ccache_restore.outputs.cache-primary-key}}
113+
path: ${{env.CCACHE_DIR}}
114+
- name: Save CMake dependency build
115+
# if: github.ref == 'refs/heads/main'
116+
uses: actions/cache/save@v4
117+
with:
118+
key: ${{steps.deps_build_restore.outputs.cache-primary-key}}
119+
path: |
120+
${{github.workspace}}/or-tools/build/_deps/*-build
121+
${{github.workspace}}/or-tools/build/_deps/*-subbuild
122+
- name: Save CMake dependency source code
123+
# if: github.ref == 'refs/heads/main'
124+
uses: actions/cache/save@v4
125+
with:
126+
key: ${{steps.deps_src_restore.outputs.cache-primary-key}}
127+
path: ${{github.workspace}}/or-tools/build/_deps/*-src
128+
129+
- name: Test executable
130+
run: |
131+
cd or-tools
132+
cd build
133+
./bin/solve \
134+
--solver=highs \
135+
--input=${{ github.workspace }}/or-tools/ortools/math_opt/solver_tests/testdata/beavma.mps
136+
137+
- name: Test HiGHS
138+
run: |
139+
cd or-tools
140+
./build/bin/math_opt_solvers_highs_solver_test
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: ortools-ubuntu
2+
3+
# on: [push, pull_request]
4+
5+
on:
6+
push:
7+
branches:
8+
- ortools-c
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{github.workflow}}-${{github.ref}}
14+
cancel-in-progress: true
15+
16+
# Building using the github runner environement directly.
17+
env:
18+
CCACHE_BASEDIR: ${{github.workspace}}
19+
CCACHE_DIR: ${{github.workspace}}/.ccache
20+
21+
jobs:
22+
run:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest]
28+
branch: [755a8e027a99a8d4ecf153a8dde4b2a767cdf384]
29+
env:
30+
deps_src_key: linux_cpp_deps_src-${{matrix.branch}}
31+
deps_build_key: linux_cpp_deps_build-${{matrix.branch}}
32+
ccache_key: amd64_linux_cpp_ccache-${{matrix.branch}}
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Checkout ortools
38+
uses: actions/checkout@v4
39+
with:
40+
repository: google/or-tools
41+
ref: 9789365f574f5e4857117d410ff177bbbae622fd
42+
path: or-tools
43+
44+
- name: LS
45+
run: |
46+
pwd
47+
ls
48+
cd ${{github.workspace}}
49+
pwd
50+
ls
51+
52+
- name: Install Dependencies
53+
run: |
54+
sudo apt update
55+
sudo apt install -y ninja-build ccache
56+
57+
# RESTORING CACHES
58+
- name: Restore CMake dependency source code
59+
uses: actions/cache/restore@v4
60+
id: deps_src_restore
61+
with:
62+
key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
63+
path: ${{github.workspace}}/or-tools/build/_deps/*-src
64+
- name: Restore CMake dependency build
65+
uses: actions/cache/restore@v4
66+
id: deps_build_restore
67+
with:
68+
key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
69+
path: |
70+
${{github.workspace}}/or-tools/build/_deps/*-build
71+
${{github.workspace}}/or-tools/build/_deps/*-subbuild
72+
- name: Restore CCache
73+
uses: actions/cache/restore@v4
74+
id: ccache_restore
75+
with:
76+
key: ${{env.ccache_key}}-${{github.sha}}
77+
restore-keys: ${{env.ccache_key}}-
78+
path: ${{env.CCACHE_DIR}}
79+
80+
- name: Patch OR-Tools
81+
run: |
82+
cd or-tools
83+
git apply ${{ github.workspace }}/patch.patch
84+
grep -A 1 HiGHS cmake/dependencies/CMakeLists.txt
85+
86+
- name: Create build and install dir
87+
run: |
88+
cmake -E make_directory ${{runner.workspace}}/installs
89+
90+
- name: Build OR-Tools
91+
run: |
92+
cd or-tools
93+
pwd
94+
cmake -S. -B build \
95+
-DBUILD_DEPS=ON \
96+
-DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/installs
97+
cmake --build build -v -j30
98+
cmake --install build
99+
ls
100+
101+
- name: CCache stats
102+
run: |
103+
ccache --show-stats
104+
ccache --zero-stats
105+
106+
# SAVING CACHES
107+
- name: Save CCache
108+
# if: github.ref == 'refs/heads/main'
109+
uses: actions/cache/save@v4
110+
with:
111+
key: ${{steps.ccache_restore.outputs.cache-primary-key}}
112+
path: ${{env.CCACHE_DIR}}
113+
- name: Save CMake dependency build
114+
# if: github.ref == 'refs/heads/main'
115+
uses: actions/cache/save@v4
116+
with:
117+
key: ${{steps.deps_build_restore.outputs.cache-primary-key}}
118+
path: |
119+
${{github.workspace}}/or-tools/build/_deps/*-build
120+
${{github.workspace}}/or-tools/build/_deps/*-subbuild
121+
- name: Save CMake dependency source code
122+
# if: github.ref == 'refs/heads/main'
123+
uses: actions/cache/save@v4
124+
with:
125+
key: ${{steps.deps_src_restore.outputs.cache-primary-key}}
126+
path: ${{github.workspace}}/or-tools/build/_deps/*-src
127+
128+
- name: Test executable
129+
run: |
130+
cd or-tools
131+
cd build
132+
./bin/solve \
133+
--solver=highs \
134+
--input=${{ github.workspace }}/or-tools/ortools/math_opt/solver_tests/testdata/beavma.mps
135+
136+
- name: Test HiGHS
137+
run: |
138+
cd or-tools
139+
./build/bin/math_opt_solvers_highs_solver_test

.github/workflows/ortools-win.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: ortools-win
2+
3+
# on: [push, pull_request]
4+
5+
on:
6+
push:
7+
branches:
8+
- ortools
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{github.workflow}}-${{github.ref}}
14+
cancel-in-progress: true
15+
16+
# Building using the github runner environement directly.
17+
env:
18+
CCACHE_BASEDIR: ${{github.workspace}}
19+
CCACHE_DIR: ${{github.workspace}}/.ccache
20+
21+
jobs:
22+
run:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [windows-latest]
28+
cmake: [
29+
{name: "VS2022", generator: "Visual Studio 17 2022", config: Release},
30+
# {name: "VS2022", generator: "Visual Studio 17 2022", config: Debug}, # too many symbols
31+
]
32+
name: CMake(${{matrix.cmake.name}},${{matrix.cmake.config}})
33+
env:
34+
deps_src_key: amd64_windows_cpp_deps_src
35+
deps_build_key: amd64_windows_cpp_deps_build_${{matrix.cmake.config}}
36+
CTEST_OUTPUT_ON_FAILURE: 1
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Checkout ortools
42+
uses: actions/checkout@v4
43+
with:
44+
repository: google/or-tools
45+
ref: 9789365f574f5e4857117d410ff177bbbae622fd
46+
path: or-tools
47+
48+
- name: LS
49+
run: |
50+
pwd
51+
ls
52+
cd ${{github.workspace}}
53+
pwd
54+
ls
55+
56+
# CONFIGURING CACHES
57+
- name: Cache CMake dependency source code
58+
uses: actions/cache@v4
59+
with:
60+
key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
61+
path: ${{github.workspace}}/build/_deps/*-src
62+
- name: Cache CMake dependency build
63+
uses: actions/cache@v4
64+
with:
65+
key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}}
66+
path: |
67+
${{github.workspace}}/build/_deps/*-build
68+
${{github.workspace}}/build/_deps/*-subbuild
69+
70+
- name: Patch OR-Tools
71+
run: |
72+
ls
73+
cd or-tools
74+
git apply ${{ github.workspace }}/patch.patch
75+
76+
- name: Create build and install dir
77+
run: |
78+
cmake -E make_directory ${{runner.workspace}}/installs
79+
80+
- name: Build OR-Tools
81+
run: |
82+
cd or-tools
83+
pwd
84+
cmake -S. -B build `
85+
-G "${{matrix.cmake.generator}}" `
86+
-DCMAKE_CONFIGURATION_TYPES=${{matrix.cmake.config}} `
87+
-DBUILD_DEPS=ON `
88+
-DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/installs
89+
cmake --build build -j2 --config Release
90+
cmake --install build
91+
92+
- name: Test executable
93+
run: |
94+
cd or-tools
95+
& ".\build\Release\bin\solve.exe" `
96+
--solver=highs `
97+
--input="${{ github.workspace }}/or-tools/ortools/math_opt/solver_tests/testdata/beavma.mps"
98+
99+
- name: Test HiGHS
100+
run: |
101+
cd or-tools
102+
./build/Release/bin/math_opt_solvers_highs_solver_test.exe

0 commit comments

Comments
 (0)