|
1 | 1 | # ref: https://github.com/actions/runner-images |
2 | 2 | name: amd64 Linux CMake CoinOR OFF |
3 | 3 |
|
4 | | -on: [push, pull_request, workflow_dispatch] |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + workflow_dispatch: |
5 | 10 |
|
6 | 11 | concurrency: |
7 | 12 | group: ${{github.workflow}}-${{github.ref}} |
8 | 13 | cancel-in-progress: true |
9 | 14 |
|
10 | 15 | # Building using the github runner environement directly. |
| 16 | +env: |
| 17 | + CCACHE_BASEDIR: ${{github.workspace}} |
| 18 | + CCACHE_DIR: ${{github.workspace}}/.ccache |
| 19 | + |
11 | 20 | jobs: |
12 | 21 | native: |
13 | | - strategy: |
14 | | - matrix: |
15 | | - cmake: [ |
16 | | - {language: 'C++', args: '-DBUILD_CXX=ON'}, |
17 | | - {language: '.Net', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_DOTNET=ON'}, |
18 | | - {language: 'Java', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_JAVA=ON'}, |
19 | | - {language: 'Python', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON=ON'}, |
20 | | - ] |
21 | | - fail-fast: false |
22 | | - name: amd64•Linux•CMake•${{matrix.cmake.language}}•CoinOR=OFF |
| 22 | + name: amd64•Linux•CMake•CoinOR=OFF |
| 23 | + runs-on: ubuntu-latest |
| 24 | + env: |
| 25 | + deps_src_key: amd64_linux_coinor_deps_src |
| 26 | + deps_build_key: amd64_linux_coinor_deps_build |
| 27 | + ccache_key: amd64_linux_coinor_ccache |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v5 |
| 30 | + - name: Install Dependencies |
| 31 | + run: | |
| 32 | + sudo apt update |
| 33 | + sudo apt install -y ninja-build ccache swig |
| 34 | + swig -version |
| 35 | + # Install .NET SDKs |
| 36 | + - name: Setup .NET 8.0 |
| 37 | + uses: actions/setup-dotnet@v5 |
| 38 | + with: |
| 39 | + dotnet-version: 8.0.x |
| 40 | + - name: Check dotnet |
| 41 | + run: dotnet --info |
| 42 | + # Install Java |
| 43 | + - name: Check java |
| 44 | + run: java -version |
| 45 | + # Install Python |
| 46 | + - name: Install python3 venv |
| 47 | + run: sudo apt-get install python3-venv |
| 48 | + - name: Update Path |
| 49 | + run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 50 | + |
| 51 | + # RESTORING CACHES |
| 52 | + - name: Restore CMake dependency source code |
| 53 | + uses: actions/cache/restore@v4 |
| 54 | + id: deps_src_restore |
| 55 | + with: |
| 56 | + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} |
| 57 | + path: ${{github.workspace}}/build/_deps/*-src |
| 58 | + - name: Restore CMake dependency build |
| 59 | + uses: actions/cache/restore@v4 |
| 60 | + id: deps_build_restore |
| 61 | + with: |
| 62 | + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} |
| 63 | + path: | |
| 64 | + ${{github.workspace}}/build/_deps/*-build |
| 65 | + ${{github.workspace}}/build/_deps/*-subbuild |
| 66 | + - name: Restore CCache |
| 67 | + uses: actions/cache/restore@v4 |
| 68 | + id: ccache_restore |
| 69 | + with: |
| 70 | + key: ${{env.ccache_key}}-${{github.sha}} |
| 71 | + restore-keys: ${{env.ccache_key}}- |
| 72 | + path: ${{env.CCACHE_DIR}} |
| 73 | + |
| 74 | + - name: Check CMake |
| 75 | + run: cmake --version |
| 76 | + - name: Configure |
| 77 | + run: > |
| 78 | + cmake -S. -Bbuild |
| 79 | + -G "Ninja" |
| 80 | + -DCMAKE_BUILD_TYPE=Release |
| 81 | + -DBUILD_DOTNET=ON -DBUILD_JAVA=ON -DBUILD_PYTHON=ON |
| 82 | + -DUSE_GLPK=OFF -DUSE_SCIP=OFF |
| 83 | + -DUSE_COINOR=OFF |
| 84 | + -DCMAKE_INSTALL_PREFIX=install |
| 85 | + - name: Build |
| 86 | + run: > |
| 87 | + cmake --build build |
| 88 | + --config Release |
| 89 | + --target all |
| 90 | + -v -j2 |
| 91 | + - name: Test |
| 92 | + run: > |
| 93 | + CTEST_OUTPUT_ON_FAILURE=1 |
| 94 | + cmake --build build |
| 95 | + --config Release |
| 96 | + --target test |
| 97 | + -v |
| 98 | + - name: Install |
| 99 | + run: > |
| 100 | + cmake --build build |
| 101 | + --config Release |
| 102 | + --target install |
| 103 | + -v |
| 104 | + - name: CCache stats |
| 105 | + run: | |
| 106 | + ccache --show-stats |
| 107 | + ccache --zero-stats |
| 108 | +
|
| 109 | + # SAVING CACHES |
| 110 | + - name: Save CCache |
| 111 | + if: github.ref == 'refs/heads/main' |
| 112 | + uses: actions/cache/save@v4 |
| 113 | + with: |
| 114 | + key: ${{steps.ccache_restore.outputs.cache-primary-key}} |
| 115 | + path: ${{env.CCACHE_DIR}} |
| 116 | + - name: Save CMake dependency build |
| 117 | + if: github.ref == 'refs/heads/main' |
| 118 | + uses: actions/cache/save@v4 |
| 119 | + with: |
| 120 | + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} |
| 121 | + path: | |
| 122 | + ${{github.workspace}}/build/_deps/*-build |
| 123 | + ${{github.workspace}}/build/_deps/*-subbuild |
| 124 | + - name: Save CMake dependency source code |
| 125 | + if: github.ref == 'refs/heads/main' |
| 126 | + uses: actions/cache/save@v4 |
| 127 | + with: |
| 128 | + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} |
| 129 | + path: ${{github.workspace}}/build/_deps/*-src |
| 130 | + |
| 131 | + amd64_linux_cmake_coinor: |
23 | 132 | runs-on: ubuntu-latest |
| 133 | + needs: native |
24 | 134 | steps: |
25 | | - - uses: actions/checkout@v5 |
26 | | - # Install SWIG |
27 | | - - name: Swig install |
28 | | - run: sudo apt install -y swig |
29 | | - - name: Check swig |
30 | | - run: swig -version |
31 | | - # Install .NET SDKs |
32 | | - - name: Setup .NET 8.0 |
33 | | - uses: actions/setup-dotnet@v4 |
34 | | - with: |
35 | | - dotnet-version: 8.0.x |
36 | | - - name: Check dotnet |
37 | | - run: dotnet --info |
38 | | - # Install Java |
39 | | - - name: Check java |
40 | | - run: java -version |
41 | | - # Install Python |
42 | | - - name: Install python3 venv |
43 | | - run: sudo apt-get install python3-venv |
44 | | - - name: Update Path |
45 | | - run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
46 | | - # CMake |
47 | | - - name: Check cmake |
48 | | - run: cmake --version |
49 | | - - name: Configure |
50 | | - run: > |
51 | | - cmake -S. -Bbuild |
52 | | - -DCMAKE_BUILD_TYPE=Release |
53 | | - -DBUILD_DEPS=ON |
54 | | - -DUSE_COINOR=OFF |
55 | | - ${{matrix.cmake.args}} |
56 | | - - name: Build |
57 | | - run: > |
58 | | - cmake --build build |
59 | | - --config Release |
60 | | - --target all |
61 | | - -v -j2 |
62 | | - - name: Test |
63 | | - run: > |
64 | | - CTEST_OUTPUT_ON_FAILURE=1 |
65 | | - cmake --build build |
66 | | - --config Release |
67 | | - --target test |
68 | | - -v |
69 | | - - name: Install |
70 | | - run: > |
71 | | - cmake --build build |
72 | | - --config Release |
73 | | - --target install |
74 | | - -v |
75 | | - -- DESTDIR=install |
| 135 | + - uses: actions/checkout@v5 |
0 commit comments