diff --git a/.github/workflows/openmw.yml b/.github/workflows/openmw.yml index 39ca5b166b..9d65b262d1 100644 --- a/.github/workflows/openmw.yml +++ b/.github/workflows/openmw.yml @@ -6,6 +6,7 @@ on: env: BUILD_TYPE: RelWithDebInfo + VCPKG_DEPS_REVISION: 14f130a69c29d10ecd31305db45979cf12f0c162 jobs: Ubuntu: @@ -89,3 +90,144 @@ jobs: run: | cd build make -j $(sysctl -n hw.logicalcpu) package + + Windows: + strategy: + fail-fast: true + matrix: + image: + - windows-2019 + - windows-2022 + + name: ${{ matrix.image }} + + runs-on: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v2 + + - name: Create directories for dependencies + run: | + mkdir -p ${{ github.workspace }}/deps + mkdir -p ${{ github.workspace }}/deps/Qt + + - name: Download prebuilt vcpkg packages + working-directory: ${{ github.workspace }}/deps + run: > + curl --fail --retry 3 -L + -o vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}.7z + https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}.7z + + - name: Extract archived prebuilt vcpkg packages + working-directory: ${{ github.workspace }}/deps + run: 7z x -y -ovcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }} vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}.7z + + - name: Cache Qt + id: qt-cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/deps/Qt/6.6.3/msvc2019_64 + key: qt-cache-6.6.3-msvc2019_64-v1 + + - name: Download aqt + if: steps.qt-cache.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/deps/Qt + run: > + curl --fail --retry 3 -L + -o aqt_x64.exe + https://github.com/miurahr/aqtinstall/releases/download/v3.1.15/aqt_x64.exe + + - name: Install Qt with aqt + if: steps.qt-cache.outputs.cache-hit != 'true' + working-directory: ${{ github.workspace }}/deps/Qt + run: .\aqt_x64.exe install-qt windows desktop 6.6.3 win64_msvc2019_64 + + - uses: ilammy/msvc-dev-cmd@v1 + + - uses: seanmiddleditch/gha-setup-ninja@master + + - name: Configure OpenMW + run: > + cmake + -S . + -B ${{ github.workspace }}/build + -G Ninja + -D CMAKE_BUILD_TYPE=RelWithDebInfo + -D CMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}/scripts/buildsystems/vcpkg.cmake' + -D CMAKE_PREFIX_PATH='${{ github.workspace }}/deps/Qt/6.6.3/msvc2019_64' + -D LuaJit_INCLUDE_DIR='${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}/installed/x64-windows/include/luajit' + -D LuaJit_LIBRARY='${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}/installed/x64-windows/lib/lua51.lib' + -D BUILD_BENCHMARKS=ON + -D BUILD_COMPONENTS_TESTS=ON + -D BUILD_OPENMW_TESTS=ON + -D BUILD_OPENCS_TESTS=ON + -D OPENMW_USE_SYSTEM_SQLITE3=OFF + -D OPENMW_USE_SYSTEM_YAML_CPP=OFF + -D OPENMW_LTO_BUILD=ON + + - name: Build OpenMW + working-directory: ${{ github.workspace }} + run: cmake --build ${{ github.workspace }}/build + + - name: Install OpenMW + working-directory: ${{ github.workspace }} + run: cmake --install ${{ github.workspace }}/build --prefix ${{ github.workspace }}/install + + - name: Copy missing DLLs + run: | + cp ${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}/installed/x64-windows/bin/Release/MyGUIEngine.dll ${{ github.workspace }}/install + cp -Filter *.dll -Recurse ${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}/installed/x64-windows/bin/osgPlugins-3.6.5 ${{ github.workspace }}/install + cp ${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_REVISION }}/installed/x64-windows/bin/*.dll ${{ github.workspace }}/install + + - name: Copy Qt DLLs + working-directory: ${{ github.workspace }}/deps/Qt/6.6.3/msvc2019_64 + run: | + cp bin/Qt6Core.dll ${{ github.workspace }}/install + cp bin/Qt6Gui.dll ${{ github.workspace }}/install + cp bin/Qt6Network.dll ${{ github.workspace }}/install + cp bin/Qt6OpenGL.dll ${{ github.workspace }}/install + cp bin/Qt6OpenGLWidgets.dll ${{ github.workspace }}/install + cp bin/Qt6Widgets.dll ${{ github.workspace }}/install + cp bin/Qt6Svg.dll ${{ github.workspace }}/install + mkdir ${{ github.workspace }}/install/styles + cp plugins/styles/qwindowsvistastyle.dll ${{ github.workspace }}/install/styles + mkdir ${{ github.workspace }}/install/platforms + cp plugins/platforms/qwindows.dll ${{ github.workspace }}/install/platforms + mkdir ${{ github.workspace }}/install/imageformats + cp plugins/imageformats/qsvg.dll ${{ github.workspace }}/install/imageformats + mkdir ${{ github.workspace }}/install/iconengines + cp plugins/iconengines/qsvgicon.dll ${{ github.workspace }}/install/iconengines + + - name: Move pdb files + run: | + robocopy install pdb *.pdb /MOVE + if ($lastexitcode -lt 8) { + $global:LASTEXITCODE = $null + } + + - name: Remove extra pdb files + shell: bash + run: | + rm -rf install/bin + rm -rf install/_deps + + - name: Generate CI-ID.txt + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + job_url=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "${{ matrix.image }}") | .url') + printf "Ref ${{ github.ref }}\nJob ${job_url}\nCommit ${{ github.sha }}\n" > install/CI-ID.txt + cp install/CI-ID.txt pdb/CI-ID.txt + + - name: Store OpenMW archived pdb files + uses: actions/upload-artifact@v4 + with: + name: openmw-${{ matrix.image }}-pdb-${{ github.sha }} + path: ${{ github.workspace }}/pdb/* + + - name: Store OpenMW build artifacts + uses: actions/upload-artifact@v4 + with: + name: openmw-${{ matrix.image }}-${{ github.sha }} + path: ${{ github.workspace }}/install/*