Repository navigation
164 lines (147 loc) · 6.18 KB
/
Copy pathbuild-windows.yml
File metadata and controls
164 lines (147 loc) · 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build Windows
# runs only when something in Windows/ (or this workflow) changes
on:
push:
branches: [ master, dev ]
paths:
- 'Windows/**'
- '!Windows/**.md'
- '.github/workflows/build-windows.yml'
pull_request:
branches: [ master, dev ]
paths:
- 'Windows/**'
- '!Windows/**.md'
- '.github/workflows/build-windows.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
permissions:
contents: read
actions: read
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install NSIS
run: |
choco install nsis -y
shell: pwsh
- name: Install NSIS EnVar plugin
run: |
$nsisPluginDir = "C:\Program Files (x86)\NSIS\Plugins\x86-unicode"
$url = "https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip"
$expectedHash = "E9AA92DE351345ED82795251D838F1AE9041BA35AF9D381A5780C7843B01F56A"
Invoke-WebRequest -Uri $url -OutFile "EnVar.zip" -UseBasicParsing
$actualHash = (Get-FileHash "EnVar.zip" -Algorithm SHA256).Hash
if ($actualHash -ne $expectedHash) {
Write-Error "EnVar.zip SHA256 mismatch! Expected: $expectedHash Got: $actualHash"
exit 1
}
Expand-Archive -Path "EnVar.zip" -DestinationPath "EnVar"
Copy-Item "EnVar\Plugins\x86-unicode\EnVar.dll" -Destination $nsisPluginDir -Force
Write-Host "EnVar plugin installed successfully"
shell: pwsh
- name: Download WinDivert
run: |
$url = "https://github.com/basil00/WinDivert/releases/download/v2.2.2/WinDivert-2.2.2-A.zip"
$expectedHash = "63CB41763BB4B20F600B6DE04E991A9C2BE73279E317D4D82F237B150C5F3F15"
Invoke-WebRequest -Uri $url -OutFile "WinDivert.zip" -UseBasicParsing
$actualHash = (Get-FileHash "WinDivert.zip" -Algorithm SHA256).Hash
if ($actualHash -ne $expectedHash) {
Write-Error "WinDivert.zip SHA256 mismatch! Expected: $expectedHash Got: $actualHash"
exit 1
}
Expand-Archive -Path "WinDivert.zip" -DestinationPath "C:\"
shell: pwsh
- name: Verify WinDivert installation
run: |
if (Test-Path "C:\WinDivert-2.2.2-A") {
Write-Host "WinDivert installed successfully"
Get-ChildItem "C:\WinDivert-2.2.2-A" -Recurse | Select-Object FullName
} else {
Write-Error "WinDivert installation failed"
exit 1
}
shell: pwsh
# Tests build from the real sources and never load the WinDivert driver or touch the network, so they run on
# a hosted runner. They run before the build so a failing change is reported first. See Windows\tests\.
- name: Run tests (engine, profiles, parsers, service, proxy protocols, CLI, static checks)
run: |
cd Windows
.\tests\run_tests.ps1 -SkipUi
shell: pwsh
# The GUI tests create real windows (the Proxy Rules window and the main window) and need a desktop session;
# they are a separate step so a runner without one is easy to tell apart from a real failure.
- name: Run GUI tests (Proxy Rules window, main window, dialogs)
run: |
cd Windows
.\tests\run_tests.ps1 -Only test_rules_ui,test_main_ui,test_dialogs_ui
shell: pwsh
- name: Upload test output on failure
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ProxyBridge-Test-Output-${{ github.sha }}
path: Windows/tests/out/*.txt
if-no-files-found: ignore
retention-days: 7
- name: Build project
run: |
cd Windows
.\compile.ps1 -NoSign
shell: pwsh
# The unit tests above use made-up data. This step runs the REAL engine and WinDivert driver (through the CLI) with a
# real SOCKS5 proxy (Nexus Proxy), a small real HTTP proxy and real requests to real servers, and checks that traffic
# goes where the rules say. It loads a kernel driver, so it only runs here on the disposable runner (the script
# refuses to run elsewhere). Best effort for now: it depends on the internet and on the hosted runner allowing the
# driver, so a failure is reported without failing the build. See Windows\tests\e2e\run_e2e.ps1.
- name: Real-traffic end-to-end tests (best effort)
continue-on-error: true
timeout-minutes: 25
run: |
cd Windows
.\tests\e2e\run_e2e.ps1 -PbDir .\output
shell: pwsh
# The same idea for the parts around the engine: it runs the real installer, the ProxyBridge Service, the app's own
# client code (Live Connections, pause, logging switches, rule changes, permissions), the real app and the real
# uninstaller. It installs ProxyBridge on the runner, so it runs after the step above. Best effort, same reasons.
# See Windows\tests\e2e\run_e2e_service.ps1.
- name: Real-traffic end-to-end tests, installer and service (best effort)
continue-on-error: true
timeout-minutes: 25
run: |
cd Windows
.\tests\e2e\run_e2e_service.ps1 -PbDir .\output
shell: pwsh
- name: Upload end-to-end logs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ProxyBridge-E2E-Logs-${{ github.sha }}
path: |
Windows/tests/e2e/out/*.log
Windows/tests/e2e/out/*.err
Windows/tests/e2e/out/*.out
Windows/tests/e2e/out/*.pbprofile
Windows/tests/e2e/out_service/*.log
Windows/tests/e2e/out_service/*.err
Windows/tests/e2e/out_service/*.out
if-no-files-found: ignore
retention-days: 7
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ProxyBridge-Build-${{ github.sha }}
path: Windows/output/
retention-days: 30
- name: List output files
run: |
Write-Host "`nBuild artifacts:"
Get-ChildItem Windows/output -Recurse | ForEach-Object {
$size = [math]::Round($_.Length/1MB, 2)
Write-Host " $($_.Name) - $size MB"
}
shell: pwsh