25
25
runs-on : ${{ matrix.os }}
26
26
timeout-minutes : 60
27
27
28
+ defaults :
29
+ run :
30
+ shell : bash
31
+
28
32
strategy :
29
33
fail-fast : false
30
34
matrix :
46
50
- os : ubuntu-latest
47
51
env :
48
52
TARGET_TRIPLE : s390x-unknown-linux-gnu
53
+ # Native Windows build with MSVC
54
+ - os : windows-latest
55
+ env :
56
+ TARGET_TRIPLE : x86_64-pc-windows-msvc
57
+ # cross-compile from Windows to Windows MinGW
58
+ - os : windows-latest
59
+ env :
60
+ TARGET_TRIPLE : x86_64-pc-windows-gnu
49
61
50
62
steps :
51
63
- uses : actions/checkout@v3
@@ -54,21 +66,25 @@ jobs:
54
66
uses : actions/cache@v3
55
67
with :
56
68
path : ~/.cargo/bin
57
- key : ${{ runner.os }}-cargo-installed-crates
69
+ key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}- cargo-installed-crates
58
70
59
71
- name : Cache cargo registry and index
60
72
uses : actions/cache@v3
61
73
with :
62
74
path : |
63
75
~/.cargo/registry
64
76
~/.cargo/git
65
- key : ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
77
+ key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}- cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
66
78
67
79
- name : Cache cargo target dir
68
80
uses : actions/cache@v3
69
81
with :
70
82
path : build/cg_clif
71
- key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
83
+ key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
84
+
85
+ - name : Set MinGW as the default toolchain
86
+ if : matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
87
+ run : rustup set default-host x86_64-pc-windows-gnu
72
88
73
89
- name : Install MinGW toolchain and wine
74
90
if : matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
@@ -89,6 +105,10 @@ jobs:
89
105
sudo apt-get update
90
106
sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
91
107
108
+ - name : Windows setup
109
+ if : matrix.os == 'windows-latest'
110
+ run : git config --global core.autocrlf false
111
+
92
112
- name : Prepare dependencies
93
113
run : ./y.rs prepare
94
114
@@ -104,124 +124,21 @@ jobs:
104
124
- name : Test
105
125
env :
106
126
TARGET_TRIPLE : ${{ matrix.env.TARGET_TRIPLE }}
107
- run : |
108
- # Enable backtraces for easier debugging
109
- export RUST_BACKTRACE=1
110
-
111
- # Reduce amount of benchmark runs as they are slow
112
- export COMPILE_RUNS=2
113
- export RUN_RUNS=2
114
-
115
- # Enable extra checks
116
- export CG_CLIF_ENABLE_VERIFIER=1
117
-
118
- ./y.rs test
127
+ run : ./y.rs test
119
128
120
129
- name : Package prebuilt cg_clif
121
130
run : tar cvfJ cg_clif.tar.xz dist
122
131
123
132
- name : Upload prebuilt cg_clif
124
- if : matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
133
+ if : matrix.os == 'windows-latest' || matrix. env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
125
134
uses : actions/upload-artifact@v3
126
135
with :
127
136
name : cg_clif-${{ matrix.env.TARGET_TRIPLE }}
128
137
path : cg_clif.tar.xz
129
138
130
139
- name : Upload prebuilt cg_clif (cross compile)
131
- if : matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
140
+ if : matrix.os != 'windows-latest' && matrix. env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
132
141
uses : actions/upload-artifact@v3
133
142
with :
134
143
name : cg_clif-${{ runner.os }}-cross-x86_64-mingw
135
144
path : cg_clif.tar.xz
136
-
137
- windows :
138
- runs-on : ${{ matrix.os }}
139
- timeout-minutes : 60
140
-
141
- strategy :
142
- fail-fast : false
143
- matrix :
144
- include :
145
- # Native Windows build with MSVC
146
- - os : windows-latest
147
- env :
148
- TARGET_TRIPLE : x86_64-pc-windows-msvc
149
- # cross-compile from Windows to Windows MinGW
150
- - os : windows-latest
151
- env :
152
- TARGET_TRIPLE : x86_64-pc-windows-gnu
153
-
154
- steps :
155
- - uses : actions/checkout@v3
156
-
157
- - name : Cache cargo installed crates
158
- uses : actions/cache@v3
159
- with :
160
- path : ~/.cargo/bin
161
- key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
162
-
163
- - name : Cache cargo registry and index
164
- uses : actions/cache@v3
165
- with :
166
- path : |
167
- ~/.cargo/registry
168
- ~/.cargo/git
169
- key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
170
-
171
- - name : Cache cargo target dir
172
- uses : actions/cache@v3
173
- with :
174
- path : build/cg_clif
175
- key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
176
-
177
- - name : Set MinGW as the default toolchain
178
- if : matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
179
- run : rustup set default-host x86_64-pc-windows-gnu
180
-
181
- - name : Prepare dependencies
182
- run : |
183
- git config --global core.autocrlf false
184
- rustc y.rs -o y.exe -g
185
- ./y.exe prepare
186
-
187
- - name : Build without unstable features
188
- env :
189
- TARGET_TRIPLE : ${{ matrix.env.TARGET_TRIPLE }}
190
- # This is the config rust-lang/rust uses for builds
191
- run : ./y.rs build --no-unstable-features
192
-
193
- - name : Build
194
- run : ./y.rs build --sysroot none
195
-
196
- - name : Test
197
- run : |
198
- # Enable backtraces for easier debugging
199
- $Env:RUST_BACKTRACE=1
200
-
201
- # Reduce amount of benchmark runs as they are slow
202
- $Env:COMPILE_RUNS=2
203
- $Env:RUN_RUNS=2
204
-
205
- # Enable extra checks
206
- $Env:CG_CLIF_ENABLE_VERIFIER=1
207
-
208
- # WIP Disable some tests
209
-
210
- # This fails due to some weird argument handling by hyperfine, not an actual regression
211
- # more of a build system issue
212
- (Get-Content config.txt) -replace '(bench.simple-raytracer)', '# $1' | Out-File config.txt
213
-
214
- # This fails with a different output than expected
215
- (Get-Content config.txt) -replace '(test.regex-shootout-regex-dna)', '# $1' | Out-File config.txt
216
-
217
- ./y.exe test
218
-
219
- - name : Package prebuilt cg_clif
220
- # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
221
- run : tar cvf cg_clif.tar dist
222
-
223
- - name : Upload prebuilt cg_clif
224
- uses : actions/upload-artifact@v3
225
- with :
226
- name : cg_clif-${{ matrix.env.TARGET_TRIPLE }}
227
- path : cg_clif.tar
0 commit comments