-
Notifications
You must be signed in to change notification settings - Fork 25
240 lines (206 loc) · 9.21 KB
/
windows-msvc.yml
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Windows MSVC Workflow
on:
# pull_request:
# branches: [ gcos4gnucobol-3.x ]
push:
# manual run in actions tab - for all branches
workflow_dispatch:
env:
GC_VERSION: GnuCOBOL 3.3-dev
FLEXBISON: https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip
MSBUILD: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe
VCVARS32: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat
VCVARS64: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
VCPKG_ROOT: C:\vcpkg
VCPKGS32: mpir:x86-windows pdcurses:x86-windows berkeleydb:x86-windows libxml2:x86-windows cjson:x86-windows
VCPKGS64: mpir:x64-windows pdcurses:x64-windows berkeleydb:x64-windows libxml2:x64-windows cjson:x64-windows
MSYS2_ROOT: C:\msys64
MSYSTEM: UCRT64
MSYSPKGS: autoconf
defaults:
run:
shell: cmd
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
arch:
- x86
- x64
target:
- Debug
- Release
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
- name: Set git user
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: pwsh
run: |
echo GITHUB_WORKSPACE=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV
If ("${{ matrix.arch }}" -eq "x86") {
echo VCVARS=$env:VCVARS32 >> $env:GITHUB_ENV
echo VCPKGS=$env:VCPKGS32 >> $env:GITHUB_ENV
echo ARCHDIR=Win32 >> $env:GITHUB_ENV
} else {
echo VCVARS=$env:VCVARS64 >> $env:GITHUB_ENV
echo VCPKGS=$env:VCPKGS64 >> $env:GITHUB_ENV
echo ARCHDIR=x64 >> $env:GITHUB_ENV
}
- name: Restore VCPKG cache
id: restore-vcpkg
uses: actions/cache/restore@v4
with:
key: cache-vcpkg-${{ matrix.arch }}-${{ matrix.target }}
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/packages
- name: Bootstrap VCPKG
if: steps.restore-vcpkg.outputs.cache-hit != 'true'
run: |
cd /d %VCPKG_ROOT%
vcpkg update
git pull
cmd /C .\bootstrap-vcpkg.bat -disableMetrics
- name: Integrate VCPKG
run: |
vcpkg integrate install
- name: Install VCPKG packages
if: steps.restore-vcpkg.outputs.cache-hit != 'true'
run: |
vcpkg install %VCPKGS%
- name: Save VCPKG cache
if: steps.restore-vcpkg.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: cache-vcpkg-${{ matrix.arch }}-${{ matrix.target }}
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/packages
- name: Restore WinFlexBison cache
uses: actions/cache/restore@v4
id: restore-flexbison
with:
key: cache-flexbison-${{ matrix.arch }}-${{ matrix.target }}
path: ${{ env.GITHUB_WORKSPACE }}/flexbison
- name: Install WinFlexBison
if: steps.restore-flexbison.outputs.cache-hit != 'true'
shell: pwsh
run: |
Invoke-WebRequest -Uri $env:FLEXBISON -OutFile flexbison.zip
Expand-Archive flexbison.zip -DestinationPath flexbison
- name: Save WinFlexBison cache
if: steps.restore-flexbison.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: cache-flexbison-${{ matrix.arch }}-${{ matrix.target }}
path: ${{ env.GITHUB_WORKSPACE }}/flexbison
- name: Configure GnuCOBOL
shell: pwsh
run: |
cd build_windows
Get-Content -Path 'config.h.in' | ForEach-Object { $_ `
-replace '(#define\s+CONFIGURED_ISAM)\s.+$', '$1 BDB' `
-replace '(#define\s+CONFIGURED_CURSES)\s.+$', '$1 PDCURSES' `
-replace '(#define\s+CONFIGURED_XML)\s.+$', '$1 XML2' `
-replace '(#define\s+CONFIGURED_JSON)\s.+$', '$1 CJSON_CJSON' `
-replace '"\(" PACKAGE_NAME "\) "', '"( GnuCOBOL ${{ matrix.target }} CI ) "' `
} | Set-Content -Path 'config.h'
& .\maketarstamp.ps1 > tarstamp.h
- name: Generate parser
run: |
cd build_windows
set PATH=%GITHUB_WORKSPACE%\flexbison;%PATH%
cmd /C .\makebisonflex.cmd <NUL
- name: Build GnuCOBOL
run: |
cd build_windows
set CL=/DCOB_MAIN_DIR=\"%GITHUB_WORKSPACE:\=\\%\"
"%MSBUILD%" .\vs2019\GnuCOBOL.sln /m /p:Platform=${{ matrix.arch }} /p:Configuration=${{ matrix.target }}
- name: Install MSYS2 packages
shell: C:\shells\msys2bash.cmd {0}
run: |
pacman --needed --noconfirm -S $MSYSPKGS
- name: Build testsuite
shell: C:\shells\msys2bash.cmd {0}
run: |
cd tests
echo at_testdir=\'tests\' > atconfig
echo abs_builddir=\'$(pwd)\' >> atconfig
echo at_srcdir=\'./\' >> atconfig
echo abs_srcdir=\'$(pwd)/\' >> atconfig
echo at_top_srcdir=\'../\' >> atconfig
echo abs_top_srcdir=\'$(pwd)/../\' >> atconfig
echo at_top_build_prefix=\'../\' >> atconfig
echo abs_top_builddir=\'$(pwd)/../\' >> atconfig
echo at_top_builddir=\$at_top_build_prefix >> atconfig
echo EXEEXT=\'.exe\' >> atconfig
echo AUTOTEST_PATH=\'tests\' >> atconfig
echo SHELL=\${CONFIG_SHELL-\'/bin/sh\'} >> atconfig
echo m4_define\([AT_PACKAGE_STRING], [$GC_VERSION]\) > package.m4
echo m4_define\([AT_PACKAGE_BUGREPORT], [[email protected]]\) >> package.m4
sed 's/x64\/Debug/${{ env.ARCHDIR }}\/${{ matrix.target }}/g' atlocal_win > atlocal
autom4te --lang=autotest -I ./testsuite.src ./testsuite.at -o ./testsuite
- name: Adjust testsuite
shell: C:\shells\msys2bash.cmd {0}
run: |
# sed -i '/AT_SETUP(\[runtime check: write to internal storage (1)\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_misc.at
sed -i '/run_misc/{N;/write to internal storage (1)/{N;N;N;N;s/traceon/traceon; echo "workflow:1" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite
# Skip two tests that behave differently (fail or hand) under MSVC Debug
# - System routine CBL_GC_HOSTED: fails because libcob is linked with the debug version
# of the C runtime while the generated module is linked with the release version
# - PROGRAM COLLATING SEQUENCE: fails because of a data loss in a cast, due
# to lack of specific handling of LOW/HIGH-VALUE for NATIONAL alphabets
# (see typeck.c:cb_validate_collating)
- name: Adjust testsuite for Debug target
if: ${{ matrix.target == 'Debug' }}
shell: C:\shells\msys2bash.cmd {0}
run: |
#sed -i '/AT_SETUP(\[System routine CBL_GC_HOSTED\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_extensions.at
#sed -i '/AT_SETUP(\[PROGRAM COLLATING SEQUENCE\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/syn_definition.at
sed -i '/run_extensions/{N;/System routine CBL_GC_HOSTED/{N;N;N;N;s/traceon/traceon; echo "workflow:2" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite
sed -i '/syn_definition/{N;/PROGRAM COLLATING SEQUENCE/{N;N;N;N;s/traceon/traceon; echo "workflow:3" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite
- name: Run testsuite
run: |
cd tests
set CL=/I "%VCPKG_ROOT%\installed\${{ matrix.arch }}-windows\include"
call "%VCVARS%"
set MSYS2_PATH_TYPE=inherit
C:\shells\msys2bash.cmd -c "./testsuite || ./testsuite --recheck --verbose"
- name: Upload testsuite-${{ matrix.arch }}-${{ matrix.target }}.log
uses: actions/upload-artifact@v4
if: ${{ ! cancelled() }} #-> always upload as build result documentation
with:
name: testsuite-${{ matrix.arch }}-${{ matrix.target }}.log
path: tests/testsuite.log
- name: Package GnuCOBOL
run: |
echo exporting dependencies
vcpkg.exe export %VCPKGS% --raw
move C:\vcpkg\vcpkg-export-* .\vcpkg-export
set "VCPKG_EXPORT_DIR=%CD%\vcpkg-export"
cd build_windows
rem set CL=/I "%VCPKG_ROOT%\installed\${{ matrix.arch }}-windows\include"
set CL=
rem call "%VCVARS%"
cmd /C .\makedist.cmd ${{ matrix.target }} <NUL
echo wrap up dependencies for separate download
7z.exe a -r -mx=9 dependencies-${{ matrix.arch }}.7z vcpkg-export
- name: Upload distribution
uses: actions/upload-artifact@v4
with:
name: GnuCOBOL_3.3-dev_${{ matrix.arch }}-${{ matrix.target }}
path: GnuCOBOL_*.7z
- name: Upload dependencies
uses: actions/upload-artifact@v4
with:
name: VCPKG ${{ matrix.arch }}-${{ matrix.target }} dependencies
path: dependencies-${{ matrix.arch }}.7z