diff options
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r-- | .github/workflows/build.yml | 149 |
1 files changed, 127 insertions, 22 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba8f9d38..3225cf1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,10 @@ jobs: - os: ubuntu-20.04 qt_ver: 6 qt_host: linux + qt_arch: '' qt_version: '6.2.4' qt_modules: 'qt5compat qtimageformats' + qt_tools: '' - os: windows-2022 name: "Windows-Legacy" @@ -38,13 +40,39 @@ jobs: msystem: clang64 qt_ver: 6 + - os: windows-2022 + name: "Windows-Legacy-MSVC" + msystem: '' + architecture: 'win32' + vcvars_arch: 'amd64_x86' + qt_ver: 5 + qt_host: windows + qt_arch: 'win32_msvc2019' + qt_version: '5.15.2' + qt_modules: '' + qt_tools: 'tools_openssl_x86' + + - os: windows-2022 + name: "Windows-MSVC" + msystem: '' + architecture: 'x64' + vcvars_arch: 'amd64' + qt_ver: 6 + qt_host: windows + qt_arch: '' + qt_version: '6.4.0' + qt_modules: 'qt5compat qtimageformats' + qt_tools: '' + - os: macos-12 name: macOS macosx_deployment_target: 10.15 qt_ver: 6 qt_host: mac + qt_arch: '' qt_version: '6.3.0' qt_modules: 'qt5compat qtimageformats' + qt_tools: '' - os: macos-12 name: macOS-Legacy @@ -53,6 +81,7 @@ jobs: qt_host: mac qt_version: '5.15.2' qt_modules: '' + qt_tools: '' runs-on: ${{ matrix.os }} @@ -82,7 +111,7 @@ jobs: languages: cpp, java - name: 'Setup MSYS2' - if: runner.os == 'Windows' + if: runner.os == 'Windows' && matrix.msystem != '' uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.msystem }} @@ -102,14 +131,19 @@ jobs: ccache:p ${{ matrix.qt_ver == 6 && 'qt6-5compat:p' || '' }} + - name: Force newer ccache + if: runner.os == 'Windows' && matrix.msystem == '' && inputs.build_type == 'Debug' + run: | + choco install ccache --version 4.7.1 + - name: Setup ccache - if: runner.os != 'Windows' && inputs.build_type == 'Debug' + if: (runner.os != 'Windows' || matrix.msystem == '') && inputs.build_type == 'Debug' uses: hendrikmuhs/ccache-action@v1.2.5 with: key: ${{ matrix.os }}-qt${{ matrix.qt_ver }} - - name: Setup ccache (Windows) - if: runner.os == 'Windows' && inputs.build_type == 'Debug' + - name: Setup ccache (Windows MinGW-w64) + if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug' shell: msys2 {0} run: | ccache --set-config=cache_dir='${{ github.workspace }}\.ccache' @@ -124,8 +158,8 @@ jobs: run: | echo "CCACHE_VAR=ccache" >> $GITHUB_ENV - - name: Retrieve ccache cache (Windows) - if: runner.os == 'Windows' && inputs.build_type == 'Debug' + - name: Retrieve ccache cache (Windows MinGW-w64) + if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug' uses: actions/cache@v3.0.11 with: path: '${{ github.workspace }}\.ccache' @@ -156,14 +190,16 @@ jobs: run: | sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5 - - name: Install Qt (macOS and AppImage) - if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' + - name: Install Qt (macOS, AppImage & Windows MSVC) + if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' || (runner.os == 'Windows' && matrix.msystem == '') uses: jurplel/install-qt-action@v3 with: version: ${{ matrix.qt_version }} host: ${{ matrix.qt_host }} target: 'desktop' + arch: ${{ matrix.qt_arch }} modules: ${{ matrix.qt_modules }} + tools: ${{ matrix.qt_tools }} cache: true cache-key-prefix: ${{ matrix.qt_host }}-${{ matrix.qt_version }}-"${{ matrix.qt_modules }}"-qt_cache @@ -190,12 +226,27 @@ jobs: run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DMACOSX_SPARKLE_UPDATE_PUBLIC_KEY="" -DMACOSX_SPARKLE_UPDATE_FEED_URL="" -G Ninja - - name: Configure CMake (Windows) - if: runner.os == 'Windows' + - name: Configure CMake (Windows MinGW-w64) + if: runner.os == 'Windows' && matrix.msystem != '' shell: msys2 {0} run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -G Ninja + - name: Configure CMake (Windows MSVC) + if: runner.os == 'Windows' && matrix.msystem == '' + run: | + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" -A${{ matrix.architecture}} + # https://github.com/ccache/ccache/wiki/MS-Visual-Studio (I coudn't figure out the compiler prefix) + if ("${{ env.CCACHE_VAR }}") + { + Copy-Item C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.7.1-windows-x86_64/ccache.exe -Destination C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.7.1-windows-x86_64/cl.exe + echo "CLToolExe=cl.exe" >> $env:GITHUB_ENV + echo "CLToolPath=C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.7.1-windows-x86_64/" >> $env:GITHUB_ENV + echo "TrackFileAccess=false" >> $env:GITHUB_ENV + } + # Needed for ccache, but also speeds up compile + echo "UseMultiToolTask=true" >> $env:GITHUB_ENV + - name: Configure CMake (Linux) if: runner.os == 'Linux' run: | @@ -210,12 +261,17 @@ jobs: run: | cmake --build ${{ env.BUILD_DIR }} - - name: Build (Windows) - if: runner.os == 'Windows' + - name: Build (Windows MinGW-w64) + if: runner.os == 'Windows' && matrix.msystem != '' shell: msys2 {0} run: | cmake --build ${{ env.BUILD_DIR }} + - name: Build (Windows MSVC) + if: runner.os == 'Windows' && matrix.msystem == '' + run: | + cmake --build ${{ env.BUILD_DIR }} --config ${{ inputs.build_type }} + ## # TEST ## @@ -223,13 +279,18 @@ jobs: - name: Test if: runner.os != 'Windows' run: | - ctest --test-dir build --output-on-failure + ctest -E "^example64|example$" --test-dir build --output-on-failure - - name: Test (Windows) - if: runner.os == 'Windows' + - name: Test (Windows MinGW-w64) + if: runner.os == 'Windows' && matrix.msystem != '' shell: msys2 {0} run: | - ctest --test-dir build --output-on-failure + ctest -E "^example64|example$" --test-dir build --output-on-failure + + - name: Test (Windows MSVC) + if: runner.os == 'Windows' && matrix.msystem == '' + run: | + ctest -E "^example64|example$" --test-dir build --output-on-failure -C ${{ inputs.build_type }} ## # CODE SCAN @@ -273,8 +334,14 @@ jobs: EOF fi - - name: Package (Windows) - if: runner.os == 'Windows' + - name: Add VC Enviroment Variables + if: runner.os == 'Windows' && matrix.msystem == '' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.vcvars_arch }} + + - name: Package (Windows MinGW-w64) + if: runner.os == 'Windows' && matrix.msystem != '' shell: msys2 {0} run: | cmake --install ${{ env.BUILD_DIR }} @@ -284,13 +351,31 @@ jobs: cp /clang32/bin/libcrypto-1_1.dll /clang32/bin/libssl-1_1.dll ./ fi - - name: Package (Windows, portable) - if: runner.os == 'Windows' + - name: Package (Windows MSVC) + if: runner.os == 'Windows' && matrix.msystem == '' + run: | + cmake --install ${{ env.BUILD_DIR }} --config ${{ inputs.build_type }} + + cd ${{ env.INSTALL_DIR }} + if ("${{ matrix.qt_ver }}" -eq "5") + { + Copy-Item D:/a/PrismLauncher/Qt/Tools/OpenSSL/Win_x86/bin/libcrypto-1_1.dll -Destination libcrypto-1_1.dll + Copy-Item D:/a/PrismLauncher/Qt/Tools/OpenSSL/Win_x86/bin/libssl-1_1.dll -Destination libssl-1_1.dll + } + + - name: Package (Windows MinGW-w64, portable) + if: runner.os == 'Windows' && matrix.msystem != '' shell: msys2 {0} run: | cp -r ${{ env.INSTALL_DIR }} ${{ env.INSTALL_PORTABLE_DIR }} # cmake install on Windows is slow, let's just copy instead cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_PORTABLE_DIR }} --component portable + - name: Package (Windows MSVC, portable) + if: runner.os == 'Windows' && matrix.msystem == '' + run: | + cp -r ${{ env.INSTALL_DIR }} ${{ env.INSTALL_PORTABLE_DIR }} # cmake install on Windows is slow, let's just copy instead + cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_PORTABLE_DIR }} --component portable + - name: Package (Windows, installer) if: runner.os == 'Windows' run: | @@ -411,5 +496,25 @@ jobs: with: name: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage path: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage - - + snap: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: 'true' + - name: Set short version + shell: bash + run: | + ver_short=`git rev-parse --short HEAD` + echo "VERSION=$ver_short" >> $GITHUB_ENV + - name: Package Snap (Linux) + id: snapcraft + if: runner.os == 'Linux' && matrix.qt_ver != 5 + uses: snapcore/action-build@v1 + - name: Upload Snap (Linux) + if: runner.os == 'Linux' && matrix.qt_ver != 5 + uses: actions/upload-artifact@v3 + with: + name: prismlauncher_${{ env.VERSION }}_amd64.snap + path: ${{ steps.snapcraft.outputs.snap }} |