From e368227780f02ae67aa1e47da67a104b5fc72b7e Mon Sep 17 00:00:00 2001 From: TheOneWithTheBraid Date: Fri, 16 Sep 2022 13:50:20 +0200 Subject: [PATCH] feat: include olm to Windows builds Signed-off-by: TheOneWithTheBraid --- .gitignore | 1 + .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++---- scripts/build-olm-windows.sh | 7 +++++++ scripts/build-windows.ps1 | 5 ----- scripts/package-windows.ps1 | 5 +++++ scripts/prepare-windows.ps1 | 2 +- 6 files changed, 44 insertions(+), 10 deletions(-) create mode 100755 scripts/build-olm-windows.sh create mode 100644 scripts/package-windows.ps1 diff --git a/.gitignore b/.gitignore index 93a8e344..997bbbef 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ ios/Podfile.lock /linux/out /macos/out .vs +olm diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 334d43b7..4aab8540 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -124,16 +124,42 @@ build_web: - docker - famedly +# yes, we *do* build a Windows DLL on Linux. More reliable. +build_olm_windows: + image: archlinux:latest + stage: test + before_script: + - pacman-key --init + - pacman --noconfirm -Sy mingw-w64 cmake git base-devel + script: + - ./scripts/build-olm-windows.sh + - mv olm/build/libolm.dll . + artifacts: + paths: + - libolm.dll + only: + - main + - tags + build_windows: extends: - .shared_windows_runners - stage: build - before_script: [./scripts/prepare-windows.ps1] - script: [./scripts/build-windows.ps1] + stage: test + before_script: + - ./scripts/prepare-windows.ps1 + # workarounding artifacts download being broken + - $response = Invoke-WebRequest -Uri "$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs" -UseBasicParsing + - $jobs = $response | ConvertFrom-Json + - $job = $jobs | where { $_.name -eq "build_olm_windows" } + - $jobId = $job.id + - Invoke-WebRequest -Uri "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/$jobId/artifacts/libolm.dll" -UseBasicParsing -OutFile libolm.dll + script: + - ./scripts/build-windows.ps1 + - Copy-Item -Path "libolm.dll" -Destination "build/windows/runner/Release" + - ./scripts/package-windows.ps1 artifacts: paths: - build/windows/runner/Release - allow_failure: true only: - main - tags diff --git a/scripts/build-olm-windows.sh b/scripts/build-olm-windows.sh new file mode 100755 index 00000000..003b98ee --- /dev/null +++ b/scripts/build-olm-windows.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +git clone https://gitlab.matrix.org/matrix-org/olm.git -b 3.2.12 +cd olm +cmake . -Bbuild -DCMAKE_TOOLCHAIN_FILE=Windows64.cmake +cmake --build build +cd .. diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1 index 418e81a6..0c02f80c 100644 --- a/scripts/build-windows.ps1 +++ b/scripts/build-windows.ps1 @@ -3,10 +3,5 @@ flutter config --enable-windows-desktop flutter clean flutter pub get -Write-Output "$WINDOWN_PFX" -Move-Item -Path $WINDOWS_PFX -Destination fluffychat.pem -certutil -decode fluffychat.pem fluffychat.pfx - flutter build windows --release -v -flutter pub run msix:create -c fluffychat.pfx -p $WINDOWS_PFX_PASS --sign-msix true --install-certificate false \ No newline at end of file diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1 new file mode 100644 index 00000000..b3ba0e70 --- /dev/null +++ b/scripts/package-windows.ps1 @@ -0,0 +1,5 @@ +Write-Output "$WINDOWN_PFX" +Move-Item -Path $WINDOWS_PFX -Destination fluffychat.pem +certutil -decode fluffychat.pem fluffychat.pfx + +flutter pub run msix:create -c fluffychat.pfx -p $WINDOWS_PFX_PASS --sign-msix true --install-certificate false diff --git a/scripts/prepare-windows.ps1 b/scripts/prepare-windows.ps1 index c73dfe71..97451b44 100644 --- a/scripts/prepare-windows.ps1 +++ b/scripts/prepare-windows.ps1 @@ -1,4 +1,4 @@ -choco install flutter -y +choco install flutter cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" refreshenv