Repository navigation
95 lines (86 loc) · 3.26 KB
/
Copy pathtest.yml
File metadata and controls
95 lines (86 loc) · 3.26 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
# SPDX-FileCopyrightText: Copyright 2026 Jetperch LLC
# SPDX-License-Identifier: Apache-2.0
name: Test
on:
push:
pull_request:
workflow_dispatch:
jobs:
reuse:
name: REUSE compliance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- run: python -m pip install "reuse[charset-normalizer]==6.2.0"
- run: python -m reuse lint
windows_sign:
name: windows_sign on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-11-arm]
env:
# Sign only on trusted refs, as callers do. Otherwise this tests the
# skip path.
SIGN: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) }}
steps:
- uses: actions/checkout@v6
- name: Build an unsigned executable
run: |
cmake -S test -B build
cmake --build build --config Release
Copy-Item build/Release/hello.exe build/Release/hello2.exe
New-Item -ItemType Directory -Force build/nested/deeper | Out-Null
Copy-Item build/Release/hello.exe build/nested/deeper/hello3.exe
# Call the script directly and catch the expected error: a failing
# step with continue-on-error would add an error annotation.
- name: Missing files fail by default
env:
WS_FILES: build/Release/does_not_exist.exe
WS_KEY_VAULT_URI: unused
WS_CLIENT_ID: unused
WS_TENANT_ID: unused
WS_CLIENT_SECRET: unused
WS_CERT_NAME: unused
WS_TIMESTAMP_URL: unused
WS_IF_NO_FILES_FOUND: error
run: |
try {
& ./windows_sign/windows_sign.ps1
} catch {
if ("$_" -notlike '*no files match*') { throw "unexpected error: $_" }
Write-Host "expected error: $_"
exit 0
}
throw 'expected an error for a pattern without files'
- name: Sign
id: sign
uses: ./windows_sign
with:
files: |
build/Release/*.exe
build/nested/**/*.exe
azure_key_vault_uri: ${{ env.SIGN == 'true' && secrets.AZURE_KEY_VAULT_URI || '' }}
azure_client_id: ${{ secrets.AZURE_CLIENT_ID }}
azure_tenant_id: ${{ secrets.AZURE_TENANT_ID }}
azure_client_secret: ${{ secrets.AZURE_CLIENT_SECRET }}
azure_cert_name: ${{ secrets.AZURE_CERT_NAME }}
- name: Check signatures
env:
SIGNED: ${{ steps.sign.outputs.signed }}
run: |
$expect = if ($env:SIGN -eq 'true') { 'Valid' } else { 'NotSigned' }
if (($env:SIGN -eq 'true') -ne ($env:SIGNED -eq 'true')) {
throw "signed output '$env:SIGNED' does not match SIGN '$env:SIGN'"
}
foreach ($f in 'build/Release/hello.exe', 'build/Release/hello2.exe', 'build/nested/deeper/hello3.exe') {
$status = (Get-AuthenticodeSignature $f).Status
Write-Host "$f : $status"
if ("$status" -ne $expect) { throw "expected $expect" }
}
& build/Release/hello.exe
if ($LASTEXITCODE) { throw 'hello.exe failed' }