Skip to content

Commit

Permalink
Migrate to .NET 6 and change installer to Inno Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
eaproton committed Feb 28, 2023
1 parent 873378a commit 99ff46a
Show file tree
Hide file tree
Showing 604 changed files with 28,532 additions and 15,742 deletions.
119 changes: 28 additions & 91 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ variables:
PUBLIC_REPO_URL: [email protected]:ProtonVPN/win-app.git
SCREENSHOT_PATH: src/bin/TestFailureData/
TEST_REPORT_PATH: results/
PROJECT_ID: "1"
MILESTONE: "Automation"
PROJECT_ID: "13"
MILESTONE: "Windows"

stages:
- release
- bot # comes from translations/generator job
- build
- test
- sign
- build-installer
- internal-beta
- publish-to-slack
Expand All @@ -34,42 +33,27 @@ stages:
- test-cleanup
- mirror

sign:
stage: sign
tags:
- windows
script:
- echo "Signing files..."
- python ci\main.py sign
artifacts:
expire_in: 1 day
paths:
- src/bin/
only:
- master
- /^release.*$/
- develop

build-release:
stage: build
tags:
- windows
script:
- echo "Restoring NuGet Packages..."
- 'c:\nuget\nuget.exe restore ProtonVpn.sln'
- MSBuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "src\\ProtonVPN.MarkupValidator\\ProtonVPN.MarkupValidator.csproj"
- echo "Building native dependencies..."
- 'c:\nuget\nuget.exe restore ProtonVPN.InstallActions.sln'
- cmd.exe /c BuildDependencies.bat
- dotnet publish src\ProtonVPN.MarkupValidator\ProtonVPN.MarkupValidator.csproj --arch x64 -c Release --no-self-contained -o src\bin
- echo "Downloading translations from crowdin..."
- python ci\main.py lint-languages
- python ci\main.py add-commit-hash $env:CI_COMMIT_SHORT_SHA
- python ci\main.py defaultConfig
- echo "Building release..."
- MSBuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "ProtonVpn.sln"
- echo "Publishing release..."
- dotnet publish ProtonVpn.sln --arch x64 -c Release --no-self-contained --verbosity q -o src\bin
- msbuild src\ProtonVPN.NativeHost\NativeHost.vcxproj /p:Configuration=Release /p:Platform=x64
artifacts:
expire_in: 1 day
paths:
- src/bin/
- src/bin
- src/ProtonVPN.NativeHost/bin
only:
- master
- /^release.*$/
Expand All @@ -81,22 +65,22 @@ build-debug:
tags:
- windows
script:
- echo "Restoring NuGet Packages..."
- 'c:\nuget\nuget.exe restore ProtonVpn.sln'
- MSBuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "src\\ProtonVPN.MarkupValidator\\ProtonVPN.MarkupValidator.csproj"
- echo "Building native dependencies..."
- 'c:\nuget\nuget.exe restore ProtonVPN.InstallActions.sln'
- cmd.exe /c BuildDependencies.bat
- dotnet publish src\ProtonVPN.MarkupValidator\ProtonVPN.MarkupValidator.csproj --arch x64 -c Release --no-self-contained -o src\bin
- echo "Downloading translations from crowdin..."
- python ci\main.py lint-languages
- python ci\main.py add-commit-hash $env:CI_COMMIT_SHORT_SHA
- python ci\main.py defaultConfig
- echo "Building debug..."
- MSBuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Debug /verbosity:quiet "ProtonVpn.sln"
- echo "Publishing debug..."
- dotnet publish ProtonVpn.sln --arch x64 -c Debug --no-self-contained --verbosity q -o src\bin
- msbuild src\ProtonVPN.NativeHost\NativeHost.vcxproj /p:Configuration=Release /p:Platform=x64
artifacts:
expire_in: 1 day
paths:
- src/bin/
- src/bin
- src/ProtonVPN.NativeHost/bin
except:
- master
- /^release.*$/
Expand All @@ -108,10 +92,9 @@ tests:
tags:
- windows
script:
- echo "Running tests..."
- 'c:\nuget\nuget.exe restore ProtonVpn.sln'
- MSBuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Debug /verbosity:quiet "ProtonVpn.sln"
- coverlet src\bin --target "vstest.console.exe" --targetargs "src/bin/ProtonVPN*Tests*.dll /TestCaseFilter:TestCategory!=UI&TestCategory!=Connection /Platform:x64" --format cobertura --output .\coverage-reports --exclude "[*.Tests*]*" --exclude "[ProtonVPN.MarkupValidator]*" --exclude "[TestTools*]*" --exclude "[TapInstaller]*" --exclude "[*.Installers]*"
- dotnet restore ProtonVpn.sln
- dotnet build ProtonVpn.sln
- coverlet src\bin --target "dotnet" --targetargs "test ProtonVpn.sln -l ""console;verbosity=normal"" --filter ""TestCategory!=UI&TestCategory!=Connection"" --no-restore --no-build" --format cobertura --output .\coverage-reports --exclude "[*.Tests*]*" --exclude "[ProtonVPN.MarkupValidator]*" --exclude "[TestTools*]*" --exclude "[*.Installers]*"
- powershell -Command "(gc coverage-reports.cobertura.xml) -replace '\\', '/' | Out-File -encoding UTF8 cobertura.xml"
- ReportGenerator.exe "-reports:cobertura.xml" "-targetdir:.\code-coverage-report-html"
artifacts:
Expand All @@ -126,15 +109,11 @@ build-installer-for-release:
tags:
- windows
script:
- python ci\main.py tap-installer
- python ci\main.py tun-installer
- python ci\main.py update-gh-list
- python ci\main.py app-installer $env:CI_COMMIT_SHORT_SHA
artifacts:
paths:
- Setup/ProtonVPN-SetupFiles/
- Setup/ProtonVPNTun-SetupFiles/
- Setup/ProtonVPNTap-SetupFiles/
- Setup/Installers/
expire_in: 4 weeks
only:
- master
Expand All @@ -156,13 +135,11 @@ build-installer-for-debug:
tags:
- windows
script:
- python ci\main.py tap-installer
- python ci\main.py tun-installer
- python ci\main.py update-gh-list
- python ci\main.py app-installer $env:CI_COMMIT_SHORT_SHA
artifacts:
paths:
- Setup/ProtonVPN-SetupFiles/
- Setup/Installers/
expire_in: 4 weeks
except:
- master
Expand All @@ -181,19 +158,21 @@ testmo-setup:
SOURCE: "Release"
- when: always
variables:
SOURCE: "Automation"
SOURCE: "Windows"
NAME: "$CI_JOB_STARTED_AT UTC"
TAGS: "$CI_COMMIT_REF_SLUG"

