mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
ci: report safe Windows build failure locations
This commit is contained in:
3 files changed
+37
-1
No files matched your search
@@ -139,7 +139,10 @@ jobs:
|
|||||||
-WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') `
|
-WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') `
|
||||||
-MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') `
|
-MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') `
|
||||||
-OutputDirectory "$env:GITHUB_WORKSPACE/artifacts" *> $log
|
-OutputDirectory "$env:GITHUB_WORKSPACE/artifacts" *> $log
|
||||||
} catch { throw 'Windows compilation or packaging failed; private diagnostics remain on the runner.' }
|
} catch {
|
||||||
|
python ./.ci/scripts/private-ci-diagnostics.py compile $log
|
||||||
|
throw 'Windows compilation or packaging failed; private diagnostics remain on the runner.'
|
||||||
|
}
|
||||||
Write-Host 'Windows compilation and packaging passed.'
|
Write-Host 'Windows compilation and packaging passed.'
|
||||||
- name: Sign and verify update payload
|
- name: Sign and verify update payload
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|||||||
@@ -8,6 +8,18 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def report_compile(output):
|
def report_compile(output):
|
||||||
|
output = re.sub(r'\x1b\[[0-9;]*[A-Za-z]', '', output)
|
||||||
|
stages = re.findall(r'^GP_WINDOWS_BUILD_STAGE=(core|gui|bundle|installer)\r?$', output, re.MULTILINE)
|
||||||
|
if stages:
|
||||||
|
print(f'::error::Windows build stage: {stages[-1]}.')
|
||||||
|
locations = re.findall(r'(?:-->\s+|panicked at )([^\r\n]+?):([0-9]+):([0-9]+)', output)
|
||||||
|
for path, line, column in sorted(set(locations)):
|
||||||
|
path = path.replace('\\', '/')
|
||||||
|
for prefix in ('/source/gpgui/', '/source/gp/'):
|
||||||
|
if prefix in path:
|
||||||
|
path = path.split(prefix, 1)[1]
|
||||||
|
fingerprint = hashlib.sha256(path.encode()).hexdigest()
|
||||||
|
print(f'::error::Rust source location fingerprint: {fingerprint} {line}:{column}')
|
||||||
codes = sorted(set(re.findall(r'error\[E[0-9]{4}\]', output)))
|
codes = sorted(set(re.findall(r'error\[E[0-9]{4}\]', output)))
|
||||||
if codes:
|
if codes:
|
||||||
print(f'::error::Rust diagnostic codes: {" ".join(codes)}.')
|
print(f'::error::Rust diagnostic codes: {" ".join(codes)}.')
|
||||||
@@ -17,6 +29,10 @@ def report_compile(output):
|
|||||||
'compiler or linker killed by SIGKILL'),
|
'compiler or linker killed by SIGKILL'),
|
||||||
(r'undefined reference to|undefined symbol:', 'unresolved linker symbols'),
|
(r'undefined reference to|undefined symbol:', 'unresolved linker symbols'),
|
||||||
('proc macro panicked', 'procedural macro failed'),
|
('proc macro panicked', 'procedural macro failed'),
|
||||||
|
(r'Review runtime license notices for|Required runtime notice is missing',
|
||||||
|
'runtime library notices require review'),
|
||||||
|
('Unresolved Windows runtime dependency:', 'Windows runtime dependency is missing'),
|
||||||
|
(r'out of memory|paging file is too small|os error 1455', 'memory exhausted'),
|
||||||
]
|
]
|
||||||
for pattern, description in categories:
|
for pattern, description in categories:
|
||||||
if re.search(pattern, output):
|
if re.search(pattern, output):
|
||||||
|
|||||||
@@ -274,6 +274,23 @@ class PrivateTestStageTests(unittest.TestCase):
|
|||||||
self.assertIn(expected, result.stdout)
|
self.assertIn(expected, result.stdout)
|
||||||
self.assertNotRegex(result.stdout, r'(?m)^Rust tests: started')
|
self.assertNotRegex(result.stdout, r'(?m)^Rust tests: started')
|
||||||
|
|
||||||
|
def test_compile_diagnostics_hash_source_locations_and_allowlist_windows_stage(self):
|
||||||
|
with tempfile.TemporaryDirectory() as temporary:
|
||||||
|
log = Path(temporary) / 'private.log'
|
||||||
|
log.write_text('GP_WINDOWS_BUILD_STAGE=gui\n'
|
||||||
|
'error[E0433]: PRIVATE_ERROR_MESSAGE\n'
|
||||||
|
' --> D:/a/repo/source/gpgui/crates/private.rs:42:9\n'
|
||||||
|
'PRIVATE_SOURCE_AND_CREDENTIALS\n')
|
||||||
|
result = subprocess.run([sys.executable, str(ROOT / 'scripts/private-ci-diagnostics.py'),
|
||||||
|
'compile', str(log)], capture_output=True, text=True)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
digest = hashlib.sha256(b'crates/private.rs').hexdigest()
|
||||||
|
self.assertEqual(result.stdout,
|
||||||
|
'::error::Windows build stage: gui.\n'
|
||||||
|
f'::error::Rust source location fingerprint: {digest} 42:9\n'
|
||||||
|
'::error::Rust diagnostic codes: error[E0433].\n')
|
||||||
|
self.assertEqual(result.stderr, '')
|
||||||
|
|
||||||
def test_test_diagnostics_hash_names_without_exposing_private_details(self):
|
def test_test_diagnostics_hash_names_without_exposing_private_details(self):
|
||||||
with tempfile.TemporaryDirectory() as temporary:
|
with tempfile.TemporaryDirectory() as temporary:
|
||||||
log = Path(temporary) / 'private.log'
|
log = Path(temporary) / 'private.log'
|
||||||
|
|||||||
Reference in new issue
Block a user