-
Notifications
You must be signed in to change notification settings - Fork 146
187 lines (142 loc) · 4.99 KB
/
test-visual-studio.yml
File metadata and controls
187 lines (142 loc) · 4.99 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: wolfBoot Visual Studio
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
jobs:
build:
name: Visual Studio Keytools Tests
runs-on: windows-latest
env:
CONFIG: Debug
PLATFORM: x64
ASYM: ecc256
HASH: sha256
steps:
# Adds MSBuild to PATH
- uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: true
- name: Fetch test target.h
shell: cmd
working-directory: .\
run: |
:: Ensure there's a target.h
echo Current directory:
echo %cd%
:: echo Copying tools\unit-tests\target.h to src\target.h
:: copy /Y tools\unit-tests\target.h src\target.h
echo Copying tools\unit-tests\target.h to include\target.h
copy /Y tools\unit-tests\target.h include\target.h
# Step 1 Build keygen, then run it
- name: Build KeygenTool keygen.exe
shell: cmd
working-directory: .\
run: |
echo Current directory:
echo %cd%
pushd tools\keytools\
msbuild wolfBootKeygenTool.vcxproj ^
/t:Rebuild ^
/m ^
/p:Configuration=%CONFIG% ^
/p:Platform=%PLATFORM% ^
/p:PreferredToolArchitecture=x64 ^
/v:m
popd
- name: Run KeygenTool keygen.exe
shell: cmd
working-directory: .\
run: |
:: Run keygen.exe
echo Current directory:
echo %cd%
.\tools\keytools\%PLATFORM%\%CONFIG%\keygen.exe --ecc256 -g wolfboot_signing_private_key.der
if errorlevel 1 (
echo keygen.exe failed with ERRORLEVEL %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
echo "wolfboot_signing_private_key.der file:"
dir wolfboot_signing_private_key.der /s
echo "keystore.c file:"
dir keystore.c /s
# Step 2 Build signing tool, then run it
- name: Build SignTool sign.exe
shell: cmd
working-directory: .\
run: |
pushd tools\keytools\
msbuild wolfBootSignTool.vcxproj ^
/t:Rebuild ^
/m ^
/p:Configuration=%CONFIG% ^
/p:Platform=%PLATFORM% ^
/p:PreferredToolArchitecture=x64 ^
/v:m
popd
- name: Create a file to sign
shell: cmd
working-directory: .\
run: |
:: Create a test.bin file
echo Creating a new test.bin
echo "Test" > test.bin
- name: Run SignTool sign.exe
shell: cmd
working-directory: .\
run: |
:: Run sign.exe
echo Current directory:
echo %cd%
echo Running .\tools\keytools\%PLATFORM%\%CONFIG%\sign.exe --%ASYM% --%HASH% test.bin wolfboot_signing_private_key.der 1
.\tools\keytools\%PLATFORM%\%CONFIG%\sign.exe --%ASYM% --%HASH% test.bin wolfboot_signing_private_key.der 1
if errorlevel 1 (
echo sign.exe failed with ERRORLEVEL %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
echo wolfboot_signing_private_key.der file:
dir wolfboot_signing_private_key.der /s
echo "keystore.c file:"
dir keystore.c /s
echo test.bin file:
dir test.bin /s
echo test_v1_signed.bin file:
dir test_v1_signed.bin /s
# Step 3 Build Test tool, then run it
- name: Build Library Test test-lib.exe
shell: cmd
working-directory: .\
run: |
pushd tools\keytools\
msbuild wolfBootTestLib.vcxproj ^
/t:Rebuild ^
/m ^
/p:Configuration=%CONFIG% ^
/p:Platform=%PLATFORM% ^
/p:PreferredToolArchitecture=x64 ^
/v:m
popd
- name: Run Library Test test-lib.exe
shell: cmd
working-directory: .\
run: |
:: Run sign.exe
echo Current directory:
echo %cd%
:: A missing target.h is a common build failure on GitHub.
:: See above where we copy one from [WOLFBOOT_ROOT]\tools\unit-tests\
:: echo Where is the target.h?
:: dir target.h /s
dir test_v1_signed.bin /s
echo Running .\tools\keytools\%PLATFORM%\%CONFIG%\test-lib.exe .\test_v1_signed.bin
if errorlevel 1 (
echo test-lib.exe failed with ERRORLEVEL %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
.\tools\keytools\%PLATFORM%\%CONFIG%\test-lib.exe .\test_v1_signed.bin
echo Done!