]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/.github/workflows/main.yml
Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obk
[rust.git] / compiler / rustc_codegen_cranelift / .github / workflows / main.yml
1 name: CI
2
3 on:
4   - push
5   - pull_request
6
7 jobs:
8   rustfmt:
9     runs-on: ubuntu-latest
10     timeout-minutes: 10
11
12     steps:
13     - uses: actions/checkout@v3
14
15     - name: Install rustfmt
16       run: |
17         rustup component add rustfmt
18
19     - name: Rustfmt
20       run: |
21         cargo fmt --check
22         rustfmt --check build_system/mod.rs
23
24   build:
25     runs-on: ${{ matrix.os }}
26     timeout-minutes: 60
27
28     defaults:
29       run:
30         shell: bash
31
32     strategy:
33       fail-fast: false
34       matrix:
35         include:
36           - os: ubuntu-20.04 # FIXME switch to ubuntu-22.04 once #1303 is fixed
37             env:
38               TARGET_TRIPLE: x86_64-unknown-linux-gnu
39           - os: macos-latest
40             env:
41               TARGET_TRIPLE: x86_64-apple-darwin
42           # cross-compile from Linux to Windows using mingw
43           - os: ubuntu-latest
44             env:
45               TARGET_TRIPLE: x86_64-pc-windows-gnu
46           - os: ubuntu-latest
47             env:
48               TARGET_TRIPLE: aarch64-unknown-linux-gnu
49           # s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
50           - os: ubuntu-latest
51             env:
52               TARGET_TRIPLE: s390x-unknown-linux-gnu
53           - os: windows-latest
54             env:
55               TARGET_TRIPLE: x86_64-pc-windows-msvc
56           - os: windows-latest
57             env:
58               TARGET_TRIPLE: x86_64-pc-windows-gnu
59
60     steps:
61     - uses: actions/checkout@v3
62
63     - name: Cache cargo target dir
64       uses: actions/cache@v3
65       with:
66         path: build/cg_clif
67         key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
68
69     - name: Set MinGW as the default toolchain
70       if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
71       run: rustup set default-host x86_64-pc-windows-gnu
72
73     - name: Install MinGW toolchain and wine
74       if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
75       run: |
76         sudo apt-get update
77         sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
78
79     - name: Install AArch64 toolchain and qemu
80       if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
81       run: |
82         sudo apt-get update
83         sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
84
85     - name: Install s390x toolchain and qemu
86       if: matrix.env.TARGET_TRIPLE == 's390x-unknown-linux-gnu'
87       run: |
88         sudo apt-get update
89         sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
90
91     - name: Use sparse cargo registry
92       run: |
93         cat >> ~/.cargo/config.toml <<EOF
94         [unstable]
95         sparse-registry = true
96         EOF
97
98     - name: Prepare dependencies
99       run: ./y.rs prepare
100
101     - name: Build without unstable features
102       env:
103         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
104       # This is the config rust-lang/rust uses for builds
105       run: ./y.rs build --no-unstable-features
106
107     - name: Build
108       run: ./y.rs build --sysroot none
109
110     - name: Test
111       env:
112         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
113       run: ./y.rs test
114
115     - name: Package prebuilt cg_clif
116       run: tar cvfJ cg_clif.tar.xz dist
117
118     - name: Upload prebuilt cg_clif
119       if: matrix.os == 'windows-latest' || matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
120       uses: actions/upload-artifact@v3
121       with:
122         name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
123         path: cg_clif.tar.xz
124
125     - name: Upload prebuilt cg_clif (cross compile)
126       if: matrix.os != 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
127       uses: actions/upload-artifact@v3
128       with:
129         name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
130         path: cg_clif.tar.xz
131
132
133   abi_cafe:
134     runs-on: ${{ matrix.os }}
135     timeout-minutes: 60
136
137     defaults:
138       run:
139         shell: bash
140
141     strategy:
142       fail-fast: true
143       matrix:
144         include:
145           - os: ubuntu-latest
146             env:
147               TARGET_TRIPLE: x86_64-unknown-linux-gnu
148           - os: macos-latest
149             env:
150               TARGET_TRIPLE: x86_64-apple-darwin
151           - os: windows-latest
152             env:
153               TARGET_TRIPLE: x86_64-pc-windows-msvc
154           - os: windows-latest
155             env:
156               TARGET_TRIPLE: x86_64-pc-windows-gnu
157
158     steps:
159     - uses: actions/checkout@v3
160
161     - name: Cache cargo target dir
162       uses: actions/cache@v3
163       with:
164         path: build/cg_clif
165         key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
166
167     - name: Set MinGW as the default toolchain
168       if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
169       run: rustup set default-host x86_64-pc-windows-gnu
170
171     - name: Use sparse cargo registry
172       run: |
173         cat >> ~/.cargo/config.toml <<EOF
174         [unstable]
175         sparse-registry = true
176         EOF
177
178     - name: Prepare dependencies
179       run: ./y.rs prepare
180
181     - name: Build
182       run: ./y.rs build --sysroot none
183
184     - name: Test abi-cafe
185       env:
186         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
187       run: ./y.rs abi-cafe