diff options
author | Be <be@mixxx.org> | 2020-11-24 08:30:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 08:30:24 -0800 |
commit | 623d099bcbabd02e8e853998deea273cd8bd08a4 (patch) | |
tree | f1932fe01ed1f5c073a95afef8488b2b4bae701b | |
parent | 3780f2bae5617a61f2f41f5144a4373aef48eca0 (diff) | |
parent | 89de9651307cd68e8d1374d7c5a6b4097ba4c0f5 (diff) |
Merge pull request #3339 from Holzhaus/gh-actions-windows
GitHub Actions: Add Windows workflow
-rw-r--r-- | .github/workflows/build.yml | 167 | ||||
-rw-r--r-- | appveyor.yml | 2 | ||||
-rw-r--r-- | cmake/windows_build_environment_name (renamed from build/windows/golden_environment) | 0 | ||||
-rw-r--r-- | src/proto/CMakeLists.txt | 6 | ||||
-rwxr-xr-x | tools/macos_buildenv.sh | 37 | ||||
-rwxr-xr-x | tools/ubuntu_buildenv.sh | 19 | ||||
-rw-r--r-- | tools/windows_buildenv.bat | 104 |
7 files changed, 240 insertions, 95 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fad174fe8a..6058cb1587 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,32 +11,81 @@ jobs: include: - name: Ubuntu 18.04 (gcc) os: ubuntu-18.04 - cmake_args: -DFAAD=ON -DKEYFINDER=ON -DLOCALECOMPARE=ON -DMAD=ON -DMODPLUG=ON -DWAVPACK=ON + cmake_args: >- + -DFAAD=ON + -DKEYFINDER=ON + -DLOCALECOMPARE=ON + -DMAD=ON + -DMODPLUG=ON + -DWAVPACK=ON + cmake_generator: Unix Makefiles ctest_args: - ccache_path: ~/.ccache + compiler_cache: ccache + compiler_cache_path: ~/.ccache cpack_generator: DEB + buildenv_basepath: /home/runner/buildenv buildenv_script: tools/ubuntu_buildenv.sh artifacts_name: Ubuntu 18.04 DEB artifacts_path: cmake_build/*.deb + qt_qpa_platform: offscreen - name: Ubuntu 20.04 (gcc) os: ubuntu-20.04 - cmake_args: -DFFMPEG=ON -DKEYFINDER=ON -DLOCALECOMPARE=ON -DMAD=ON -DMODPLUG=ON -DWAVPACK=ON + cmake_args: >- + -DFFMPEG=ON + -DKEYFINDER=ON + -DLOCALECOMPARE=ON + -DMAD=ON + -DMODPLUG=ON + -DWAVPACK=ON + cmake_generator: Unix Makefiles ctest_args: - ccache_path: ~/.ccache + compiler_cache: ccache + compiler_cache_path: ~/.ccache cpack_generator: DEB + buildenv_basepath: /home/runner/buildenv buildenv_script: tools/ubuntu_buildenv.sh artifacts_name: Ubuntu 20.04 DEB artifacts_path: cmake_build/*.deb + qt_qpa_platform: offscreen - name: macOS 10.15 os: macos-10.15 - cmake_args: -DCOREAUDIO=ON -DHSS1394=ON -DMACOS_BUNDLE=ON + cmake_args: >- + -DCOREAUDIO=ON + -DHSS1394=ON + -DMACOS_BUNDLE=ON + cmake_generator: Unix Makefiles # TODO: Fix this broken test on macOS ctest_args: --exclude-regex DirectoryDAOTest.relocateDirectory cpack_generator: DragNDrop - ccache_path: /Users/runner/Library/Caches/ccache + compiler_cache: ccache + compiler_cache_path: /Users/runner/Library/Caches/ccache + buildenv_basepath: /Users/runner/buildenv buildenv_script: tools/macos_buildenv.sh artifacts_name: macOS DMG artifacts_path: cmake_build/*.dmg + qt_qpa_platform: offscreen + - name: Windows 2019 (MSVC) + os: windows-2019 + cmake_args: >- + -DHSS1394=ON + -DKEYFINDER=OFF + -DLOCALECOMPARE=ON + -DMAD=ON + -DMEDIAFOUNDATION=ON + -DSTATIC_DEPS=ON + cc: cl + cxx: cl + cmake_generator: Ninja + # TODO: Fix these broken tests on Windows + ctest_args: --exclude-regex '^AutoDJProcessorTest.(FullIntroOutro_LongerOutro|EnabledSuccess_DecksStopped|FadeToDeck1_LoadOnDeck2_TrackLoadFailed|FadeToDeck2_LoadOnDeck1_TrackLoadSuccess)$' + cpack_generator: WIX + compiler_cache: clcache + compiler_cache_path: ${{ github.workspace }}\clcache + buildenv_basepath: C:\buildenv + buildenv_script: tools/windows_buildenv.bat + artifacts_name: Windows Installer + artifacts_path: cmake_build/*.msi + qt_qpa_platform: windows env: # macOS codesigning @@ -57,17 +106,21 @@ jobs: # our CMakeLists.txt cmake-version: '3.13.x' - - name: "[macOS] Get build environment name" - if: runner.os == 'macOS' + - name: "[Windows] Install additional build tools" + if: runner.os == 'Windows' + run: python -m pip install ninja git+https://github.com/frerich/clcache.git + + - name: "[macOS/Windows] Get build environment name" + if: runner.os != 'Linux' id: buildenv_name - run: ${{ matrix.buildenv_script }} name --ghactions + run: ${{ matrix.buildenv_script }} name - - name: "[macOS] Set up build environment cache" - if: runner.os == 'macOS' + - name: "[macOS/Windows] Set up build environment cache" + if: runner.os != 'Linux' uses: actions/cache@v2 with: - path: ${{ github.workspace }}/buildenv - key: macOS-build-environment-${{ steps.buildenv_name.outputs.buildenv_name }} + path: ${{ matrix.buildenv_basepath }} + key: ${{ runner.os }}-buildenv-${{ env.BUILDENV_NAME }} - name: "[macOS] Import Apple code signing identity" id: apple_codesign @@ -93,72 +146,83 @@ jobs: - name: "Set up build environment" id: buildenv - run: ${{ matrix.buildenv_script }} setup --ghactions + run: ${{ matrix.buildenv_script }} setup env: - BUILDENV_BASEPATH: ${{ github.workspace }}/buildenv + BUILDENV_BASEPATH: ${{ matrix.buildenv_basepath }} - - name: "Set ccache size limit" - run: ccache -M 5G - env: - PATH: ${{ steps.buildenv.outputs.path }} + - name: "Set compiler cache size limit" + # Set size to 2 GiB + run: ${{ matrix.compiler_cache }} -M 2097152 - - name: "Set up ccache cache" + - name: "Set up compiler cache" uses: actions/cache@v2 with: - path: ${{ matrix.ccache_path }} - key: ${{ matrix.os }}-ccache-${{ github.head_ref }}-${{ github.run_number }} + path: ${{ matrix.compiler_cache_path }} + key: ${{ matrix.os }}-${{ matrix.compiler_cache }}-${{ github.head_ref }}-${{ github.run_number }} restore-keys: | - ${{ matrix.os }}-ccache-${{ github.head_ref }} - ${{ matrix.os }}-ccache + ${{ matrix.os }}-${{ matrix.compiler_cache }}-${{ github.head_ref }} + ${{ matrix.os }}-${{ matrix.compiler_cache }} - name: "Create build directory" run: mkdir cmake_build + - name: "[Windows] Set up MSVC Developer Command Prompt" + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + toolset: 14.16 + - name: "Configure" - run: | - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DBATTERY=ON \ - -DBROADCAST=ON \ - -DBULK=ON \ - -DDEBUG_ASSERTIONS_FATAL=ON \ - -DHID=ON \ - -DLILV=ON \ - -DOPUS=ON \ - -DQTKEYCHAIN=ON \ - -DVINYLCONTROL=ON \ - ${CMAKE_FLAGS_EXTRA} \ - .. + run: >- + cmake + -G "${{ matrix.cmake_generator }}" + -DCMAKE_BUILD_TYPE=Release + "-DCMAKE_PREFIX_PATH=${{ env.CMAKE_PREFIX_PATH }}" + -DDEBUG_ASSERTIONS_FATAL=ON + -DQt5_DIR=${{ env.QT_PATH }} ${{ matrix.cmake_args }} ${{ steps.apple_codesign.outputs.cmake_args }} + -DBATTERY=ON + -DBROADCAST=ON + -DBULK=ON + -DHID=ON + -DLILV=ON + -DOPUS=ON + -DQTKEYCHAIN=ON + -DVINYLCONTROL=ON + .. working-directory: cmake_build env: - PATH: ${{ steps.buildenv.outputs.path }} - CMAKE_FLAGS_EXTRA: ${{ matrix.cmake_args }} ${{ steps.apple_codesign.outputs.cmake_args }} -DCMAKE_PREFIX_PATH=${{ steps.buildenv.outputs.cmake_prefix_path }} -DQt5_DIR=${{ steps.buildenv.outputs.qt_path }} - MACOSX_DEPLOYMENT_TARGET: ${{ steps.buildenv.outputs.macosx_deployment_target }} + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} - - name: "Set up problem matcher" + - name: "[Ubuntu/macOS] Set up gcc/clang problem matcher" + if: runner.os != 'Windows' uses: ammaraskar/gcc-problem-matcher@master + - name: "[Windows] Set up MSVC problem matcher" + if: runner.os == 'Windows' + uses: ammaraskar/msvc-problem-matcher@master + - name: "Build" run: cmake --build . working-directory: cmake_build env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} CMAKE_BUILD_PARALLEL_LEVEL: 2 # GitHub Actions automatically zstd compresses caches CCACHE_NOCOMPRESS: true - PATH: ${{ steps.buildenv.outputs.path }} + CLCACHE_COMPRESS: false + CLCACHE_HARDLINK: true - - name: "Print ccache stats" - run: ccache -s - env: - PATH: ${{ steps.buildenv.outputs.path }} + - name: "Print compiler cache stats" + run: ${{ matrix.compiler_cache }} -s - name: "Test" run: ctest --timeout 45 ${{ matrix.ctest_args }} working-directory: cmake_build env: - QT_QPA_PLATFORM_PLUGIN_PATH: ${{ steps.buildenv.outputs.qt_qpa_platform_plugin_path }} # Render analyzer waveform tests to an offscreen buffer - QT_QPA_PLATFORM: offscreen + QT_QPA_PLATFORM: ${{ matrix.qt_qpa_platform }} GTEST_COLOR: 1 CTEST_PARALLEL_LEVEL: 2 CTEST_OUTPUT_ON_FAILURE: 1 @@ -167,15 +231,12 @@ jobs: run: cmake --build . --target mixxx-benchmark working-directory: cmake_build env: - QT_QPA_PLATFORM_PLUGIN_PATH: ${{ steps.buildenv.outputs.qt_qpa_platform_plugin_path }} # Render analyzer waveform tests to an offscreen buffer - QT_QPA_PLATFORM: offscreen + QT_QPA_PLATFORM: ${{ matrix.qt_qpa_platform }} - name: "Package" run: cpack -G ${{ matrix.cpack_generator }} working-directory: cmake_build - env: - PATH: ${{ steps.buildenv.outputs.path }} - name: "[macOS] Sign Package" if: runner.os == 'macOS' && env.MACOS_CODESIGN_OPENSSL_PASSWORD != null && env.MACOS_CODESIGN_CERTIFICATE_PASSWORD != null diff --git a/appveyor.yml b/appveyor.yml index afc0c4d07e..acc815cfcb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -179,7 +179,7 @@ for: secure: EiAsLAgrsS+N3rr71AAkXPCrxIe2vLvlOvCipnTw6pg= install: - - set /P ENVIRONMENT_NAME=<build/windows/golden_environment + - set /P ENVIRONMENT_NAME=<cmake\windows_build_environment_name - set ENVIRONMENT_NAME=%%ENVIRONMENT_NAME:PLATFORM=%platform%%% - set ENVIRONMENT_NAME=%%ENVIRONMENT_NAME:CONFIGURATION=%configuration%%% - set WINLIB_PATH=%ENVIRONMENTS_PATH%\%ENVIRONMENT_NAME% diff --git a/build/windows/golden_environment b/cmake/windows_build_environment_name index 4b78354121..4b78354121 100644 --- a/build/windows/golden_environment +++ b/cmake/windows_build_environment_name diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt index 3191b9e3b4..e5fc68fa74 100644 --- a/src/proto/CMakeLists.txt +++ b/src/proto/CMakeLists.txt @@ -1,5 +1,5 @@ # Protobuf -find_package(Protobuf REQUIRED) +find_package(Protobuf) protobuf_generate_cpp( PROTO_SOURCES PROTO_HEADERS @@ -13,6 +13,8 @@ protobuf_generate_cpp( add_library(mixxx-proto STATIC ${PROTO_SOURCES} ${PROTO_HEADERS}) if(TARGET protobuf::libprotobuf-lite) target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf-lite) -else() +elseif(TARGET protobuf::libprotobuf) target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf) +else() + message(FATAL_ERROR "Protobuf or Protobuf-lite libraries are required to compile Mixxx.") endif() diff --git a/tools/macos_buildenv.sh b/tools/macos_buildenv.sh index 95c3120501..8585e16177 100755 --- a/tools/macos_buildenv.sh +++ b/tools/macos_buildenv.sh @@ -22,11 +22,10 @@ read_envname() { case "$COMMAND" in name) envname="$(read_envname)" - if [ "$1" = "--ghactions" ] + echo "$envname" + if [ -n "${GITHUB_ENV}" ] then - echo "::set-output name=buildenv_name::$envname" - else - echo "$envname" + echo "BUILDENV_NAME=$envname" >> "${GITHUB_ENV}" fi ;; @@ -35,7 +34,7 @@ case "$COMMAND" in if [[ "$BUILDENV_NAME" =~ .*macosminimum([0-9]*\.[0-9]*).* ]] then - MACOSX_DEPLOYMENT_TARGET="${BASH_REMATCH[1]}" + export MACOSX_DEPLOYMENT_TARGET="${BASH_REMATCH[1]}" else echo "Build environment did not match expected pattern. Check cmake/macos_build_environment_name file." >&2 exit 1 @@ -52,10 +51,10 @@ case "$COMMAND" in fi echo "Using build environment: ${BUILDENV_PATH}" - CMAKE_PREFIX_PATH="${BUILDENV_PATH}" - PATH="${BUILDENV_PATH}/bin:${PATH}" - QT_PATH="$(find "${BUILDENV_PATH}" -type d -path "*/cmake/Qt5")" - QT_QPA_PLATFORM_PLUGIN_PATH="$(find "${BUILDENV_PATH}" -type d -path "*/plugins")" + export CMAKE_PREFIX_PATH="${BUILDENV_PATH}" + export PATH="${BUILDENV_PATH}/bin:${PATH}" + export QT_PATH="$(find "${BUILDENV_PATH}" -type d -path "*/cmake/Qt5")" + export QT_QPA_PLATFORM_PLUGIN_PATH="$(find "${BUILDENV_PATH}" -type d -path "*/plugins")" echo "Environent Variables:" echo "- PATH=${PATH}" @@ -66,19 +65,15 @@ case "$COMMAND" in echo "- CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" echo "- Qt5_DIR=${QT_PATH}" - if [ "$1" = "--ghactions" ] + if [ -n "${GITHUB_ENV}" ] then - echo "::set-output name=macosx_deployment_target::${MACOSX_DEPLOYMENT_TARGET}" - echo "::set-output name=cmake_prefix_path::${CMAKE_PREFIX_PATH}" - echo "::set-output name=path::${PATH}" - echo "::set-output name=qt_path::${QT_PATH}" - echo "::set-output name=qt_qpa_platform_plugin_path::${QT_QPA_PLATFORM_PLUGIN_PATH}" - else - export MACOSX_DEPLOYMENT_TARGET - export CMAKE_PREFIX_PATH - export PATH - export QT_PATH - export QT_QPA_PLATFORM_PLUGIN_PATH + { + echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" + echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" + echo "PATH=${PATH}" + echo "QT_PATH=${QT_PATH}" + echo "QT_QPA_PLATFORM_PLUGIN_PATH=${QT_QPA_PLATFORM_PLUGIN_PATH}" + } >> "${GITHUB_ENV}" fi ;; esac diff --git a/tools/ubuntu_buildenv.sh b/tools/ubuntu_buildenv.sh index fba3609ff6..021b4687f4 100755 --- a/tools/ubuntu_buildenv.sh +++ b/tools/ubuntu_buildenv.sh @@ -7,11 +7,6 @@ shift case "$COMMAND" in name) echo "No build environment needed for Ubuntu, please install dependencies using apt." >&2 - - if [ "$1" = "--ghactions" ] - then - echo "::set-output name=buildenv_name::" - fi ;; setup) @@ -28,7 +23,7 @@ case "$COMMAND" in DISTRIB_CODENAME= esac - if [ ! -z "${DISTRIB_CODENAME}" ] + if [ -n "${DISTRIB_CODENAME}" ] then sudo apt-get update sudo apt-get install -y --no-install-recommends \ @@ -67,17 +62,5 @@ case "$COMMAND" in qtscript5-dev \ ${PACKAGES_EXTRA} fi - - if [ "$1" = "--ghactions" ] - then - QT_QPA_PLATFORM_PLUGIN_PATH="$(qtpaths --plugin-directory)" - - echo "::set-output name=buildenv_path::" - echo "::set-output name=macosx_deployment_target::" - echo "::set-output name=cmake_prefix_path::" - echo "::set-output name=path::${PATH}" - echo "::set-output name=qt_path::" - echo "::set-output name=qt_qpa_platform_plugin_path::${QT_QPA_PLATFORM_PLUGIN_PATH}" - fi ;; esac diff --git a/tools/windows_buildenv.bat b/tools/windows_buildenv.bat new file mode 100644 index 0000000000..b168187a8e --- /dev/null +++ b/tools/windows_buildenv.bat @@ -0,0 +1,104 @@ +@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + +CALL :REALPATH %~dp0\.. +SET MIXXX_ROOT=%RETVAL% + +IF "%PLATFORM%"=="" ( + SET PLATFORM=x64 +) + +IF "%CONFIGURATION%"=="" ( + SET CONFIGURATION=release-fastbuild +) + +IF "%BUILDENV_BASEPATH%"=="" ( + SET BUILDENV_BASEPATH="%MIXXX_ROOT%\buildenv" +) + +IF "%BUILDENV_BASEPATH%"=="" ( + SET BUILDENV_BASEPATH="%MIXXX_ROOT%\buildenv" +) + +CALL :COMMAND_%1 +EXIT /B 0 + +:COMMAND_name + CALL :READ_ENVNAME + ECHO "%RETVAL%" + IF "%CI%" == "true" ( + ECHO BUILDENV_NAME=!RETVAL! >> %GITHUB_ENV% + ) + GOTO :EOF + +:COMMAND_setup + CALL :READ_ENVNAME + SET BUILDENV_NAME=%RETVAL% + SET BUILDENV_PATH=%BUILDENV_BASEPATH%\%BUILDENV_NAME% + MD %BUILDENV_BASEPATH% + + IF NOT EXIST %BUILDENV_PATH% ( + SET BUILDENV_URL=https://downloads.mixxx.org/builds/buildserver/2.3.x-windows/%BUILDENV_NAME%.zip + ECHO Downloading !BUILDENV_URL! + BITSADMIN /transfer buildenvjob /download /priority normal !BUILDENV_URL! !BUILDENV_PATH!.zip + REM TODO: verify download using sha256sum? + ECHO Unpacking %BUILDENV_PATH%.zip + CALL :UNZIP "%BUILDENV_PATH%.zip" "%BUILDENV_BASEPATH%" + ECHO Unpacking complete. + DEL /f /q %BUILDENV_PATH%.zip + ) + + ECHO Using build environment: %BUILDENV_PATH% + ENDLOCAL + + SET PATH=!BUILDENV_PATH!\bin;!PATH! + # Remove C:\Program Files\Git\usr\bin from the PATH + # This works around an issue on the windows-2016 builder provided by GitHub + # Actions, see this for details: + # - https://github.com/actions/cache/issues/333 + # - https://github.com/actions/virtual-environments/issues/480 + SET PATH=%PATH:C:\Program Files\Git\usr\bin;=% + + FOR /D %%G IN (%BUILDENV_PATH%\Qt-*) DO (SET Qt5_DIR=%%G) + SET CMAKE_PREFIX_PATH=!BUILDENV_PATH!;!Qt5_DIR! + + ECHO ^Environent Variables: + ECHO ^- PATH=!PATH! + ECHO ^CMake Configuration: + ECHO ^- CMAKE_PREFIX_PATH=!CMAKE_PREFIX_PATH! + + IF NOT "%GITHUB_ENV%" == "" ( + ECHO CMAKE_PREFIX_PATH=!CMAKE_PREFIX_PATH!>>%GITHUB_ENV% + ECHO PATH=!PATH!>>%GITHUB_ENV% + ) + GOTO :EOF + + +:UNZIP <newzipfile> <ExtractTo> + SET vbs="%temp%\_.vbs" + IF EXIST %vbs% del /f /q %vbs% + >%vbs% echo Set fso = CreateObject("Scripting.FileSystemObject") + >>%vbs% echo If NOT fso.FolderExists(%2) Then + >>%vbs% echo fso.CreateFolder(%2) + >>%vbs% echo End If + >>%vbs% echo Set objShell = CreateObject("Shell.Application") + >>%vbs% echo Set FilesInZip=objShell.NameSpace(%1).items + >>%vbs% echo objShell.NameSpace(%2).CopyHere(FilesInZip) + >>%vbs% echo Set fso = Nothing + >>%vbs% echo Set objShell = Nothing + cscript //nologo %vbs% + IF EXIST %vbs% DEL /f /q %vbs% + GOTO :EOF + + +:REALPATH + SET RETVAL=%~f1 + GOTO :EOF + + +:READ_ENVNAME + SET /P BUILDENV_NAME=<%MIXXX_ROOT%\cmake\windows_build_environment_name + SET BUILDENV_NAME=!BUILDENV_NAME:PLATFORM=%PLATFORM%! + SET BUILDENV_NAME=!BUILDENV_NAME:CONFIGURATION=%CONFIGURATION%! + SET RETVAL=%BUILDENV_NAME% + GOTO :EOF |