ui-test:
stage: ui-test
tags:
- ui_tests
- ino-setup
script:
- powershell -File ci\uninstall-app.ps1
- powershell -File ci\install-the-app.ps1
- VSTest.Console.exe src\bin\ProtonVPN.UI.Tests.dll /TestCaseFilter:"Category=UI" /Settings:ci/TestRun/test-run-settings.xml
- powershell -File ci\uninstall-app.ps1
- ci\uninstall-app.ps1
- ci\install-the-app.ps1
- dotnet build src/Tests/ProtonVPN.UI.Tests/ProtonVPN.UI.Tests.csproj --arch x64 -o src/bin
- dotnet publish src\Tests\TestTools.ProfileCleaner\TestTools.ProfileCleaner.csproj --arch x64 -c Release --self-contained --verbosity q -o src\bin
- VSTest.Console.exe src\bin\ProtonVPN.UI.Tests.dll /Settings:ci/TestRun/test-run-settings.xml
- ci\uninstall-app.ps1
after_script:
- powershell.exe ./ci/TestRun/converter-nunit-junit.ps1
except:
Expand All @@ -207,55 +186,13 @@ ui-test:
- $SCREENSHOT_PATH
- "results/*"
expire_in: 1 weeks

connection-tests:
stage: ui-test
tags:
- connection_tests
script:
- powershell -File ci\uninstall-app.ps1
- powershell -File ci\install-the-app.ps1
- VSTest.Console.exe src\bin\ProtonVPN.UI.Tests.dll /TestCaseFilter:"Category=Connection" /Settings:ci/TestRun/test-run-settings.xml
- powershell -File ci\uninstall-app.ps1
after_script:
- powershell.exe ./ci/TestRun/converter-nunit-junit.ps1
except:
- /^debug.*$/
- release/9.9.9
- master
artifacts:
when: always
name: "result-connection"
paths:
- $SCREENSHOT_PATH
- "results/*"
expire_in: 1 weeks

testmo-upload:
allow_failure: true
stage: test-upload
variables:
RESULT_FOLDER: "results/*.xml"

win-11-tests:
stage: ui-test
when: manual
tags:
- win11
script:
- powershell -File ci\uninstall-app.ps1
- powershell -File ci\install-the-app.ps1
- VSTest.Console.exe src\bin\ProtonVPN.UI.Tests.dll /TestCaseFilter:"Category=Smoke"
except:
- /^debug.*$/
- release/9.9.9
- master
artifacts:
when: on_failure
paths:
- $SCREENSHOT_PATH
expire_in: 2 weeks

mirror:
stage: mirror
tags:
Expand Down
2 changes: 1 addition & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This creates TAP setup file "ProtonVPNTap.exe" in "Setup\ProtonVPNTap-SetupFiles
folder. Otherwise, keep the previously built file. The code signing USB key must be
provided during build.
- Build the "Setup\ProtonVPN.aip" project using Advanced Installer. This creates
Proton VPN setup file "ProtonVPN_win_x.x.x.exe" in "Setup\ProtonVPN-SetupFiles" folder,
Proton VPN setup file "ProtonVPN_win_x.x.x.exe" in "Setup\Installers" folder,
where "x.x.x" is the application version number. The code signing USB key must be
provided during build.

