Repository navigation
256 lines (218 loc) · 8.46 KB
/
Copy pathstrict-build-check.yml
File metadata and controls
256 lines (218 loc) · 8.46 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
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
# Exceptions.
# See https://edgcpp.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Configure and build the standard release and debug presets on GitHub-hosted
# runners. Linux GCC/Clang builds treat CPFE warnings as errors.
name: Strict Build Check
on:
push:
branches:
- main
# The nightly collect-changes job's commits only move Changes entries.
paths-ignore:
- '**/Changes'
- '**/pending_changes/**'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
windows-msvc-release:
name: Windows MSVC release
runs-on: windows-latest
timeout-minutes: 120
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Install Ninja
run: choco install ninja -y
- name: Read SoftFloat commit pin
id: softfloat-pin
shell: bash
run: |
echo "commit=$(tr -d '[:space:]' < dev_tools/docker/softfloat/SOFTFLOAT_COMMIT)" \
>> "${GITHUB_OUTPUT}"
- name: Cache SoftFloat
id: cache-softfloat
uses: actions/cache@v6
with:
path: softfloat
key: softfloat-msvc-win-${{ steps.softfloat-pin.outputs.commit }}
- name: Set up MSVC developer environment
uses: ilammy/msvc-dev-cmd@v1
- name: Build SoftFloat (MSVC)
if: steps.cache-softfloat.outputs.cache-hit != 'true'
shell: bash
run: |
set -euo pipefail
commit="${{ steps.softfloat-pin.outputs.commit }}"
mkdir softfloat-src
git -C softfloat-src init
git -C softfloat-src remote add origin \
https://github.com/ucb-bar/berkeley-softfloat-3.git
git -C softfloat-src fetch --depth 1 origin "${commit}"
git -C softfloat-src checkout FETCH_HEAD
# EDG Windows SoftFloat build: cl + lib (not MinGW). Emit MSVC
# platform bits inline; derive sources.rsp from upstream's
# Win32-SSE2-MinGW Makefile (8086-SSE / non-FAST_INT64).
build_dir=softfloat-src/build/Win-MSVC
mkdir -p "${build_dir}"
cat > "${build_dir}/platform.h" <<'EOF'
/*============================================================================
MSVC platform header for SoftFloat. Keep free of GCC-only opts
(opts-GCC.h, SOFTFLOAT_BUILTIN_CLZ, SOFTFLOAT_INTRINSIC_INT128).
=============================================================================*/
#define LITTLEENDIAN 1
#ifdef _MSC_VER
#define INLINE static __inline
#else
#define INLINE static inline
#endif
EOF
# Strip the leading spaces YAML left in the heredoc body.
sed -i 's/^ //' "${build_dir}/platform.h"
cat > "${build_dir}/build.bat" <<'EOF'
REM In place of a Makefile, use this batch file to create softfloat.lib
REM Source paths live in sources.rsp to avoid CreateProcess length limits.
set LIB=softfloat.lib
set SOFTFLOAT_OPTS=-DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32
set SPECIALIZE_TYPE=8086-SSE
set SOURCE=..\..\source
set S=%SOURCE%\
set P=%SOURCE%\%SPECIALIZE_TYPE%\
del *.obj %LIB% 2>nul
cl -nologo -c -O2 -I. -I%S% -I%P% -I%S%include %SOFTFLOAT_OPTS% @sources.rsp
if errorlevel 1 exit /b 1
lib -nologo /out:%LIB% *.obj
if errorlevel 1 exit /b 1
EOF
sed -i 's/^ //' "${build_dir}/build.bat"
python - <<'PY'
import re
from pathlib import Path
makefile = Path(
'softfloat-src/build/Win32-SSE2-MinGW/Makefile'
).read_text()
def section(name):
match = re.search(
rf'{name}\s*=\s*((?:.*\\\n)*.*)', makefile
)
return re.findall(r'(\w+)\$\(OBJ\)', match.group(1))
paths = (
[fr'..\..\source\{n}.c' for n in section('OBJS_PRIMITIVES')]
+ [
fr'..\..\source\8086-SSE\{n}.c'
for n in section('OBJS_SPECIALIZE')
]
+ [fr'..\..\source\{n}.c' for n in section('OBJS_OTHERS')]
)
Path('softfloat-src/build/Win-MSVC/sources.rsp').write_text(
'\r\n'.join(paths) + '\r\n'
)
PY
cmd.exe //C "cd softfloat-src\\build\\Win-MSVC && build.bat"
mkdir -p softfloat/include softfloat/lib
cp softfloat-src/source/include/softfloat.h \
softfloat-src/source/include/softfloat_types.h \
softfloat/include/
cp softfloat-src/build/Win-MSVC/softfloat.lib softfloat/lib/
- name: Configure windows-msvc-release
env:
EDG_SOFTFLOAT_INCLUDE_PATH: ${{ github.workspace }}/softfloat/include
EDG_SOFTFLOAT_LIB_PATH: ${{ github.workspace }}/softfloat/lib/softfloat.lib
run: cmake --preset windows-msvc-release
- name: Build windows-msvc-release
env:
EDG_SOFTFLOAT_INCLUDE_PATH: ${{ github.workspace }}/softfloat/include
EDG_SOFTFLOAT_LIB_PATH: ${{ github.workspace }}/softfloat/lib/softfloat.lib
run: cmake --build build/msvc-release
linux-gcc-release:
name: Linux GCC release
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:14b3948c2ce12cfa5472e5a6c468393d15426f3a67685cc35d830ea5db2acdf8
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-gcc-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-gcc-release
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-gcc-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/gcc-release
linux-gcc-debug:
name: Linux GCC debug
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:14b3948c2ce12cfa5472e5a6c468393d15426f3a67685cc35d830ea5db2acdf8
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-gcc-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-gcc-debug
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-gcc-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/gcc
linux-clang-release:
name: Linux Clang release
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:14b3948c2ce12cfa5472e5a6c468393d15426f3a67685cc35d830ea5db2acdf8
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-clang-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-clang-release
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-clang-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/clang-release
linux-clang-debug:
name: Linux Clang debug
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:14b3948c2ce12cfa5472e5a6c468393d15426f3a67685cc35d830ea5db2acdf8
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-clang-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-clang-debug
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-clang-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/clang