diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000000..41fa39b78d --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,116 @@ +name: Build and test + +on: +- push +- pull_request + +env: + BUILD_TYPE: RelWithDebInfo + +jobs: + Ubuntu: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Add OpenMW PPA Dependencies + run: sudo add-apt-repository ppa:openmw/openmw; sudo apt-get update + + - name: Install Building Dependencies + run: sudo CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic + + - name: Prime ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.os }}-${{ env.BUILD_TYPE }} + max-size: 1000M + + - name: Configure + run: > + cmake . + -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -D OPENMW_USE_SYSTEM_RECASTNAVIGATION=ON + -D USE_SYSTEM_TINYXML=ON + -D BUILD_COMPONENTS_TESTS=ON + -D BUILD_OPENMW_TESTS=ON + -D BUILD_OPENCS_TESTS=ON + -D CMAKE_INSTALL_PREFIX=install + + - name: Build + run: cmake --build . -- -j$(nproc) + + - name: Run components tests + run: ./components-tests + + - name: Run OpenMW tests + run: ./openmw-tests + + - name: Run OpenMW-CS tests + run: ./openmw-cs-tests + + # - name: Install + # shell: bash + # run: cmake --install . + + # - name: Create Artifact + # shell: bash + # working-directory: install + # run: | + # ls -laR + # 7z a ../build_artifact.7z . + + # - name: Upload Artifact + # uses: actions/upload-artifact@v1 + # with: + # path: ./build_artifact.7z + # name: build_artifact.7z + + MacOS: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Building Dependencies + run: CI/before_install.osx.sh + + - name: Prime ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.os }}-${{ env.BUILD_TYPE }} + max-size: 1000M + + - name: Configure + run: CI/before_script.osx.sh + - name: Build + run: | + cd build + make -j $(sysctl -n hw.logicalcpu) package + + Output-Envs: + name: Read .env file and expose it as output + runs-on: ubuntu-latest + outputs: + VCPKG_DEPS_TAG: ${{ env.VCPKG_DEPS_TAG }} + BUILD_TYPE: ${{ env.BUILD_TYPE }} + steps: + - uses: actions/checkout@v4 + - run: cat "${{ github.workspace }}/CI/github.env" >> $GITHUB_ENV + + Windows: + needs: + - Output-Envs + + strategy: + fail-fast: true + matrix: + image: + - "2019" + - "2022" + + uses: ./.github/workflows/windows.yml + with: + image: ${{ matrix.image }} + vcpkg-deps-tag: ${{ needs.Output-Envs.outputs.VCPKG_DEPS_TAG }} + build-type: ${{ needs.Output-Envs.outputs.BUILD_TYPE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..d8d8d9ca6a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + tags: + - openmw-** + +jobs: + Output-Envs: + name: Read .env file and expose it as output + runs-on: ubuntu-latest + outputs: + VCPKG_DEPS_TAG: ${{ env.VCPKG_DEPS_TAG }} + steps: + - uses: actions/checkout@v4 + - run: cat "${{ github.workspace }}/CI/github.env" >> $GITHUB_ENV + + Windows: + needs: + - Output-Envs + uses: ./.github/workflows/windows.yml + with: + image: "2022" + vcpkg-deps-tag: ${{ needs.Output-Envs.outputs.VCPKG_DEPS_TAG }} + build-type: Release + package: true diff --git a/.github/workflows/openmw.yml b/.github/workflows/windows.yml similarity index 51% rename from .github/workflows/openmw.yml rename to .github/workflows/windows.yml index cfc1faa438..5d3f030abc 100644 --- a/.github/workflows/openmw.yml +++ b/.github/workflows/windows.yml @@ -1,111 +1,38 @@ -name: CMake +name: Reusable Windows workflow on: -- push -- pull_request - -env: - BUILD_TYPE: RelWithDebInfo - VCPKG_DEPS_TAG: 2024-11-10 + workflow_call: + inputs: + image: + description: MSVC image (2019/2022) + required: true + type: string + vcpkg-deps-tag: + description: Git tag of our deps + required: true + type: string + build-type: + default: RelWithDebInfo + type: string + package: + default: false + type: boolean jobs: - Ubuntu: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Add OpenMW PPA Dependencies - run: sudo add-apt-repository ppa:openmw/openmw; sudo apt-get update - - - name: Install Building Dependencies - run: sudo CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic - - - name: Prime ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: ${{ matrix.os }}-${{ env.BUILD_TYPE }} - max-size: 1000M - - - name: Configure - run: > - cmake . - -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - -D OPENMW_USE_SYSTEM_RECASTNAVIGATION=ON - -D USE_SYSTEM_TINYXML=ON - -D BUILD_COMPONENTS_TESTS=ON - -D BUILD_OPENMW_TESTS=ON - -D BUILD_OPENCS_TESTS=ON - -D CMAKE_INSTALL_PREFIX=install - - - name: Build - run: cmake --build . -- -j$(nproc) - - - name: Run components tests - run: ./components-tests - - - name: Run OpenMW tests - run: ./openmw-tests - - - name: Run OpenMW-CS tests - run: ./openmw-cs-tests - - # - name: Install - # shell: bash - # run: cmake --install . - - # - name: Create Artifact - # shell: bash - # working-directory: install - # run: | - # ls -laR - # 7z a ../build_artifact.7z . - - # - name: Upload Artifact - # uses: actions/upload-artifact@v1 - # with: - # path: ./build_artifact.7z - # name: build_artifact.7z - - MacOS: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install Building Dependencies - run: CI/before_install.osx.sh - - - name: Prime ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: ${{ matrix.os }}-${{ env.BUILD_TYPE }} - max-size: 1000M - - - name: Configure - run: CI/before_script.osx.sh - - name: Build - run: | - cd build - make -j $(sysctl -n hw.logicalcpu) package - Windows: - strategy: - fail-fast: true - matrix: - image: - - "2019" - - "2022" + name: windows-${{ inputs.image }} - name: windows-${{ matrix.image }} - - runs-on: windows-${{ matrix.image }} + runs-on: windows-${{ inputs.image }} env: archive: FAILEDTODOWNLOAD steps: - - uses: actions/checkout@v2 + - name: Install NSIS + if: ${{ inputs.package }} + run: choco install nsis + + - uses: actions/checkout@v4 - name: Create directories for dependencies run: | @@ -115,7 +42,7 @@ jobs: - name: Download prebuilt vcpkg packages working-directory: ${{ github.workspace }}/deps run: | - $MANIFEST = "vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_TAG }}.txt" + $MANIFEST = "vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}.txt" curl --fail --retry 3 -L -o "$MANIFEST" "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/$MANIFEST" $lines = Get-Content "$MANIFEST" $URL = $lines[0] @@ -131,7 +58,7 @@ jobs: - name: Extract archived prebuilt vcpkg packages working-directory: ${{ github.workspace }}/deps - run: 7z x -y -ovcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_TAG }} ${{ env.archive }} + run: 7z x -y -ovcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }} $env:archive - name: Cache Qt id: qt-cache @@ -163,58 +90,69 @@ jobs: -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_TAG }}/scripts/buildsystems/vcpkg.cmake' + -D CMAKE_BUILD_TYPE=${{ inputs.build-type }} + -D CMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/deps/vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}/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_TAG }}/installed/x64-windows/include/luajit' - -D LuaJit_LIBRARY='${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_TAG }}/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 + ${{ inputs.package && '-D CMAKE_CXX_FLAGS_RELEASE="/O2 /Ob2 /DNDEBUG /Zi"' || '' }} + ${{ inputs.package && '-D "CMAKE_EXE_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO"' || '' }} + -D LuaJit_INCLUDE_DIR='${{ github.workspace }}/deps/vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}/installed/x64-windows/include/luajit' + -D LuaJit_LIBRARY='${{ github.workspace }}/deps/vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}/installed/x64-windows/lib/lua51.lib' + -D BUILD_BENCHMARKS=${{ ! inputs.package }} + -D BUILD_COMPONENTS_TESTS=${{ ! inputs.package }} + -D BUILD_OPENMW_TESTS=${{ ! inputs.package }} + -D BUILD_OPENCS_TESTS=${{ ! inputs.package }} -D OPENMW_USE_SYSTEM_SQLITE3=OFF -D OPENMW_USE_SYSTEM_YAML_CPP=OFF -D OPENMW_LTO_BUILD=ON + ${{ inputs.package && '-D "VCREDIST64=$env:VCToolsRedistDir/vc_redist.x64.exe"' || '' }} - name: Build OpenMW run: cmake --build ${{ github.workspace }}/build - - name: Install OpenMW - 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_TAG }}/installed/x64-windows/bin/Release/MyGUIEngine.dll ${{ github.workspace }}/install - cp -Filter *.dll -Recurse ${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_TAG }}/installed/x64-windows/bin/osgPlugins-3.6.5 ${{ github.workspace }}/install - cp ${{ github.workspace }}/deps/vcpkg-x64-${{ matrix.image }}-${{ env.VCPKG_DEPS_TAG }}/installed/x64-windows/bin/*.dll ${{ github.workspace }}/install + cp ${{ github.workspace }}/deps/vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}/installed/x64-windows/bin/Release/MyGUIEngine.dll ${{ github.workspace }}/build + cp -Filter *.dll -Recurse ${{ github.workspace }}/deps/vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}/installed/x64-windows/bin/osgPlugins-3.6.5 ${{ github.workspace }}/build + cp ${{ github.workspace }}/deps/vcpkg-x64-${{ inputs.image }}-${{ inputs.vcpkg-deps-tag }}/installed/x64-windows/bin/*.dll ${{ github.workspace }}/build - 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 + cp bin/Qt6Core.dll ${{ github.workspace }}/build + cp bin/Qt6Gui.dll ${{ github.workspace }}/build + cp bin/Qt6Network.dll ${{ github.workspace }}/build + cp bin/Qt6OpenGL.dll ${{ github.workspace }}/build + cp bin/Qt6OpenGLWidgets.dll ${{ github.workspace }}/build + cp bin/Qt6Widgets.dll ${{ github.workspace }}/build + cp bin/Qt6Svg.dll ${{ github.workspace }}/build + mkdir ${{ github.workspace }}/build/styles + cp plugins/styles/qwindowsvistastyle.dll ${{ github.workspace }}/build/styles + mkdir ${{ github.workspace }}/build/platforms + cp plugins/platforms/qwindows.dll ${{ github.workspace }}/build/platforms + mkdir ${{ github.workspace }}/build/imageformats + cp plugins/imageformats/qsvg.dll ${{ github.workspace }}/build/imageformats + mkdir ${{ github.workspace }}/build/iconengines + cp plugins/iconengines/qsvgicon.dll ${{ github.workspace }}/build/iconengines - name: Move pdb files run: | - robocopy install pdb *.pdb /MOVE + robocopy build pdb *.pdb /MOVE if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null } + - name: Install OpenMW + if: ${{ ! inputs.package }} + run: cmake --install ${{ github.workspace }}/build --prefix ${{ github.workspace }}/install + + - name: Package OpenMW + if: ${{ inputs.package }} + run: | + cpack --config "${{ github.workspace }}/build/CPackConfig.cmake" -B "${{ github.workspace }}/install" + rm -r -Force "${{ github.workspace }}/install/_CPack_Packages" + - name: Remove extra pdb files + if: ${{ ! inputs.package }} shell: bash run: | rm -rf install/bin @@ -225,20 +163,20 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - job_url=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "windows-${{ matrix.image }}") | .url') + job_url=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "windows-${{ inputs.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-windows-${{ matrix.image }}-pdb-${{ github.sha }} + name: openmw-windows-${{ inputs.image }}-pdb-${{ github.sha }} path: ${{ github.workspace }}/pdb/* - name: Store OpenMW build artifacts uses: actions/upload-artifact@v4 with: - name: openmw-windows-${{ matrix.image }}-${{ github.sha }} + name: openmw-windows-${{ inputs.image }}-${{ github.sha }} path: ${{ github.workspace }}/install/* - name: Add install directory to PATH @@ -246,19 +184,25 @@ jobs: run: echo '${{ github.workspace }}/install' >> ${GITHUB_PATH} - name: Run components tests + if: ${{ ! inputs.package }} run: build/components-tests.exe - name: Run OpenMW tests + if: ${{ ! inputs.package }} run: build/openmw-tests.exe - name: Run OpenMW-CS tests + if: ${{ ! inputs.package }} run: build/openmw-cs-tests.exe - name: Run detournavigator navmeshtilescache benchmark + if: ${{ ! inputs.package }} run: build/openmw_detournavigator_navmeshtilescache_benchmark.exe - name: Run settings access benchmark + if: ${{ ! inputs.package }} run: build/openmw_settings_access_benchmark.exe - name: Run esm refid benchmark + if: ${{ ! inputs.package }} run: build/openmw_esm_refid_benchmark.exe diff --git a/CI/github.env b/CI/github.env new file mode 100644 index 0000000000..d8ca8b429f --- /dev/null +++ b/CI/github.env @@ -0,0 +1 @@ +VCPKG_DEPS_TAG=2024-11-10 diff --git a/CMakeLists.txt b/CMakeLists.txt index 80a50297ef..728ba2ef22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1006,25 +1006,12 @@ elseif(NOT APPLE) SET(CPACK_NSIS_MUI_UNIICON "${OpenMW_SOURCE_DIR}/files/windows/openmw.ico") SET(CPACK_PACKAGE_ICON "${OpenMW_SOURCE_DIR}\\\\files\\\\openmw.bmp") - SET(VCREDIST32 "${OpenMW_BINARY_DIR}/vcredist_x86.exe") - if(EXISTS ${VCREDIST32}) - INSTALL(FILES ${VCREDIST32} DESTINATION "redist") - SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\redist\\\\vcredist_x86.exe\\\" /q /norestart'" ) - endif(EXISTS ${VCREDIST32}) - - SET(VCREDIST64 "${OpenMW_BINARY_DIR}/vcredist_x64.exe") + SET(VCREDIST64 "${OpenMW_BINARY_DIR}/vcredist_x64.exe" CACHE FILEPATH "Path to vcredist_x64.exe") if(EXISTS ${VCREDIST64}) INSTALL(FILES ${VCREDIST64} DESTINATION "redist") SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\redist\\\\vcredist_x64.exe\\\" /q /norestart'" ) endif(EXISTS ${VCREDIST64}) - SET(OALREDIST "${OpenMW_BINARY_DIR}/oalinst.exe") - if(EXISTS ${OALREDIST}) - INSTALL(FILES ${OALREDIST} DESTINATION "redist") - SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} - ExecWait '\\\"$INSTDIR\\\\redist\\\\oalinst.exe\\\" /s'" ) - endif(EXISTS ${OALREDIST}) - if(CMAKE_CL_64) SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") endif()