-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
209 lines (195 loc) · 8.17 KB
/
win.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
name: Windows CI
on:
push:
pull_request:
branches:
# Branches from forks have the form 'user:branch-name' so we only run
# this job on pull_request events for branches that look like fork
# branches. Without this we would end up running this job twice for non
# forked PRs, once for the push and then once for opening the PR.
- "**:**"
jobs:
linux-job:
runs-on: ubuntu-latest
container: crystallang/crystal:1.0.0-build
steps:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Build C extensions
run: |
make deps
- name: Cross-compile Crystal
run: |
LLVM_TARGETS=X86 bin/crystal build --cross-compile --target x86_64-pc-windows-msvc src/compiler/crystal.cr -Dwithout_playground
- name: Upload Crystal object file
uses: actions/upload-artifact@v2
with:
name: objs
path: crystal.obj
windows-job:
needs: linux-job
runs-on: windows-latest
steps:
- name: Disable CRLF line ending substitution
run: |
git config --global core.autocrlf false
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@ed94116c4d30d2091601b81f339a2eaa1c2ba0a6
- name: Download Crystal source
uses: actions/checkout@v2
- name: Cache libraries
id: cache-libs
uses: actions/cache@v2
with:
path: libs
key: win-libs-${{ hashFiles('.github/workflows/win.yml') }}
- name: Download libgc
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: ivmai/bdwgc
ref: 2fd48a92b8bff3afb64b3528ad78b63f033f0436 # master @ 2020-02-13
path: bdwgc
- name: Download libatomic_ops
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: ivmai/libatomic_ops
ref: v7.6.10
path: bdwgc/libatomic_ops
- name: Build libgc
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./bdwgc
run: |
cmake . -DBUILD_SHARED_LIBS=OFF -Denable_large_config=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libpcre
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
iwr https://ftp.pcre.org/pub/pcre/pcre-8.43.zip -OutFile pcre.zip
7z x pcre.zip
mv pcre-* pcre
- name: Build libpcre
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./pcre
run: |
cmake . -DBUILD_SHARED_LIBS=OFF -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DPCRE_SUPPORT_JIT=ON -DPCRE_STATIC_RUNTIME=ON -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download zlib
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
iwr https://github.com/madler/zlib/archive/v1.2.11.zip -OutFile zlib.zip
7z x zlib.zip
mv zlib-* zlib
- name: Build zlib
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./zlib
run: |
cmake . -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libyaml
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
iwr https://github.com/yaml/libyaml/archive/0.2.4.zip -OutFile libyaml.zip
7z x libyaml.zip
mv libyaml-* libyaml
- name: Build libyaml
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./libyaml
run: |
cmake . -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libxml2
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: GNOME/libxml2
ref: a230b728f1289dd24c1666856ac4fb55579c6dfb # master @ 2020-05-04
path: libxml2
- name: Build libxml2
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./libxml2
run: |
cmake . -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_HTTP=OFF -DLIBXML2_WITH_FTP=OFF -DLIBXML2_WITH_TESTS=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Gather libraries
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
mkdir libs
mv pcre/Release/pcre.lib libs/
mv bdwgc/Release/gc.lib libs/
mv zlib/Release/zlibstatic.lib libs/z.lib
mv libyaml/Release/yaml.lib libs/
mv libxml2/Release/libxml2s.lib libs/xml2.lib
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: llvm
key: llvm-libs-10.0.0
- name: Download LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
iwr https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-10.0.0.src.tar.xz -OutFile llvm.tar.xz
7z x llvm.tar.xz
7z x llvm.tar
mv llvm-* llvm-src
- name: Patch LLVM for VS 2019 16.7.0
working-directory: ./llvm-src
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
sed -i 's/#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE/#if 0/' include/llvm/Support/type_traits.h
- name: Build LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
working-directory: ./llvm-src
run: |
cmake . -Thost=x64 -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_USE_CRT_RELEASE=MT -DBUILD_SHARED_LIBS=OFF -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Gather LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
mv llvm-src/Release llvm
mv llvm-src/include llvm/
- name: Set up environment
run: |
echo "CRYSTAL_PATH=$(pwd)\src" >> ${env:GITHUB_ENV}
echo "LIB=${env:LIB};$(pwd)\libs" >> ${env:GITHUB_ENV}
echo "TERM=dumb" >> ${env:GITHUB_ENV}
echo "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe" >> ${env:GITHUB_ENV}
echo "SOURCE_DATE_EPOCH=$(Get-Date -Millisecond 0 -UFormat %s)" >> ${env:GITHUB_ENV}
- name: Download Crystal object file
uses: actions/download-artifact@v2
with:
name: objs
- name: Build LLVM extensions
run: |
cl /MT /c src\llvm\ext\llvm_ext.cc -I llvm\include /Fosrc\llvm\ext\llvm_ext.obj
- name: Link Crystal executable
run: |
Invoke-Expression "cl crystal.obj /Fecrystal-cross src\llvm\ext\llvm_ext.obj $(llvm\bin\llvm-config.exe --libs) libs\pcre.lib libs\gc.lib advapi32.lib libcmt.lib legacy_stdio_definitions.lib /F10000000"
- name: Re-build Crystal
run: |
.\crystal-cross.exe build src/compiler/crystal.cr -Di_know_what_im_doing -Dwithout_playground --link-flags=/F10000000
mv crystal.exe bin/
- name: Gather Crystal binaries
run: |
mkdir crystal
cp bin/crystal.exe crystal/
cp libs/* crystal/
- name: Upload Crystal binaries
uses: actions/upload-artifact@v2
with:
name: crystal
path: crystal
- name: Build stdlib specs executable
run: |
bin\crystal.exe build spec/std_spec.cr --exclude-warnings spec/std --exclude-warnings spec/compiler -Dwithout_openssl -Di_know_what_im_doing
- name: Run stdlib specs
run: |
.\std_spec.exe
- name: Build compiler specs executable
run: |
bin\crystal.exe build spec/compiler_spec.cr --exclude-warnings spec/std --exclude-warnings spec/compiler -Dwithout_playground -Di_know_what_im_doing
- name: Run compiler specs
run: |
.\compiler_spec.exe