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
@@ -110,87 +130,15 @@ jobs:
110
130
run : tar cvfJ cg_clif.tar.xz dist
111
131
112
132
- name : Upload prebuilt cg_clif
113
- 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'
114
134
uses : actions/upload-artifact@v3
115
135
with :
116
136
name : cg_clif-${{ matrix.env.TARGET_TRIPLE }}
117
137
path : cg_clif.tar.xz
118
138
119
139
- name : Upload prebuilt cg_clif (cross compile)
120
- 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'
121
141
uses : actions/upload-artifact@v3
122
142
with :
123
143
name : cg_clif-${{ runner.os }}-cross-x86_64-mingw
124
144
path : cg_clif.tar.xz
125
-
126
- windows :
127
- runs-on : ${{ matrix.os }}
128
- timeout-minutes : 60
129
-
130
- strategy :
131
- fail-fast : false
132
- matrix :
133
- include :
134
- # Native Windows build with MSVC
135
- - os : windows-latest
136
- env :
137
- TARGET_TRIPLE : x86_64-pc-windows-msvc
138
- # cross-compile from Windows to Windows MinGW
139
- - os : windows-latest
140
- env :
141
- TARGET_TRIPLE : x86_64-pc-windows-gnu
142
-
143
- steps :
144
- - uses : actions/checkout@v3
145
-
146
- - name : Cache cargo installed crates
147
- uses : actions/cache@v3
148
- with :
149
- path : ~/.cargo/bin
150
- key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
151
-
152
- - name : Cache cargo registry and index
153
- uses : actions/cache@v3
154
- with :
155
- path : |
156
- ~/.cargo/registry
157
- ~/.cargo/git
158
- key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
159
-
160
- - name : Cache cargo target dir
161
- uses : actions/cache@v3
162
- with :
163
- path : build/cg_clif
164
- key : ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
165
-
166
- - name : Set MinGW as the default toolchain
167
- if : matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
168
- run : rustup set default-host x86_64-pc-windows-gnu
169
-
170
- - name : Prepare dependencies
171
- run : |
172
- git config --global core.autocrlf false
173
- rustc y.rs -o y.exe -g
174
- ./y.exe prepare
175
-
176
- - name : Build without unstable features
177
- env :
178
- TARGET_TRIPLE : ${{ matrix.env.TARGET_TRIPLE }}
179
- # This is the config rust-lang/rust uses for builds
180
- run : ./y.exe build --no-unstable-features
181
-
182
- - name : Build
183
- run : ./y.exe build --sysroot none
184
-
185
- - name : Test
186
- run : ./y.exe test
187
-
188
- - name : Package prebuilt cg_clif
189
- # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
190
- run : tar cvf cg_clif.tar dist
191
-
192
- - name : Upload prebuilt cg_clif
193
- uses : actions/upload-artifact@v3
194
- with :
195
- name : cg_clif-${{ matrix.env.TARGET_TRIPLE }}
196
- path : cg_clif.tar
0 commit comments