Expand Down
36 changes: 7 additions & 29 deletions BuildDependencies.bat
Original file line number Diff line number Diff line change
@@ -1,45 +1,23 @@
set outputDirX86=..\bin\x86\
set outputDirX64=..\bin\x64\
set outputDir=..\bin\Resources\
set platformToolset=v143
set GOARCH=amd64

::ProtonVPN.IpFilter.dll (x86)
msbuild src\ProtonVPN.IpFilterLib\ProtonVPN.IpFilterLib.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=Win32 /p:Configuration=Release /p:OutDir=%outputDirX86%
msbuild src\ProtonVPN.IpFilter\ProtonVPN.IpFilter.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=Win32 /p:Configuration=Release /p:OutDir=%outputDirX86%

::ProtonVPN.IpFilter.dll (x64)
msbuild src\ProtonVPN.IpFilterLib\ProtonVPN.IpFilterLib.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=x64 /p:Configuration=Release /p:OutDir=%outputDirX64%
msbuild src\ProtonVPN.IpFilter\ProtonVPN.IpFilter.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=x64 /p:Configuration=Release /p:OutDir=%outputDirX64%

::ProtonVPN.NetworkUtil.dll (x86)
msbuild src\ProtonVPN.NetworkUtil\ProtonVPN.NetworkUtil.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=Win32 /p:Configuration=Release /p:OutDir=%outputDirX86%

::ProtonVPN.NetworkUtil.dll (x64)
msbuild src\ProtonVPN.NetworkUtil\ProtonVPN.NetworkUtil.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=x64 /p:Configuration=Release /p:OutDir=%outputDirX64%

::ProtonVPN.InstallActions.dll (x86)
msbuild src\ProtonVPN.IpFilter\ProtonVPN.IpFilter.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=x64 /p:Configuration=Release /p:OutDir=%outputDir%
msbuild src\ProtonVPN.NetworkUtil\ProtonVPN.NetworkUtil.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=x64 /p:Configuration=Release /p:OutDir=%outputDir%
msbuild src\ProtonVPN.InstallActions\ProtonVPN.InstallActions.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=Win32 /p:Configuration=Release
msbuild src\ProtonVPN.InstallActions\ProtonVPN.InstallActions.vcxproj /p:PlatformToolset=%platformToolset% /p:Platform=x64 /p:Configuration=Release

::GoSrp.dll
pushd %~dp0\src\srp\windows\cshared
set fn=GoSrp
set gn=main.go
set CGO_ENABLED=1

set GOARCH=386
go build -buildmode=c-shared -v -ldflags="-s -w" -o ..\..\..\bin\x86\%fn%.dll %gn%

set GOARCH=amd64
go build -buildmode=c-shared -v -ldflags="-s -w" -o ..\..\..\bin\x64\%fn%.dll %gn%
go build -buildmode=c-shared -v -ldflags="-s -w" -o ..\..\..\bin\Resources\%fn%.dll %gn%

::LocalAgent.dll
pushd %~dp0\src\ProtonVPN.LocalAgent\localAgentWin
set GOOS=windows
set GO111MODULE=off
set CGO_CFLAGS=-O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWINVER=0x0601
set CC=x86_64-w64-mingw32-gcc

set GOARCH=386
go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o "..\..\bin\Resources\32-bit\LocalAgent.dll" || exit /b 1

set GOARCH=amd64
go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o "..\..\bin\Resources\64-bit\LocalAgent.dll" || exit /b 1
go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o "..\..\bin\Resources\LocalAgent.dll" || exit /b 1
14 changes: 10 additions & 4 deletions ProtonVPN.InstallActions.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31911.196
# Visual Studio Version 17
VisualStudioVersion = 17.4.33103.184
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProtonVPN.InstallActions", "src\ProtonVPN.InstallActions\ProtonVPN.InstallActions.vcxproj", "{BBCBB464-BDCB-49CD-830F-965D07CE1446}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Debug|x64.ActiveCfg = Debug|x64
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Debug|x64.Build.0 = Debug|x64
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Debug|x86.ActiveCfg = Debug|Win32
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Debug|x86.Build.0 = Debug|Win32
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Release|x86.ActiveCfg = Release|Win32
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Release|x86.Build.0 = Release|Win32
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Release|x64.ActiveCfg = Release|x64
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Release|x64.Build.0 = Release|x64
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Release|x86.ActiveCfg = Release|x64
{BBCBB464-BDCB-49CD-830F-965D07CE1446}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions ProtonVPN.InstallActions.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Callout/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=wintun/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Loading

0 comments on commit 99ff46a

Please sign in to comment.