From 09e8e4b4392c3b5cede6099c5c3d2deeecb78b32 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 28 Feb 2023 05:00:42 +0100 Subject: [PATCH] ci: Use multi-config generators to improve build speed There's no need to split by configuration type on proper generators, which slightly speeds up the build. Downside is that we can't get builds for both Debug and RelWithDebInfo - though we only need the latter anyway. --- .github/workflows/main.yml | 63 +++++++++++++------------------------- 1 file changed, 21 insertions(+), 42 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4786257..f3d0e49 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -304,15 +304,13 @@ jobs: --config Release \ --component obs_libraries - - name: "Configure & Build (Debug)" + - name: "Configure" continue-on-error: true shell: bash - env: - CMAKE_BUILD_TYPE: "Debug" run: | cmake \ -S "${{ github.workspace }}" \ - -B "${{ github.workspace }}/build/debug" \ + -B "${{ github.workspace }}/build/ci" \ ${{ env.cmake_generator }} \ ${{ env.cmake_generator_toolset }} \ ${{ env.cmake_generator_platform }} \ @@ -323,7 +321,7 @@ jobs: -DCMAKE_OSX_DEPLOYMENT_TARGET="${{ matrix.CMAKE_OSX_DEPLOYMENT_TARGET }}" \ -DCMAKE_SYSTEM_VERSION="${{ matrix.CMAKE_SYSTEM_VERSION }}" \ -DCMAKE_BUILD_TYPE="${{ env.CMAKE_BUILD_TYPE }}" \ - -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/debug/install" \ + -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/ci/install" \ -DPACKAGE_NAME="streamfx-${{ matrix.package_name }}-debug" \ -DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \ -DENABLE_CLANG=TRUE -DCLANG_PATH="${{ env.CLANG_PATH }}" \ @@ -332,66 +330,47 @@ jobs: -DQt_DIR="${{ github.workspace }}/build/qt" \ -DFFmpeg_DIR="${{ github.workspace }}/build/obsdeps" \ -DCURL_DIR="${{ github.workspace }}/build/obsdeps" + - name: "Build: Debug" + continue-on-error: true + shell: bash + env: + CMAKE_BUILD_TYPE: "Debug" + run: | if [[ "${{ matrix.runner }}" = windows* ]]; then - cmake --build "build/debug" --config ${{ env.CMAKE_BUILD_TYPE }} --target install + cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install elif [[ "${{ matrix.runner }}" = ubuntu* ]]; then - cmake --build "build/debug" --config ${{ env.CMAKE_BUILD_TYPE }} --target install + cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install elif [[ "${{ matrix.runner }}" = macos* ]]; then - cmake --build "build/debug" --config ${{ env.CMAKE_BUILD_TYPE }} --target install + cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install fi - - name: "Configure & Build (Release)" + - name: "Build: Release" shell: bash env: CMAKE_BUILD_TYPE: "RelWithDebInfo" run: | - cmake \ - -S "${{ github.workspace }}" \ - -B "${{ github.workspace }}/build/release" \ - ${{ env.cmake_generator }} \ - ${{ env.cmake_generator_toolset }} \ - ${{ env.cmake_generator_platform }} \ - -DCMAKE_C_COMPILER="${{ env.CC }}" \ - -DCMAKE_CXX_COMPILER="${{ env.CXX }}" \ - -DCMAKE_LINKER="${{ env.LD }}" \ - -DCMAKE_OSX_ARCHITECTURES="${{ matrix.CMAKE_OSX_ARCHITECTURES }}" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET="${{ matrix.CMAKE_OSX_DEPLOYMENT_TARGET }}" \ - -DCMAKE_SYSTEM_VERSION="${{ matrix.CMAKE_SYSTEM_VERSION }}" \ - -DCMAKE_BUILD_TYPE="${{ env.CMAKE_BUILD_TYPE }}" \ - -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/release/install" \ - -DPACKAGE_NAME="streamfx-${{ matrix.package_name }}" \ - -DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \ - -DENABLE_CLANG=TRUE -DCLANG_PATH="${{ env.CLANG_PATH }}" \ - -DENABLE_PROFILING=OFF \ - -Dlibobs_DIR="${{ github.workspace }}/build/obs/install" \ - -DQt_DIR="${{ github.workspace}}/build/qt" \ - -DFFmpeg_DIR="${{ github.workspace }}/build/obsdeps" \ - -DCURL_DIR="${{ github.workspace }}/build/obsdeps" if [[ "${{ matrix.runner }}" = windows* ]]; then - cmake --build "build/release" --config ${{ env.CMAKE_BUILD_TYPE }} --target install + cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install elif [[ "${{ matrix.runner }}" = ubuntu* ]]; then - cmake --build "build/release" --config ${{ env.CMAKE_BUILD_TYPE }} --target install/strip + cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install/strip elif [[ "${{ matrix.runner }}" = macos* ]]; then - cmake --build "build/release" --config ${{ env.CMAKE_BUILD_TYPE }} --target install + cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target install fi - name: "Packaging" shell: bash run: | mkdir "${{ github.workspace }}/build/package" - cmake --build "${{ github.workspace }}/build/debug" --config Debug --target PACKAGE_7Z - cmake --build "${{ github.workspace }}/build/release" --config RelWithDebInfo --target PACKAGE_7Z + cmake --build "${{ github.workspace }}/build/ci" --config RelWithDebInfo --target PACKAGE_7Z - name: "Packaging (Windows)" if: startsWith( matrix.runner, 'windows' ) shell: cmd run: | - "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 ".\build\debug\installer.iss" - "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 ".\build\release\installer.iss" + "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /V10 ".\build\ci\installer.iss" - name: "Packaging (MacOS)" if: startsWith( matrix.runner, 'macos' ) shell: bash run: | - packagesbuild "${{ github.workspace }}/build/debug/installer.pkgproj" - packagesbuild "${{ github.workspace }}/build/release/installer.pkgproj" + packagesbuild "${{ github.workspace }}/build/ci/installer.pkgproj" - name: "Artifacts" uses: actions/upload-artifact@v1 @@ -402,8 +381,8 @@ jobs: - name: "Validate clang-format" shell: bash run: | - cmake --build "${{ github.workspace }}/build/debug" --config Debug --target clang-format - cmake --build "${{ github.workspace }}/build/release" --config RelWithDebInfo --target clang-format + cmake --build "${{ github.workspace }}/build/ci" --config Debug --target clang-format + cmake --build "${{ github.workspace }}/build/ci" --config RelWithDebInfo --target clang-format git --no-pager diff --patch --minimal HEAD -- git update-index --refresh git diff-index --quiet HEAD --