]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_cranelift/.github/workflows/main.yml
New upstream version 1.68.2+dfsg1
[rustc.git] / compiler / rustc_codegen_cranelift / .github / workflows / main.yml
CommitLineData
29967ef6
XL
1name: CI
2
3on:
4 - push
5 - pull_request
6
7jobs:
a2a8927a
XL
8 rustfmt:
9 runs-on: ubuntu-latest
10 timeout-minutes: 10
11
12 steps:
923072b8 13 - uses: actions/checkout@v3
a2a8927a
XL
14
15 - name: Install rustfmt
16 run: |
17 rustup component add rustfmt
18
19 - name: Rustfmt
20 run: |
21 cargo fmt --check
9c376795 22 rustfmt --check build_system/mod.rs
a2a8927a 23
29967ef6
XL
24 build:
25 runs-on: ${{ matrix.os }}
cdc7bbd5 26 timeout-minutes: 60
29967ef6
XL
27
28 strategy:
29 fail-fast: false
30 matrix:
cdc7bbd5 31 include:
9c376795 32 - os: ubuntu-20.04 # FIXME switch to ubuntu-22.04 once #1303 is fixed
2b03887a
FG
33 env:
34 TARGET_TRIPLE: x86_64-unknown-linux-gnu
cdc7bbd5 35 - os: macos-latest
2b03887a
FG
36 env:
37 TARGET_TRIPLE: x86_64-apple-darwin
cdc7bbd5
XL
38 # cross-compile from Linux to Windows using mingw
39 - os: ubuntu-latest
40 env:
41 TARGET_TRIPLE: x86_64-pc-windows-gnu
136023e0
XL
42 - os: ubuntu-latest
43 env:
44 TARGET_TRIPLE: aarch64-unknown-linux-gnu
9c376795
FG
45 # s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
46 - os: ubuntu-latest
47 env:
48 TARGET_TRIPLE: s390x-unknown-linux-gnu
29967ef6
XL
49
50 steps:
923072b8 51 - uses: actions/checkout@v3
29967ef6
XL
52
53 - name: Cache cargo installed crates
9c376795 54 uses: actions/cache@v3
29967ef6
XL
55 with:
56 path: ~/.cargo/bin
57 key: ${{ runner.os }}-cargo-installed-crates
58
59 - name: Cache cargo registry and index
9c376795 60 uses: actions/cache@v3
29967ef6
XL
61 with:
62 path: |
63 ~/.cargo/registry
64 ~/.cargo/git
65 key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
66
67 - name: Cache cargo target dir
9c376795 68 uses: actions/cache@v3
29967ef6 69 with:
9c376795 70 path: build/cg_clif
29967ef6
XL
71 key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
72
cdc7bbd5
XL
73 - name: Install MinGW toolchain and wine
74 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
75 run: |
94222f64 76 sudo apt-get update
cdc7bbd5
XL
77 sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
78 rustup target add x86_64-pc-windows-gnu
79
136023e0
XL
80 - name: Install AArch64 toolchain and qemu
81 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
82 run: |
94222f64 83 sudo apt-get update
136023e0
XL
84 sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
85
9c376795
FG
86 - name: Install s390x toolchain and qemu
87 if: matrix.env.TARGET_TRIPLE == 's390x-unknown-linux-gnu'
29967ef6 88 run: |
9c376795
FG
89 sudo apt-get update
90 sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
91
92 - name: Prepare dependencies
93 run: ./y.rs prepare
136023e0 94
a2a8927a
XL
95 - name: Build without unstable features
96 env:
97 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
98 # This is the config rust-lang/rust uses for builds
99 run: ./y.rs build --no-unstable-features
100
136023e0
XL
101 - name: Build
102 run: ./y.rs build --sysroot none
29967ef6
XL
103
104 - name: Test
cdc7bbd5
XL
105 env:
106 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
29967ef6
XL
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
cdc7bbd5
XL
115 # Enable extra checks
116 export CG_CLIF_ENABLE_VERIFIER=1
117
f2b60f7d 118 ./y.rs test
29967ef6
XL
119
120 - name: Package prebuilt cg_clif
9c376795 121 run: tar cvfJ cg_clif.tar.xz dist
29967ef6
XL
122
123 - name: Upload prebuilt cg_clif
cdc7bbd5 124 if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
29967ef6
XL
125 uses: actions/upload-artifact@v2
126 with:
2b03887a 127 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
29967ef6 128 path: cg_clif.tar.xz
17df50a5
XL
129
130 - name: Upload prebuilt cg_clif (cross compile)
131 if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
9c376795 132 uses: actions/upload-artifact@v3
17df50a5
XL
133 with:
134 name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
135 path: cg_clif.tar.xz
136023e0 136
2b03887a
FG
137 windows:
138 runs-on: ${{ matrix.os }}
136023e0
XL
139 timeout-minutes: 60
140
2b03887a
FG
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
136023e0 154 steps:
923072b8 155 - uses: actions/checkout@v3
136023e0 156
2b03887a 157 - name: Cache cargo installed crates
9c376795 158 uses: actions/cache@v3
2b03887a
FG
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
9c376795 164 uses: actions/cache@v3
2b03887a
FG
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
9c376795 172 uses: actions/cache@v3
2b03887a 173 with:
9c376795 174 path: build/cg_clif
2b03887a
FG
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
136023e0
XL
180
181 - name: Prepare dependencies
182 run: |
136023e0 183 git config --global core.autocrlf false
136023e0
XL
184 rustc y.rs -o y.exe -g
185 ./y.exe prepare
186
2b03887a
FG
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
136023e0 193 - name: Build
2b03887a
FG
194 run: ./y.rs build --sysroot none
195
196 - name: Test
136023e0
XL
197 run: |
198 # Enable backtraces for easier debugging
2b03887a 199 $Env:RUST_BACKTRACE=1
136023e0
XL
200
201 # Reduce amount of benchmark runs as they are slow
2b03887a
FG
202 $Env:COMPILE_RUNS=2
203 $Env:RUN_RUNS=2
136023e0
XL
204
205 # Enable extra checks
2b03887a 206 $Env:CG_CLIF_ENABLE_VERIFIER=1
9c376795 207
2b03887a 208 # WIP Disable some tests
9c376795 209
2b03887a
FG
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
9c376795
FG
213
214 # This fails with a different output than expected
2b03887a
FG
215 (Get-Content config.txt) -replace '(test.regex-shootout-regex-dna)', '# $1' | Out-File config.txt
216
217 ./y.exe test
136023e0 218
a2a8927a
XL
219 - name: Package prebuilt cg_clif
220 # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
9c376795 221 run: tar cvf cg_clif.tar dist
136023e0 222
a2a8927a 223 - name: Upload prebuilt cg_clif
9c376795 224 uses: actions/upload-artifact@v3
a2a8927a 225 with:
2b03887a 226 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
a2a8927a 227 path: cg_clif.tar