From 6280a95b27620e79ead800ffc22c0fd806fc4584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:11:52 +0200 Subject: [PATCH] Windows prepare --- .github/workflows/unit_tests.yml | 7 ++-- ci/prepare/windows/disable-defender.ps1 | 5 +++ ci/prepare/windows/install-qt.ps1 | 45 +++++++++++++++++++++++++ ci/prepare/windows/prepare.ps1 | 4 +++ 4 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 ci/prepare/windows/disable-defender.ps1 create mode 100644 ci/prepare/windows/install-qt.ps1 create mode 100644 ci/prepare/windows/prepare.ps1 diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 962466a6..bf86a894 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -156,11 +156,8 @@ jobs: path: build key: ${{ runner.os }}-build-cache - - name: Windows Defender - run: ci/actions/windows/disable_windows_defender.ps1 - - - name: Fetch Deps - run: ci/actions/windows/install_deps.ps1 + - name: Prepare + run: ci/prepare/windows/prepare.ps1 - name: Build Tests run: ci/actions/windows/build.ps1 diff --git a/ci/prepare/windows/disable-defender.ps1 b/ci/prepare/windows/disable-defender.ps1 new file mode 100644 index 00000000..dcb1434c --- /dev/null +++ b/ci/prepare/windows/disable-defender.ps1 @@ -0,0 +1,5 @@ +$ErrorActionPreference = "Continue" + +Set-MpPreference -DisableArchiveScanning $true +Set-MpPreference -DisableRealtimeMonitoring $true +Set-MpPreference -DisableBehaviorMonitoring $true \ No newline at end of file diff --git a/ci/prepare/windows/install-qt.ps1 b/ci/prepare/windows/install-qt.ps1 new file mode 100644 index 00000000..5f4f2b33 --- /dev/null +++ b/ci/prepare/windows/install-qt.ps1 @@ -0,0 +1,45 @@ +$ErrorActionPreference = "Stop" + +# Download and extract Qt library. +# Original files can be found at: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/ + +# Define URLs, file names and their corresponding SHA1 hashes +$toDownload = @( + @{ + Url = 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z'; + FileName = 'qt5base.7z'; + SHA1 = 'e29464430a2225bce6ce96b4ed18eec3f8b944d6'; + }, + @{ + Url = 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qtwinextras-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z'; + FileName = 'qt5winextra.7z'; + SHA1 = '70da33b18ddeac4dd00ceed205f8110c426cea16'; + } +) + +$targetFolder = "C:\Qt" + +# Download and process files +foreach ($entry in $toDownload) { + $tempFile = Join-Path $env:TEMP $entry.FileName + + # Download file + Invoke-WebRequest -Uri $entry.Url -OutFile $tempFile + + # Calculate file hash + $fileHash = (Get-FileHash -Path $tempFile -Algorithm SHA1).Hash + + # Compare hashes + if ($fileHash -eq $entry.SHA1) { + Write-Host "Hashes match for $($entry.FileName)." + } else { + Write-Error "Hashes do not match for $($entry.FileName). Stopping script execution." + exit 1 + } + + # Decompress archive + 7z x $tempFile -o"$targetFolder" -aoa +} + +# Save install location for subsequent steps +"NANO_QT_DIR=C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5" >> $env:GITHUB_ENV \ No newline at end of file diff --git a/ci/prepare/windows/prepare.ps1 b/ci/prepare/windows/prepare.ps1 new file mode 100644 index 00000000..7ed8f7e7 --- /dev/null +++ b/ci/prepare/windows/prepare.ps1 @@ -0,0 +1,4 @@ +$ErrorActionPreference = "Stop" + +& "$PSScriptRoot\disable-defender.ps1" +& "$PSScriptRoot\install-qt.ps1" \ No newline at end of file