13 - uses: actions/checkout@v3
15 - name: Install rustfmt
17 rustup component add rustfmt
22 rustfmt --check build_system/mod.rs
25 runs-on: ${{ matrix.os }}
36 - os: ubuntu-20.04 # FIXME switch to ubuntu-22.04 once #1303 is fixed
38 TARGET_TRIPLE: x86_64-unknown-linux-gnu
41 TARGET_TRIPLE: x86_64-apple-darwin
42 # cross-compile from Linux to Windows using mingw
45 TARGET_TRIPLE: x86_64-pc-windows-gnu
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
52 TARGET_TRIPLE: s390x-unknown-linux-gnu
55 TARGET_TRIPLE: x86_64-pc-windows-msvc
58 TARGET_TRIPLE: x86_64-pc-windows-gnu
61 - uses: actions/checkout@v3
63 - name: Cache cargo target dir
64 uses: actions/cache@v3
67 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
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
73 - name: Install MinGW toolchain and wine
74 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
77 sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
79 - name: Install AArch64 toolchain and qemu
80 if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
83 sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
85 - name: Install s390x toolchain and qemu
86 if: matrix.env.TARGET_TRIPLE == 's390x-unknown-linux-gnu'
89 sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
91 - name: Use sparse cargo registry
93 cat >> ~/.cargo/config.toml <<EOF
95 sparse-registry = true
98 - name: Prepare dependencies
101 - name: Build without unstable features
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
108 run: ./y.rs build --sysroot none
112 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
115 - name: Package prebuilt cg_clif
116 run: tar cvfJ cg_clif.tar.xz dist
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
122 name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
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
129 name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
134 runs-on: ${{ matrix.os }}
147 TARGET_TRIPLE: x86_64-unknown-linux-gnu
150 TARGET_TRIPLE: x86_64-apple-darwin
153 TARGET_TRIPLE: x86_64-pc-windows-msvc
156 TARGET_TRIPLE: x86_64-pc-windows-gnu
159 - uses: actions/checkout@v3
161 - name: Cache cargo target dir
162 uses: actions/cache@v3
165 key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
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
171 - name: Use sparse cargo registry
173 cat >> ~/.cargo/config.toml <<EOF
175 sparse-registry = true
178 - name: Prepare dependencies
182 run: ./y.rs build --sysroot none
184 - name: Test abi-cafe
186 TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}