|
| 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 |
0 commit comments