Restrict -flto=auto in CI to a single Linux job Because ccache only caches object files and cannot cache linking, enabling -flto=auto across every Release matrix job forces whole-program LTO code generation across ~140 test and example binaries on every run (taking 15-30 minutes even with a 100% warm ccache, and 8-12 minutes longer on static library builds where libceres.a is re-optimized into each test executable). Restrict -flto=auto -Werror=odr to the ubuntu:26.04 shared-library no-cuda job in linux.yml so ODR and LTO verification still run on every push without paying the uncacheable LTO link cost across all other Linux, macOS, Windows MinGW, and Android jobs. Change-Id: I4e7f6d14b0f327a5c162fa548b3db4f77e59c344
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e4b067c..b5f96dc 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml
@@ -91,11 +91,6 @@ key: NDK-${{matrix.os}}-ccache-${{matrix.abi}}-${{matrix.build_type}}-${{matrix.lib}}-${{github.run_id}} restore-keys: NDK-${{matrix.os}}-ccache-${{matrix.abi}}-${{matrix.build_type}}-${{matrix.lib}}- - - name: Setup Environment - if: matrix.build_type == 'Release' - run: | - echo 'CXXFLAGS=-flto=auto' >> $GITHUB_ENV - - name: Configure run: | cmake -S . -B build_${{matrix.abi}} \
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7d968e5..b8d9aa5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml
@@ -127,7 +127,7 @@ restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.gpu}}- - name: Setup Build Environment - if: matrix.build_type == 'Release' + if: matrix.build_type == 'Release' && matrix.os == 'ubuntu:26.04' && matrix.lib == 'shared' && matrix.gpu == 'no-cuda' run: | echo 'CXXFLAGS=-flto=auto -Werror=odr' >> $GITHUB_ENV
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b7cb6a3..2bae26d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml
@@ -60,11 +60,6 @@ key: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.target}}-${{github.run_id}} restore-keys: ${{matrix.os}}-ccache-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.target}}- - - name: Setup Environment - if: matrix.build_type == 'Release' - run: | - echo 'CXXFLAGS=-flto=auto' >> $GITHUB_ENV - - name: Configure (iOS) if: matrix.target == 'ios' run: |
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0160983..3d16b6e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml
@@ -39,12 +39,6 @@ mingw-w64-${{matrix.env}}-ninja mingw-w64-${{matrix.env}}-suitesparse - - name: Setup Environment - if: ${{matrix.build_type == 'Release'}} - run: | - echo 'CFLAGS=-flto=auto' >> ~/.bash_profile - echo 'CXXFLAGS=-flto=auto' >> ~/.bash_profile - - name: Cache Build id: cache-build uses: actions/cache@v4