diff --git a/.github/workflows/aarch64_toolchain.yml b/.github/workflows/aarch64_toolchain.yml index ba441f646c..2dcd2f7078 100644 --- a/.github/workflows/aarch64_toolchain.yml +++ b/.github/workflows/aarch64_toolchain.yml @@ -1,7 +1,7 @@ # ref: https://toolchains.bootlin.com/ name: aarch64 Toolchain -on: [push, pull_request, workflow_dispatch] +on: [workflow_dispatch] concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/amd64_cmake_glop_cpp.yml b/.github/workflows/amd64_cmake_glop_cpp.yml index bf214fecf9..46fc59ec2e 100644 --- a/.github/workflows/amd64_cmake_glop_cpp.yml +++ b/.github/workflows/amd64_cmake_glop_cpp.yml @@ -1,7 +1,12 @@ # ref: https://github.com/actions/runner-images name: amd64 CMake Glop C++ -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/amd64_docker_bazel.yml b/.github/workflows/amd64_docker_bazel.yml index 01cfd8666e..41bb700f27 100644 --- a/.github/workflows/amd64_docker_bazel.yml +++ b/.github/workflows/amd64_docker_bazel.yml @@ -1,7 +1,12 @@ # ref: https://github.com/docker-library/official-images name: amd64 Docker Bazel -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/amd64_docker_cmake.yml b/.github/workflows/amd64_docker_cmake.yml index e514158d0c..573c8b8867 100644 --- a/.github/workflows/amd64_docker_cmake.yml +++ b/.github/workflows/amd64_docker_cmake.yml @@ -1,7 +1,12 @@ # ref: https://github.com/docker-library/official-images name: amd64 Docker CMake -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/amd64_freebsd_cmake.yml b/.github/workflows/amd64_freebsd_cmake.yml index 7c7579928b..679eb4fab0 100644 --- a/.github/workflows/amd64_freebsd_cmake.yml +++ b/.github/workflows/amd64_freebsd_cmake.yml @@ -1,7 +1,7 @@ # ref: https://github.com/actions/runner-images name: amd64 FreeBSD CMake -on: [push, pull_request, workflow_dispatch] +on: [workflow_dispatch] concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/amd64_linux_bazel.yml b/.github/workflows/amd64_linux_bazel.yml index 1000515ea0..cef3600e54 100644 --- a/.github/workflows/amd64_linux_bazel.yml +++ b/.github/workflows/amd64_linux_bazel.yml @@ -1,15 +1,23 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux Bazel -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true +env: + cache-root: /tmp/bazel + # Building using the github runner environement directly. jobs: - native: + amd64-Linux-Bazel-Python: strategy: matrix: python: [ @@ -19,11 +27,11 @@ jobs: #{version: '3.13'}, ] fail-fast: false - name: amd64•Linux•Bazel•Python-${{matrix.python.version}} - runs-on: ubuntu-latest env: CC: gcc-12 CXX: g++-12 + cache-name: ${{github.job}}-${{matrix.python.version}} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Check Java @@ -31,7 +39,7 @@ jobs: - name: Check mvn run: mvn --version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Check Python @@ -53,21 +61,26 @@ jobs: run: | sed -i -e 's/\(DEFAULT_PYTHON =\) "3.[0-9]\+"/\1 "${{matrix.python.version}}"/g' MODULE.bazel cat MODULE.bazel + - name: Restore bazel cache + uses: actions/cache/restore@v4 + id: bazel-cache-restore + with: + key: ${{env.cache-name}} + path: ${{env.cache-root}} - name: Build - run: > - bazel build - -c opt - --subcommands=pretty_print - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} build --config=ci //ortools/... //examples/... - name: Test - run: > - bazel test - -c opt - --test_output=errors - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} test --config=ci //ortools/... //examples/... + - name: Save Bazel cache for branch main even when Build and Test fail. + uses: actions/cache/save@v4 + # https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache + if: always() && github.ref == 'refs/heads/main' + with: + key: ${{env.cache-name}}-${{github.sha}} + path: ${{env.cache-root}} amd64_linux_bazel: runs-on: ubuntu-latest - needs: native + needs: amd64-Linux-Bazel-Python steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/amd64_linux_cmake_coinor_off.yml b/.github/workflows/amd64_linux_cmake_coinor_off.yml index c9d3f1e5e5..ab00314f41 100644 --- a/.github/workflows/amd64_linux_cmake_coinor_off.yml +++ b/.github/workflows/amd64_linux_cmake_coinor_off.yml @@ -1,75 +1,135 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake CoinOR OFF -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: - strategy: - matrix: - cmake: [ - {language: 'C++', args: '-DBUILD_CXX=ON'}, - {language: '.Net', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_DOTNET=ON'}, - {language: 'Java', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_JAVA=ON'}, - {language: 'Python', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON=ON'}, - ] - fail-fast: false - name: amd64•Linux•CMake•${{matrix.cmake.language}}•CoinOR=OFF + name: amd64•Linux•CMake•CoinOR=OFF runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_coinor_deps_src + deps_build_key: amd64_linux_coinor_deps_build + ccache_key: amd64_linux_coinor_ccache steps: - - uses: actions/checkout@v5 - # Install SWIG - - name: Swig install - run: sudo apt install -y swig - - name: Check swig - run: swig -version - # Install .NET SDKs - - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Check dotnet - run: dotnet --info - # Install Java - - name: Check java - run: java -version - # Install Python - - name: Install python3 venv - run: sudo apt-get install python3-venv - - name: Update Path - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - # CMake - - name: Check cmake - run: cmake --version - - name: Configure - run: > - cmake -S. -Bbuild - -DCMAKE_BUILD_TYPE=Release - -DBUILD_DEPS=ON - -DUSE_COINOR=OFF - ${{matrix.cmake.args}} - - name: Build - run: > - cmake --build build - --config Release - --target all - -v -j2 - - name: Test - run: > - CTEST_OUTPUT_ON_FAILURE=1 - cmake --build build - --config Release - --target test - -v - - name: Install - run: > - cmake --build build - --config Release - --target install - -v - -- DESTDIR=install + - uses: actions/checkout@v5 + - name: Install Dependencies + run: | + sudo apt update + sudo apt install -y ninja-build ccache swig + swig -version + # Install .NET SDKs + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.0.x + - name: Check dotnet + run: dotnet --info + # Install Java + - name: Check java + run: java -version + # Install Python + - name: Install python3 venv + run: sudo apt-get install python3-venv + - name: Update Path + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + + - name: Check CMake + run: cmake --version + - name: Configure + run: > + cmake -S. -Bbuild + -G "Ninja" + -DCMAKE_BUILD_TYPE=Release + -DBUILD_DOTNET=ON -DBUILD_JAVA=ON -DBUILD_PYTHON=ON + -DUSE_GLPK=OFF -DUSE_SCIP=OFF + -DUSE_COINOR=OFF + -DCMAKE_INSTALL_PREFIX=install + - name: Build + run: > + cmake --build build + --config Release + --target all + -v -j2 + - name: Test + run: > + CTEST_OUTPUT_ON_FAILURE=1 + cmake --build build + --config Release + --target test + -v + - name: Install + run: > + cmake --build build + --config Release + --target install + -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src + + amd64_linux_cmake_coinor: + runs-on: ubuntu-latest + needs: native + steps: + - uses: actions/checkout@v5 diff --git a/.github/workflows/amd64_linux_cmake_cpp.yml b/.github/workflows/amd64_linux_cmake_cpp.yml index ff4a10af3a..6c84859dad 100644 --- a/.github/workflows/amd64_linux_cmake_cpp.yml +++ b/.github/workflows/amd64_linux_cmake_cpp.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake C++ -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -15,17 +24,45 @@ jobs: cmake: [ {name: "Make", generator: "Unix Makefiles", config: Release}, {name: "Ninja", generator: "Ninja", config: Release}, - {name: "Ninja Multi", generator: "Ninja Multi-Config", config: Release}, - ] + {name: "NinjaMulti", generator: "Ninja Multi-Config", config: Release} + ] fail-fast: false name: amd64•Linux•CMake(${{matrix.cmake.name}})•C++ runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_cpp_deps_src + deps_build_key: amd64_linux_cpp_deps_build_${{matrix.cmake.name}} + ccache_key: amd64_linux_cpp_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Install Ninja + - name: Install Dependencies run: | - sudo apt-get update - sudo apt-get install ninja-build + sudo apt update + sudo apt install -y ninja-build ccache + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -54,6 +91,32 @@ jobs: --config ${{matrix.cmake.config}} --target install -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_linux_cmake_cpp: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_linux_cmake_dotnet.yml b/.github/workflows/amd64_linux_cmake_dotnet.yml index 176d21297c..90860faa69 100644 --- a/.github/workflows/amd64_linux_cmake_dotnet.yml +++ b/.github/workflows/amd64_linux_cmake_dotnet.yml @@ -1,34 +1,73 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake .Net -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: name: amd64•Linux•CMake•.Net runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_dotnet_deps_src + deps_build_key: amd64_linux_dotnet_deps_build + ccache_key: amd64_linux_dotnet_ccache steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - sudo apt install -y swig + sudo apt update + sudo apt install -y ninja-build ccache swig swig -version - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: dotnet-version: 8.0.x - name: Check dotnet run: dotnet --info + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure run: > cmake -S. -Bbuild + -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_DOTNET=ON @@ -52,6 +91,32 @@ jobs: --config Release --target install -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_linux_cmake_dotnet: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_linux_cmake_glpk_on.yml b/.github/workflows/amd64_linux_cmake_glpk_on.yml index c5062902e1..43519f09bb 100644 --- a/.github/workflows/amd64_linux_cmake_glpk_on.yml +++ b/.github/workflows/amd64_linux_cmake_glpk_on.yml @@ -1,28 +1,87 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake GLPK ON -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: name: amd64•Linux•CMake•GLPK=ON runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_glpk_deps_src + deps_build_key: amd64_linux_glpk_deps_build + ccache_key: amd64_linux_glpk_ccache steps: - uses: actions/checkout@v5 - - name: Check cmake + - name: Install Dependencies + run: | + sudo apt update + sudo apt install -y ninja-build ccache swig + swig -version + # Install .NET SDKs + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.0.x + - name: Check dotnet + run: dotnet --info + # Install Java + - name: Check java + run: java -version + # Install Python + - name: Install python3 venv + run: sudo apt-get install python3-venv + - name: Update Path + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + + - name: Check CMake run: cmake --version - name: Configure run: > cmake -S. -Bbuild + -G "Ninja" -DCMAKE_BUILD_TYPE=Release - -DBUILD_DEPS=ON + -DBUILD_DOTNET=ON -DBUILD_JAVA=ON -DBUILD_PYTHON=ON -DUSE_SCIP=OFF -DUSE_COINOR=OFF -DUSE_GLPK=ON + -DCMAKE_INSTALL_PREFIX=install - name: Build run: > cmake --build build @@ -42,4 +101,35 @@ jobs: --config Release --target install -v - -- DESTDIR=install + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src + + amd64_linux_cmake_glpk: + runs-on: ubuntu-latest + needs: native + steps: + - uses: actions/checkout@v5 diff --git a/.github/workflows/amd64_linux_cmake_java.yml b/.github/workflows/amd64_linux_cmake_java.yml index 2dd5bcec0b..1e6756c7e0 100644 --- a/.github/workflows/amd64_linux_cmake_java.yml +++ b/.github/workflows/amd64_linux_cmake_java.yml @@ -1,30 +1,69 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake Java -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: name: amd64•Linux•CMake•Java runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_java_deps_src + deps_build_key: amd64_linux_java_deps_build + ccache_key: amd64_linux_java_ccache steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - sudo apt install -y swig + sudo apt update + sudo apt install -y ninja-build ccache swig swig -version - name: Check java run: java -version + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure run: > cmake -S. -Bbuild + -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_JAVA=ON -DSKIP_GPG=ON @@ -48,6 +87,32 @@ jobs: --config Release --target install -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_linux_cmake_java: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_linux_cmake_python.yml b/.github/workflows/amd64_linux_cmake_python.yml index 0aa7174fb3..0879a5f938 100644 --- a/.github/workflows/amd64_linux_cmake_python.yml +++ b/.github/workflows/amd64_linux_cmake_python.yml @@ -1,77 +1,132 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake Python -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: matrix: - cmake: [ - {name: "Make", generator: "Unix Makefiles", config: Release}, - {name: "Ninja", generator: "Ninja", config: Release}, - {name: "Ninja Multi", generator: "Ninja Multi-Config", config: Release}, - ] python: [ {version: "3.9"}, - {version: "3.10"}, - {version: "3.11"}, - {version: "3.12"}, + #{version: "3.10"}, + #{version: "3.11"}, + #{version: "3.12"}, {version: "3.13"}, - ] + ] fail-fast: false - name: amd64•Linux•CMake(${{matrix.cmake.name}})•Python-${{matrix.python.version}} + name: amd64•Linux•CMake•Python${{matrix.python.version}} runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_python_deps_src_${{matrix.python.version}} + deps_build_key: amd64_linux_python_deps_build_${{matrix.python.version}} + ccache_key: amd64_linux_python_ccache_${{matrix.python.version}} steps: - uses: actions/checkout@v5 - - name: Install Ninja + - name: Install Dependencies run: | sudo apt update - sudo apt install -y ninja-build - - name: Swig install - run: | - sudo apt install -y swig + sudo apt install -y ninja-build ccache swig swig -version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Update Path run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure run: > cmake -S. -Bbuild - -G "${{matrix.cmake.generator}}" - -DCMAKE_BUILD_TYPE=${{matrix.cmake.config}} + -G "Ninja" + -DCMAKE_BUILD_TYPE=Release -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON=ON -DCMAKE_INSTALL_PREFIX=install - name: Build run: > cmake --build build - --config ${{matrix.cmake.config}} + --config Release --target all -v -j2 - name: Test run: > CTEST_OUTPUT_ON_FAILURE=1 cmake --build build - --config ${{matrix.cmake.config}} + --config Release --target test -v - name: Install run: > cmake --build build - --config ${{matrix.cmake.config}} + --config Release --target install -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_linux_cmake_python: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_linux_cmake_scip_off.yml b/.github/workflows/amd64_linux_cmake_scip_off.yml index 71a3e1693b..2b9f960c6a 100644 --- a/.github/workflows/amd64_linux_cmake_scip_off.yml +++ b/.github/workflows/amd64_linux_cmake_scip_off.yml @@ -1,75 +1,135 @@ # ref: https://github.com/actions/runner-images name: amd64 Linux CMake SCIP OFF -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: - strategy: - matrix: - cmake: [ - {language: 'C++', args: '-DBUILD_CXX=ON'}, - {language: '.Net', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_DOTNET=ON'}, - {language: 'Java', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_JAVA=ON'}, - {language: 'Python', args: '-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON=ON'}, - ] - fail-fast: false - name: amd64•Linux•CMake•${{matrix.cmake.language}}•SCIP=OFF + name: amd64•Linux•CMake•SCIP=OFF runs-on: ubuntu-latest + env: + deps_src_key: amd64_linux_scip_deps_src + deps_build_key: amd64_linux_scip_deps_build + ccache_key: amd64_linux_scip_ccache steps: - - uses: actions/checkout@v5 - # Install SWIG - - name: Swig install - run: sudo apt install -y swig - - name: Check swig - run: swig -version - # Install .NET SDKs - - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Check dotnet - run: dotnet --info - # Install Java - - name: Check java - run: java -version - # Install Python - - name: Install python3 venv - run: sudo apt-get install python3-venv - - name: Update Path - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - # CMake - - name: Check cmake - run: cmake --version - - name: Configure - run: > - cmake -S. -Bbuild - -DCMAKE_BUILD_TYPE=Release - -DBUILD_DEPS=ON - -DUSE_SCIP=OFF - ${{matrix.cmake.args}} - - name: Build - run: > - cmake --build build - --config Release - --target all - -v -j2 - - name: Test - run: > - CTEST_OUTPUT_ON_FAILURE=1 - cmake --build build - --config Release - --target test - -v - - name: Install - run: > - cmake --build build - --config Release - --target install - -v - -- DESTDIR=install + - uses: actions/checkout@v5 + - name: Install Dependencies + run: | + sudo apt update + sudo apt install -y ninja-build ccache swig + swig -version + # Install .NET SDKs + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.0.x + - name: Check dotnet + run: dotnet --info + # Install Java + - name: Check java + run: java -version + # Install Python + - name: Install python3 venv + run: sudo apt-get install python3-venv + - name: Update Path + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + + - name: Check CMake + run: cmake --version + - name: Configure + run: > + cmake -S. -Bbuild + -G "Ninja" + -DCMAKE_BUILD_TYPE=Release + -DBUILD_DOTNET=ON -DBUILD_JAVA=ON -DBUILD_PYTHON=ON + -DUSE_COINOR=OFF -DUSE_GLPK=OFF + -DUSE_SCIP=OFF + -DCMAKE_INSTALL_PREFIX=install + - name: Build + run: > + cmake --build build + --config Release + --target all + -v -j2 + - name: Test + run: > + CTEST_OUTPUT_ON_FAILURE=1 + cmake --build build + --config Release + --target test + -v + - name: Install + run: > + cmake --build build + --config Release + --target install + -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src + + amd64_linux_cmake_scip: + runs-on: ubuntu-latest + needs: native + steps: + - uses: actions/checkout@v5 diff --git a/.github/workflows/amd64_linux_cmake_system_deps.yml b/.github/workflows/amd64_linux_cmake_system_deps.yml index e3d0c2a378..40536e3f8c 100644 --- a/.github/workflows/amd64_linux_cmake_system_deps.yml +++ b/.github/workflows/amd64_linux_cmake_system_deps.yml @@ -1,14 +1,19 @@ # Test or-tools using system wide install dependencies. name: amd64 Linux CMake System Dependencies -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true jobs: - native: + docker: strategy: matrix: distro: [system_deps] diff --git a/.github/workflows/amd64_macos_bazel.yml b/.github/workflows/amd64_macos_bazel.yml index 08236edd8e..ae1810691d 100644 --- a/.github/workflows/amd64_macos_bazel.yml +++ b/.github/workflows/amd64_macos_bazel.yml @@ -1,15 +1,23 @@ # ref: https://github.com/actions/runner-images name: amd64 MacOS Bazel -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true +env: + cache-root: /private/tmp/bazel + # Building using the github runner environement directly. jobs: - native: + amd64-MacOS-Bazel-Python: strategy: matrix: python: [ @@ -19,19 +27,20 @@ jobs: #{version: '3.13'}, ] fail-fast: false - name: amd64•MacOS•Bazel•Python-${{matrix.python.version}} + env: + cache-name: ${{github.job}}-${{matrix.python.version}} runs-on: macos-13 # last macos intel based runner steps: - uses: actions/checkout@v5 - name: Set Java to OpenJDK 17 (Temurin) - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '17' - name: Check mvn run: mvn --version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Check Python @@ -46,21 +55,26 @@ jobs: run: | sed -i '' -e 's/\(DEFAULT_PYTHON =\) "3.[0-9]*"/\1 "${{matrix.python.version}}"/g' MODULE.bazel cat MODULE.bazel + - name: Restore bazel cache + uses: actions/cache/restore@v4 + id: bazel-cache-restore + with: + key: ${{env.cache-name}} + path: ${{env.cache-root}} - name: Build - run: > - bazel build - -c opt - --subcommands=pretty_print - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} build --config=ci //ortools/... //examples/... - name: Test - run: > - bazel test - -c opt - --test_output=errors - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} test --config=ci //ortools/... //examples/... + - name: Save Bazel cache for branch main even when Build and Test fail. + uses: actions/cache/save@v4 + # https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache + if: always() && github.ref == 'refs/heads/main' + with: + key: ${{env.cache-name}}-${{github.sha}} + path: ${{env.cache-root}} amd64_macos_bazel: runs-on: ubuntu-latest - needs: native + needs: amd64-MacOS-Bazel-Python steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/amd64_macos_cmake_cpp.yml b/.github/workflows/amd64_macos_cmake_cpp.yml index c6fb2327ff..fbcabdd0de 100644 --- a/.github/workflows/amd64_macos_cmake_cpp.yml +++ b/.github/workflows/amd64_macos_cmake_cpp.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: amd64 MacOS CMake C++ -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -19,8 +28,38 @@ jobs: fail-fast: false name: amd64•MacOS•CMake(${{matrix.cmake.name}})•C++ runs-on: macos-13 # last macos intel based runner + env: + deps_src_key: amd64_macos_cpp_deps_src + deps_build_key: amd64_macos_cpp_deps_build_${{matrix.cmake.name}} + ccache_key: amd64_macos_cpp_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 + - name: Install Dependencies + run: brew install ccache + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -49,6 +88,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_macos_cmake_cpp: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_macos_cmake_dotnet.yml b/.github/workflows/amd64_macos_cmake_dotnet.yml index cec3a15407..7138ba1661 100644 --- a/.github/workflows/amd64_macos_cmake_dotnet.yml +++ b/.github/workflows/amd64_macos_cmake_dotnet.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: amd64 MacOS CMake .Net -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -19,18 +28,46 @@ jobs: fail-fast: false name: amd64•MacOS•CMake(${{matrix.cmake.name}})•.Net runs-on: macos-13 # last macos intel based runner + env: + deps_src_key: amd64_macos_dotnet_deps_src + deps_build_key: amd64_macos_dotnet_deps_build_${{matrix.cmake.name}} + ccache_key: amd64_macos_dotnet_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - brew install swig + brew install ccache swig swig -version - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: dotnet-version: 8.0.x - name: Check dotnet run: dotnet --info + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -60,6 +97,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_macos_cmake_dotnet: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_macos_cmake_java.yml b/.github/workflows/amd64_macos_cmake_java.yml index 683aff028d..071031f5ae 100644 --- a/.github/workflows/amd64_macos_cmake_java.yml +++ b/.github/workflows/amd64_macos_cmake_java.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: amd64 MacOS CMake Java -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -19,14 +28,42 @@ jobs: fail-fast: false name: amd64•MacOS•CMake(${{matrix.cmake.name}})•Java runs-on: macos-13 # last macos intel based runner + env: + deps_src_key: amd64_macos_java_deps_src + deps_build_key: amd64_macos_java_deps_build_${{matrix.cmake.name}} + ccache_key: amd64_macos_java_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - brew install swig + brew install ccache swig swig -version - name: Check java run: java -version + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -56,6 +93,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_macos_cmake_java: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_macos_cmake_python.yml b/.github/workflows/amd64_macos_cmake_python.yml index 4c9acb7d4d..eafa59d0b5 100644 --- a/.github/workflows/amd64_macos_cmake_python.yml +++ b/.github/workflows/amd64_macos_cmake_python.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: amd64 MacOS CMake Python -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -17,29 +26,57 @@ jobs: {name: "Make", generator: "Unix Makefiles", config: Release, build_target: all, test_target: test, install_target: install}, ] python: [ - {version: "3.9"}, - {version: "3.10"}, - {version: "3.11"}, - {version: "3.12"}, + #{version: "3.9"}, + #{version: "3.10"}, + #{version: "3.11"}, + #{version: "3.12"}, {version: "3.13"}, ] fail-fast: false name: amd64•MacOS•CMake(${{matrix.cmake.name}})•Python-${{matrix.python.version}} runs-on: macos-13 # last macos intel based runner + env: + deps_src_key: amd64_macos_python_deps_src + deps_build_key: amd64_macos_python_deps_build_${{matrix.cmake.name}} + ccache_key: amd64_macos_python_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - brew install swig + brew install ccache swig swig -version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Update Path run: | echo "$HOME/Library/Python/${{matrix.python.version}}/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -69,6 +106,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src amd64_macos_cmake_python: runs-on: ubuntu-latest diff --git a/.github/workflows/amd64_web.yml b/.github/workflows/amd64_web.yml index 050d7a4db8..73a6986df5 100644 --- a/.github/workflows/amd64_web.yml +++ b/.github/workflows/amd64_web.yml @@ -1,7 +1,8 @@ # ref: https://github.com/docker-library/official-images name: amd64 Web -on: [push, pull_request, workflow_dispatch] +# still experimental +on: [workflow_dispatch] concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/amd64_windows_bazel.yml b/.github/workflows/amd64_windows_bazel.yml index e154ba6039..3b0fb5bb60 100644 --- a/.github/workflows/amd64_windows_bazel.yml +++ b/.github/workflows/amd64_windows_bazel.yml @@ -1,15 +1,23 @@ # ref: https://github.com/actions/runner-images name: amd64 Windows Bazel -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true +env: + cache-root: '%USERPROFILE%\AppData\Local\Temp\bazel' + # Building using the github runner environement directly. jobs: - native: + amd64-Windows-Bazel-Python: strategy: matrix: python: [ @@ -19,11 +27,12 @@ jobs: # {version: '3.13'}, ] fail-fast: false # Don't cancel all jobs if one fails. - name: amd64•Windows•Bazel•Python-${{matrix.python.version}} + env: + cache-name: ${{github.job}}-${{matrix.python.version}} runs-on: windows-2022 steps: - uses: actions/checkout@v5 - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '17' @@ -32,7 +41,7 @@ jobs: - name: Check mvn run: mvn --version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Check Python @@ -41,21 +50,26 @@ jobs: run: choco install bazel - name: Check Bazel run: bazel version + - name: Restore bazel cache + uses: actions/cache/restore@v4 + id: bazel-cache-restore + with: + key: ${{env.cache-name}} + path: ${{env.cache-root}} - name: Build - run: > - bazel build - -c opt - --subcommands=pretty_print - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} build --config=ci //ortools/... //examples/... - name: Test - run: > - bazel test - -c opt - --test_output=errors - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} test --config=ci //ortools/... //examples/... + - name: Save Bazel cache for branch main even when Build and Test fail. + uses: actions/cache/save@v4 + # https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache + if: always() && github.ref == 'refs/heads/main' + with: + key: ${{env.cache-name}}-${{github.sha}} + path: ${{env.cache-root}} amd64_windows_bazel: runs-on: ubuntu-latest - needs: native + needs: amd64-Windows-Bazel-Python steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/amd64_windows_cmake_cpp.yml b/.github/workflows/amd64_windows_cmake_cpp.yml index 205c77420f..7eff2e6cd4 100644 --- a/.github/workflows/amd64_windows_cmake_cpp.yml +++ b/.github/workflows/amd64_windows_cmake_cpp.yml @@ -1,7 +1,12 @@ # ref: https://github.com/actions/runner-images name: amd64 Windows CMake C++ -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} @@ -13,16 +18,33 @@ jobs: strategy: matrix: cmake: [ - {name: "VS2022", generator: "Visual Studio 17 2022", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, - # {name: "VS2022", generator: "Visual Studio 17 2022", config: Debug, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, # too many symbols + {name: "VS2022", generator: "Visual Studio 17 2022", config: Release}, + # {name: "VS2022", generator: "Visual Studio 17 2022", config: Debug}, # too many symbols ] fail-fast: false name: amd64•Windows•CMake(${{matrix.cmake.name}},${{matrix.cmake.config}})•C++ runs-on: windows-latest env: + deps_src_key: amd64_windows_cpp_deps_src + deps_build_key: amd64_windows_cpp_deps_build_${{matrix.cmake.config}} CTEST_OUTPUT_ON_FAILURE: 1 steps: - uses: actions/checkout@v5 + + # CONFIGURING CACHES + - name: Cache CMake dependency source code + uses: actions/cache@v4 + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Cache CMake dependency build + uses: actions/cache@v4 + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Check CMake run: | cmake --version @@ -38,19 +60,19 @@ jobs: run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.build_target}} + --target ALL_BUILD -v -j2 - name: Test run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.test_target}} + --target RUN_TESTS -v - name: Install run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.install_target}} + --target INSTALL -v amd64_windows_cmake_cpp: diff --git a/.github/workflows/amd64_windows_cmake_dotnet.yml b/.github/workflows/amd64_windows_cmake_dotnet.yml index dab5372296..01d6deef10 100644 --- a/.github/workflows/amd64_windows_cmake_dotnet.yml +++ b/.github/workflows/amd64_windows_cmake_dotnet.yml @@ -1,7 +1,12 @@ # ref: https://github.com/actions/runner-images name: amd64 Windows CMake .Net -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} @@ -13,47 +18,66 @@ jobs: strategy: matrix: cmake: [ - {name: "VS2022", generator: "Visual Studio 17 2022", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, + {name: "VS2022", generator: "Visual Studio 17 2022", config: Release}, ] fail-fast: false name: amd64•Windows•CMake(${{matrix.cmake.name}})•.Net runs-on: windows-latest env: + deps_src_key: amd64_windows_dotnet_deps_src + deps_build_key: amd64_windows_dotnet_deps_build_${{matrix.cmake.config}} CTEST_OUTPUT_ON_FAILURE: 1 steps: - uses: actions/checkout@v5 - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: dotnet-version: 8.0.x - name: Check dotnet run: dotnet --info + + # CONFIGURING CACHES + - name: Cache CMake dependency source code + uses: actions/cache@v4 + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Cache CMake dependency build + uses: actions/cache@v4 + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Check CMake - run: cmake --version + run: | + cmake --version + cmake -G || true - name: Configure run: > cmake -S. -Bbuild -G "${{matrix.cmake.generator}}" - -DCMAKE_BUILD_TYPE=${{matrix.cmake.config}} + -DCMAKE_CONFIGURATION_TYPES=${{matrix.cmake.config}} -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_DOTNET=ON - name: Build run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.build_target}} + --target ALL_BUILD -v -j2 - name: Test run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.test_target}} + --target RUN_TESTS -v - name: Install run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.install_target}} + --target INSTALL -v amd64_windows_cmake_dotnet: diff --git a/.github/workflows/amd64_windows_cmake_java.yml b/.github/workflows/amd64_windows_cmake_java.yml index 9be5a93381..9965df3af5 100644 --- a/.github/workflows/amd64_windows_cmake_java.yml +++ b/.github/workflows/amd64_windows_cmake_java.yml @@ -1,7 +1,12 @@ # ref: https://github.com/actions/runner-images name: amd64 Windows CMake Java -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} @@ -13,7 +18,7 @@ jobs: strategy: matrix: cmake: [ - {name: "VS2022", generator: "Visual Studio 17 2022", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, + {name: "VS2022", generator: "Visual Studio 17 2022", config: Release}, ] java: [ # see https://endoflife.date/azul-zulu @@ -27,18 +32,21 @@ jobs: {distrib: 'temurin', version: '17'}, # 2027/10 {distrib: 'temurin', version: '21'}, # 2029/12 # see https://endoflife.date/microsoft-build-of-openjdk - {distrib: 'microsoft', version: '11'}, # 2027/09 - {distrib: 'microsoft', version: '17'}, # 2027/09 - {distrib: 'microsoft', version: '21'}, # 2028/09 + # microsoft jdk seems to use an older redistributable + #{distrib: 'microsoft', version: '11'}, # 2027/09 + #{distrib: 'microsoft', version: '17'}, # 2027/09 + #{distrib: 'microsoft', version: '21'}, # 2028/09 ] fail-fast: false name: amd64•Windows•CMake(${{matrix.cmake.name}})•${{matrix.java.distrib}}-${{matrix.java.version}} runs-on: windows-latest env: + deps_src_key: amd64_windows_java_deps_src + deps_build_key: amd64_windows_java_deps_build_${{matrix.cmake.config}} CTEST_OUTPUT_ON_FAILURE: 1 steps: - uses: actions/checkout@v5 - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: ${{matrix.java.distrib}} java-version: ${{matrix.java.version}} @@ -46,32 +54,49 @@ jobs: run: | java -version mvn --version + + # CONFIGURING CACHES + - name: Cache CMake dependency source code + uses: actions/cache@v4 + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Cache CMake dependency build + uses: actions/cache@v4 + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Check CMake - run: cmake --version + run: | + cmake --version + cmake -G || true - name: Configure run: > cmake -S. -Bbuild -G "${{matrix.cmake.generator}}" - -DCMAKE_BUILD_TYPE=${{matrix.cmake.config}} + -DCMAKE_CONFIGURATION_TYPES=${{matrix.cmake.config}} -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_JAVA=ON - name: Build run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.build_target}} + --target ALL_BUILD -v -j2 - name: Test run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.test_target}} + --target RUN_TESTS -v - name: Install run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.install_target}} + --target INSTALL -v amd64_windows_cmake_java: diff --git a/.github/workflows/amd64_windows_cmake_python.yml b/.github/workflows/amd64_windows_cmake_python.yml index 821775e92d..7ec0449f12 100644 --- a/.github/workflows/amd64_windows_cmake_python.yml +++ b/.github/workflows/amd64_windows_cmake_python.yml @@ -1,7 +1,12 @@ # ref: https://github.com/actions/runner-images name: amd64 Windows CMake Python -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} @@ -13,23 +18,25 @@ jobs: strategy: matrix: cmake: [ - {name: "VS2022", generator: "Visual Studio 17 2022", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, + {name: "VS2022", generator: "Visual Studio 17 2022", config: Release}, ] python: [ {version: "3.9", dir: Python309}, - {version: "3.10", dir: Python310}, - {version: "3.11", dir: Python311}, - {version: "3.12", dir: Python312}, + #{version: "3.10", dir: Python310}, + #{version: "3.11", dir: Python311}, + #{version: "3.12", dir: Python312}, {version: "3.13", dir: Python313}, ] fail-fast: false name: amd64•Windows•CMake(${{matrix.cmake.name}})•Python-${{matrix.python.version}} runs-on: windows-latest env: + deps_src_key: amd64_windows_python_deps_src + deps_build_key: amd64_windows_python_deps_build_${{matrix.cmake.config}} CTEST_OUTPUT_ON_FAILURE: 1 steps: - uses: actions/checkout@v5 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Install python3 @@ -38,32 +45,49 @@ jobs: run: > echo "$((Get-Item ~).FullName)/AppData/Roaming/Python/${{matrix.python.dir}}/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + # CONFIGURING CACHES + - name: Cache CMake dependency source code + uses: actions/cache@v4 + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Cache CMake dependency build + uses: actions/cache@v4 + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Check CMake - run: cmake --version + run: | + cmake --version + cmake -G || true - name: Configure run: > cmake -S. -Bbuild -G "${{matrix.cmake.generator}}" - -DCMAKE_BUILD_TYPE=${{matrix.cmake.config}} + -DCMAKE_CONFIGURATION_TYPES=${{matrix.cmake.config}} -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON=ON - name: Build run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.build_target}} + --target ALL_BUILD -v -j2 - name: Test run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.test_target}} + --target RUN_TESTS -v - name: Install run: > cmake --build build --config ${{matrix.cmake.config}} - --target ${{matrix.cmake.install_target}} + --target INSTALL -v amd64_windows_cmake_python: diff --git a/.github/workflows/arm64_macos_bazel.yml b/.github/workflows/arm64_macos_bazel.yml index 73af4c8ce4..14b23c7fab 100644 --- a/.github/workflows/arm64_macos_bazel.yml +++ b/.github/workflows/arm64_macos_bazel.yml @@ -1,15 +1,23 @@ # ref: https://github.com/actions/runner-images name: arm64 MacOS Bazel -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true +env: + cache-root: /private/tmp/bazel + # Building using the github runner environement directly. jobs: - native: + arm64-MacOS-Bazel-Python: strategy: matrix: python: [ @@ -19,19 +27,20 @@ jobs: #{version: '3.13'}, ] fail-fast: false - name: arm64•MacOS•Bazel•Python-${{matrix.python.version}} + env: + cache-name: ${{github.job}}-${{matrix.python.version}} runs-on: macos-latest # macos arm64 based runner steps: - uses: actions/checkout@v5 - name: Set Java to OpenJDK 17 (Temurin) - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '17' - name: Check mvn run: mvn --version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Check Python @@ -46,21 +55,26 @@ jobs: run: | sed -i '' -e 's/\(DEFAULT_PYTHON =\) "3.[0-9]*"/\1 "${{matrix.python.version}}"/g' MODULE.bazel cat MODULE.bazel + - name: Restore bazel cache + uses: actions/cache/restore@v4 + id: bazel-cache-restore + with: + key: ${{env.cache-name}} + path: ${{env.cache-root}} - name: Build - run: > - bazel build - -c opt - --subcommands=pretty_print - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} build --config=ci //ortools/... //examples/... - name: Test - run: > - bazel test - -c opt - --test_output=errors - //ortools/... //examples/... + run: bazel --output_user_root=${{env.cache-root}} test --config=ci //ortools/... //examples/... + - name: Save Bazel cache for branch main even when Build and Test fail. + uses: actions/cache/save@v4 + # https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache + if: always() && github.ref == 'refs/heads/main' + with: + key: ${{env.cache-name}}-${{github.sha}} + path: ${{env.cache-root}} arm64_macos_bazel: runs-on: ubuntu-latest - needs: native + needs: arm64-MacOS-Bazel-Python steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/arm64_macos_cmake_cpp.yml b/.github/workflows/arm64_macos_cmake_cpp.yml index bbd4dfcb43..13f77d0736 100644 --- a/.github/workflows/arm64_macos_cmake_cpp.yml +++ b/.github/workflows/arm64_macos_cmake_cpp.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: arm64 MacOS CMake C++ -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -19,8 +28,38 @@ jobs: fail-fast: false name: arm64•MacOS•CMake(${{matrix.cmake.name}})•C++ runs-on: macos-latest # macos M1 based runner + env: + deps_src_key: arm64_macos_cpp_deps_src + deps_build_key: arm64_macos_cpp_deps_build_${{matrix.cmake.name}} + ccache_key: arm64_macos_cpp_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 + - name: Install Dependencies + run: brew install ccache + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -49,6 +88,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src arm64_macos_cmake_cpp: runs-on: ubuntu-latest diff --git a/.github/workflows/arm64_macos_cmake_dotnet.yml b/.github/workflows/arm64_macos_cmake_dotnet.yml index 3887ac92f9..5b14908ce6 100644 --- a/.github/workflows/arm64_macos_cmake_dotnet.yml +++ b/.github/workflows/arm64_macos_cmake_dotnet.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: arm64 MacOS CMake .Net -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -19,18 +28,46 @@ jobs: fail-fast: false name: arm64•MacOS•CMake(${{matrix.cmake.name}})•.Net runs-on: macos-latest # macos arm64 based runner + env: + deps_src_key: arm64_macos_dotnet_deps_src + deps_build_key: arm64_macos_dotnet_deps_build_${{matrix.cmake.name}} + ccache_key: arm64_macos_dotnet_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - brew install swig + brew install ccache swig swig -version - name: Setup .NET 8.0 - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: dotnet-version: 8.0.x - name: Check dotnet run: dotnet --info + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -60,6 +97,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src arm64_macos_cmake_dotnet: runs-on: ubuntu-latest diff --git a/.github/workflows/arm64_macos_cmake_java.yml b/.github/workflows/arm64_macos_cmake_java.yml index 0ee363370e..cb6e2e84cd 100644 --- a/.github/workflows/arm64_macos_cmake_java.yml +++ b/.github/workflows/arm64_macos_cmake_java.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: arm64 MacOS CMake Java -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -19,14 +28,42 @@ jobs: fail-fast: false name: arm64•MacOS•CMake(${{matrix.cmake.name}})•Java runs-on: macos-latest # macos arm64 based runner + env: + deps_src_key: arm64_macos_java_deps_src + deps_build_key: arm64_macos_java_deps_build_${{matrix.cmake.name}} + ccache_key: arm64_macos_java_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - brew install swig + brew install ccache swig swig -version - name: Check java run: java -version + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -56,6 +93,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src arm64_macos_cmake_java: runs-on: ubuntu-latest diff --git a/.github/workflows/arm64_macos_cmake_python.yml b/.github/workflows/arm64_macos_cmake_python.yml index ca4df6011e..1c59a2ca5e 100644 --- a/.github/workflows/arm64_macos_cmake_python.yml +++ b/.github/workflows/arm64_macos_cmake_python.yml @@ -1,13 +1,22 @@ # ref: https://github.com/actions/runner-images name: arm64 MacOS CMake Python -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true # Building using the github runner environement directly. +env: + CCACHE_BASEDIR: ${{github.workspace}} + CCACHE_DIR: ${{github.workspace}}/.ccache + jobs: native: strategy: @@ -17,29 +26,57 @@ jobs: {name: "Make", generator: "Unix Makefiles", config: Release, build_target: all, test_target: test, install_target: install}, ] python: [ - {version: "3.9"}, - {version: "3.10"}, - {version: "3.11"}, + #{version: "3.9"}, + #{version: "3.10"}, + #{version: "3.11"}, {version: "3.12"}, - {version: "3.13"}, + #{version: "3.13"}, ] fail-fast: false name: arm64•MacOS•CMake(${{matrix.cmake.name}})•Python-${{matrix.python.version}} runs-on: macos-latest # macos arm64 based runner + env: + deps_src_key: arm64_macos_python_deps_src + deps_build_key: arm64_macos_python_deps_build_${{matrix.cmake.name}} + ccache_key: arm64_macos_python_ccache_${{matrix.cmake.name}} steps: - uses: actions/checkout@v5 - - name: Swig install + - name: Install Dependencies run: | - brew install swig + brew install ccache swig swig -version - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{matrix.python.version}} - name: Update Path run: | echo "$HOME/Library/Python/${{matrix.python.version}}/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH + + # RESTORING CACHES + - name: Restore CMake dependency source code + uses: actions/cache/restore@v4 + id: deps_src_restore + with: + key: ${{env.deps_src_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: ${{github.workspace}}/build/_deps/*-src + - name: Restore CMake dependency build + uses: actions/cache/restore@v4 + id: deps_build_restore + with: + key: ${{env.deps_build_key}}-${{hashFiles('CMakeLists.txt', 'cmake/**')}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Restore CCache + uses: actions/cache/restore@v4 + id: ccache_restore + with: + key: ${{env.ccache_key}}-${{github.sha}} + restore-keys: ${{env.ccache_key}}- + path: ${{env.CCACHE_DIR}} + - name: Check CMake run: cmake --version - name: Configure @@ -69,6 +106,32 @@ jobs: --config ${{matrix.cmake.config}} --target ${{matrix.cmake.install_target}} -v + - name: CCache stats + run: | + ccache --show-stats + ccache --zero-stats + + # SAVING CACHES + - name: Save CCache + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.ccache_restore.outputs.cache-primary-key}} + path: ${{env.CCACHE_DIR}} + - name: Save CMake dependency build + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_build_restore.outputs.cache-primary-key}} + path: | + ${{github.workspace}}/build/_deps/*-build + ${{github.workspace}}/build/_deps/*-subbuild + - name: Save CMake dependency source code + if: github.ref == 'refs/heads/main' + uses: actions/cache/save@v4 + with: + key: ${{steps.deps_src_restore.outputs.cache-primary-key}} + path: ${{github.workspace}}/build/_deps/*-src arm64_macos_cmake_python: runs-on: ubuntu-latest diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml index 4a7f8c79cd..b999e80494 100644 --- a/.github/workflows/check_format.yml +++ b/.github/workflows/check_format.yml @@ -1,6 +1,11 @@ name: Check Format -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + pull_request: + workflow_dispatch: concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/mips_toolchain.yml b/.github/workflows/mips_toolchain.yml index 1becd15d76..d75e27ce6b 100644 --- a/.github/workflows/mips_toolchain.yml +++ b/.github/workflows/mips_toolchain.yml @@ -1,7 +1,7 @@ # ref: https://codescape.mips.com/components/toolchain/2021.09-01/downloads.html name: mips Toolchain -on: [push, pull_request, workflow_dispatch] +on: [workflow_dispatch] concurrency: group: ${{github.workflow}}-${{github.ref}} diff --git a/.github/workflows/powerpc_toolchain.yml b/.github/workflows/powerpc_toolchain.yml index d23e220bc7..76710e5ab0 100644 --- a/.github/workflows/powerpc_toolchain.yml +++ b/.github/workflows/powerpc_toolchain.yml @@ -1,7 +1,7 @@ # ref: https://toolchains.bootlin.com/ name: powerpc Toolchain -on: [push, pull_request, workflow_dispatch] +on: [workflow_dispatch] concurrency: group: ${{github.workflow}}-${{github.ref}}