diff --git a/.ci/upload-nightly.ps1 b/.ci/upload-nightly.ps1 index 9c1c33c3..9c7da62e 100644 --- a/.ci/upload-nightly.ps1 +++ b/.ci/upload-nightly.ps1 @@ -1,3 +1,6 @@ +# disable progress bar since that requires a pty +$ProgressPreference = "SilentlyContinue" + $file = "nheko_win_64.zip" $fileName = "nheko-${env:APPVEYOR_REPO_BRANCH}-${env:APPVEYOR_REPO_COMMIT}-win64.zip" @@ -19,3 +22,4 @@ $room = "!TshDrgpBNBDmfDeEGN:neko.dev" Invoke-RestMethod -uri "https://matrix.neko.dev/_matrix/client/r0/rooms/${room}/send/m.room.message/${txid}" -Method Put -Body "$body" -ContentType 'application/json' -Headers @{"Authorization"="Bearer ${env:MATRIX_ACCESS_TOKEN}"} +exit 0 diff --git a/.ci/windows/build.bat b/.ci/windows/build.bat new file mode 100644 index 00000000..a79e2360 --- /dev/null +++ b/.ci/windows/build.bat @@ -0,0 +1,50 @@ +:: VERSION format: v1.2.3/v1.3.4 +:: INSTVERSION format: 1.2.3/1.3.4 +:: WINVERSION format: 1.2.3.123/1.3.4.234 +if defined CI_COMMIT_TAG ( + set VERSION=%CI_COMMIT_TAG% +) else ( + set VERSION=v0.11.3 +) +set INSTVERSION=%VERSION:~1% +set WINVERSION=%VERSION:~1%.%CI_JOB_ID% +set DATE=%date:~10,4%-%date:~4,2%-%date:~7,2% +echo %VERSION% +echo %INSTVERSION% +echo %DATE% + + +call "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvarsall.bat" x64 +cmake -G "Visual Studio 17 2022" -A x64 -S. -Bbuild -DHUNTER_ROOT="C:\hunter" -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON -DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release +cmake --build build --config Release + + +git clone https://github.com/Nheko-Reborn/qt-jdenticon.git +cd qt-jdenticon +qmake +nmake +cd .. + +:: create zip bundle +mkdir NhekoRelease +copy build\Release\nheko.exe NhekoRelease\nheko.exe +copy qt-jdenticon\release\qtjdenticon0.dll NhekoRelease\qtjdenticon.dll +copy build\_deps\cmark-build\src\Release\cmark.dll NhekoRelease\cmark.dll +windeployqt --qmldir resources\qml\ NhekoRelease\nheko.exe + +7z a nheko_win_64.zip .\NhekoRelease\* + + +:: create msix +mkdir msix +xcopy .\NhekoRelease\*.* msix\*.* /s /e /c /y +copy .\resources\nheko.png msix +copy .\resources\AppxManifest.xml msix +del msix\vc_redist* +::sed -i "s/ Version=[^ ]*/ Version=\"%WINVERSION%\"/" msix\AppxManifest.xml +@PowerShell "(Get-Content .\msix\AppxManifest.xml)|%%{$_ -creplace ' Version=[^ ]*',' Version=\"%WINVERSION%\"'}|Set-Content .\msix\AppxManifest.xml -Encoding utf8" + +::@PowerShell "Get-Content .\msix\AppxManifest.xml" + +"C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe" pack -d msix -p nheko.msix + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8b1c247..c28efe23 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,33 @@ variables: # prevent configure tzdata hanging apt install commands DEBIAN_FRONTEND: noninteractive +build-windows: + stage: build + image: win10-base + tags: [libvirt,powershell] + variables: + APPVEYOR_REPO_BRANCH: "${CI_COMMIT_REF_NAME}" + APPVEYOR_REPO_COMMIT: "${CI_COMMIT_SHORT_SHA}" + before_script: + - mkdir -p hunter + - Move-Item -Path hunter -Destination C:/hunter + script: + - ./.ci/windows/build.bat + after_script: + - ./.ci/upload-nightly.ps1 + - Move-Item -Path C:/hunter -Destination hunter -Force + cache: + key: "$CI_JOB_NAME" + paths: + - hunter/ + - build/_deps + artifacts: + paths: + - nheko.msix + - nheko_win_64.zip + name: nheko-${CI_COMMIT_SHORT_SHA}-windows + expose_as: 'windows-app' + build-clazy: stage: build image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest @@ -18,11 +45,12 @@ build-clazy: TRAVIS_OS_NAME: linux before_script: - echo -e "\e[0Ksection_start:`date +%s`:install_deps[collapsed=true]\r\e[0K\e[1m\e[95mInstalling apk dependencies" - - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev + - apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev clang16 - echo -e "\e[0Ksection_end:`date +%s`:install_deps\r\e[0K" script: - export PATH="/usr/lib/ccache:${PATH}" - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) + - export CLANGXX=clang++-16 - cmake -GNinja -H. -Bbuild -DCMAKE_INSTALL_PREFIX=.deps/usr -DHUNTER_ENABLED=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_MTXCLIENT=ON -DUSE_BUNDLED_COEURL=ON -DUSE_BUNDLED_OLM=ON -DUSE_BUNDLED_QTKEYCHAIN=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON @@ -317,7 +345,7 @@ linting: - apk update && apk add make git python3 py3-pip qt6-qtdeclarative-dev - apk add clang-extra-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main - export PATH="$PATH:/root/.local/bin" - - pip3 install --user reuse + - pip3 install --break-system-packages --user reuse script: - make lint - make license diff --git a/cmake/QtCommon.cmake b/cmake/QtCommon.cmake index 2c7f34f6..f42b1c2e 100644 --- a/cmake/QtCommon.cmake +++ b/cmake/QtCommon.cmake @@ -64,14 +64,4 @@ elseif (WIN32) endif() endmacro() -macro(fix_win_compiler) -if (MSVC) - set_target_properties(${PROJECT_NAME} PROPERTIES - WIN32_EXECUTABLE YES - LINK_FLAGS "/ENTRY:mainCRTStartup" - ) -endif() -endmacro() - init_os_bundle() -fix_win_compiler()