forked from rebolsource/r3
-
Notifications
You must be signed in to change notification settings - Fork 27
266 lines (216 loc) · 8.5 KB
/
windows-mingw-build.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#
# File: %windows-mingw-build.yml
#
#=============================================================================#
#
# This uses a Linux container and the "Minimalist GNU for Windows" to cross
# compile executables for Windows.
#
# The main reason this exists in addition to the MSVC-based non-cross-compiling
# process is because the original CI process on Travis did not have containers
# running windows. So this was the only way to build Windows executables.
#
# Keeping it working has several advantages:
#
# * It tests compilation in a somewhat "alien" environment, which increases the
# likelihood that the code is being kept in shape such that it could be
# compiled for other unusual platforms.
#
# * If the cross-compilation with MinGW works, then odds are pretty good that
# the non-cross-compiling MinGW that runs on native Windows will work too.
#
# * Some open source libraries do not have configuration environments tailored
# to the MSVC toolchain. It may come up that someone wants to use such a
# library on Windows, and it can be easier to do that with MinGW than to
# try and figure out how to get it working with the MSVC toolset.
#
# There are limits to how much work is worth it to keep this working, but it
# has been historically not much cost so it's allowed to stay.
#
#====# PLEASE READ THE README #===============================================#
#
# Whenever this file says "See README", that is referring to the notes in the
# %.github/workflows/README.md file. If something appears in multiple GitHub
# Workflow files, it's best to document it there instead of repeating it:
#
# https://github.com/metaeducation/ren-c/blob/master/.github/workflows/README.md
#
name: Windows MinGW
# See README: When To Trigger Builds
#
on:
push:
branches: [
# master,
mingw, # pushing to mingw won't build other workflows, use to debug
windows # pushing to windows builds this and msvc, use to debug
]
pull_request:
branches: [
master
]
workflow_dispatch: # Allows running this workflow manually from Actions tab
# Standardize to use bash on all platforms.
#
# See README: Using The Strict Erroring Bash Shell
#
defaults:
run:
shell: bash
# Each "Job" runs in its own VM, and a workflow run is made up of one or more
# jobs that can run sequentially or in parallel.
#
# See README: Jobs
#
jobs:
windows-mingw-build: # Name of this workflow's only job
# https://github.com/actions/virtual-environments#available-environments
#
runs-on: ubuntu-latest
# See README: Build Matrix
#
# NOTE: The older MinGW used here is missing imports required by libuv.
#
# https://github.com/libuv/libuv/issues/3178
#
# These are fixed in a modern MinGW, however running on an older MinGW
# is more interesting to keep on top of these glitches and how many of
# them there are. (If the core can't build even without libuv on an older
# MinGW it's more worth knowing about than that the extensions can build
# on a newer MinGW.)
#
strategy:
matrix:
include:
- os-id: 0.3.40 # 64-bit Target (built on this 64-bit platform)
config-file: mingw-x64.r
standard: c++17
debug: none
extensions: "Network - Filesystem - Process - Locale - DNS -"
variation: "" # ^-- Note
- os-id: 0.3.1 # 32-bit Target (built on this 64-bit platform)
config-file: mingw-x86.r
standard: c99
debug: normal
extensions: "Network - Filesystem - Process - Locale - DNS -"
variation: "" # ^-- Note
# See README: Environment Variables
#
env:
AWS_S3_BUCKET_NAME: metaeducation
# See README: Minimize GitHub-Specific Syntax
#
OS_ID: ${{ matrix.os-id }}
CONFIG_FILE: ${{ matrix.config-file }}
STANDARD: ${{ matrix.standard }}
DEBUG: ${{ matrix.debug }}
EXTENSIONS: ${{ matrix.extensions }}
VARIATION: ${{ matrix.variation }}
# Steps are a sequence of tasks that will be executed within a single VM
# as part of the job.
#
# See README: Steps
#
steps: # (no indentatation needed below; so indent the minimum!)
#====# CHECKOUT STEPS #=====================================================#
# https://github.com/actions/checkout
#
# See README: Checkout Action
#
- uses: actions/checkout@v3 # See README: Trusted Actions
# The full commit is passed to make to build into the binary, and the
# abbreviated commit is used to name the executable.
#
# See README: Portably Capturing Git Hashes
#
- name: Grab Git Hash and Short Hash Into Environment Variables
run: |
git_commit="$(git show --format="%H" --no-patch)"
git_commit_short="$(git show --format="%h" --no-patch)"
echo "GIT_COMMIT=$git_commit" >> $GITHUB_ENV
echo "GIT_COMMIT_SHORT=$git_commit_short" >> $GITHUB_ENV
#====# TOOLCHAIN INSTALLATION STEPS #=======================================#
# !!! Ideally this would use the same step that clients can use to build
# the system with `make.sh`. Unfortunately, something about the GitHub
# Ubuntus do not like the old bootstrap executable. Make sure the
# ordinary path works, but for the moment patch over it just to get
# to a point where the action works.
#
- name: Fetch R3 To Use For "Prep" Build Steps as $R3MAKE
run: |
repo_dir=$(pwd)/
source tools/bash/fetch-prebuilt.sh
r3make=$(fetch_prebuilt)
echo "R3MAKE is set to $r3make"
echo "But that executable won't run on GitHub for some reason"
# "$r3make" --do "print {TESTING 1 2 3}" # NOT WORKING, dunno why
cd prebuilt
wget http://hostilefork.com/media/shared/github/r3-linux-8994d23-patched
chmod +x r3-linux-8994d23-patched
r3make=$(pwd)/r3-linux-8994d23-patched
echo "So now R3MAKE is $r3make"
echo "R3MAKE=$r3make" >> $GITHUB_ENV # pass to next step
- name: Stop the build early if the R3MAKE is no good
run: |
"$R3MAKE" --do "print {R3MAKE is Working} quit"
# MinGW appens to include the libraries for ODBC, since those are present
# by default for Windows.
#
- name: Get MinGW
run: |
sudo apt install binutils-mingw-w64-i686
sudo apt install gcc-mingw-w64-i686
sudo apt install mingw-w64
# Show a little bit of sanity check information.
#
- name: Output System Information
run: |
echo "GCC version check:"
gcc -v # not the same as MinGW
#====# BUILD STEPS #========================================================#
# See README: {Braces} For %make.r String Parameters
#
- name: Use Rebmake to Generate a makefile
run: |
mkdir build
cd build
"$R3MAKE" ../make.r \
config="../configs/$CONFIG_FILE" \
target=makefile \
standard=$STANDARD \
os_id=$OS_ID \
debug=$DEBUG \
git_commit="{$GIT_COMMIT}" \
rigorous=no \
static=no \
extensions="$EXTENSIONS"
- name: Create Folders For Build Products (Compiler Won't Create Them)
run: |
cd build
make folders
- name: Prep the Build By Making Various Auto-Generated .h and .c Files
run: |
cd build
make prep
# https://github.com/actions/upload-artifact
#
- name: Optional Download of Prep Files Before They Can Cause Build Failure
if: false # Change this to true to download a file
uses: actions/upload-artifact@v2 # See README: Trusted Actions
with:
name: tmp-internals.h
path: build/prep/include/tmp-internals.h
- name: Compile and Link the C Files to into R3BUILT
run: |
cd build
make -j 2 # Linux GitHub Runners have 2 cores, use 2 jobs
#====# NO TEST OR DEPLOYMENT #==============================================#
# We currently don't deploy or test the executables, trusting the MSVC
# build which is already on a Windows container to do it. Also, this
# lacks filesystem and network functions due to missing libuv dependencies.
#
# It would be possible to create another job specific to the testing, that
# would run in a Windows container...but really, this is already a bit of
# a stretch as being important given how many higher priority builds are
# being made. If someone has a good reason to be dependent upon MinGW
# then they can worry about taking this further.