1name: CI 2 3on: 4 merge_group: 5 pull_request: 6 branches: 7 - libc-0.2 8 9env: 10 CARGO_TERM_VERBOSE: true 11 LIBC_CI: 1 12 13defaults: 14 run: 15 shell: bash 16 17jobs: 18 style_check: 19 name: Style check 20 runs-on: ubuntu-24.04 21 timeout-minutes: 10 22 steps: 23 - uses: actions/checkout@v4 24 - name: Setup Rust toolchain 25 run: ./ci/install-rust.sh 26 - name: Check style 27 run: ./ci/style.sh 28 29 # This runs `cargo build --target ...` for all T1 and T2 targets` 30 verify_build: 31 name: Verify build 32 strategy: 33 matrix: 34 toolchain: [stable, nightly, 1.63.0] 35 os: [ubuntu-24.04, macos-14, windows-2022] 36 include: 37 - toolchain: beta 38 os: ubuntu-24.04 39 runs-on: ${{ matrix.os }} 40 timeout-minutes: 25 41 env: 42 TOOLCHAIN: ${{ matrix.toolchain }} 43 steps: 44 - uses: actions/checkout@v4 45 - name: Setup Rust toolchain 46 run: ./ci/install-rust.sh 47 48 # FIXME(ci): These `du` statements are temporary for debugging cache 49 - name: Target size before restoring cache 50 run: du -sh target | sort -k 2 || true 51 - uses: Swatinem/rust-cache@v2 52 with: 53 key: ${{ matrix.os }}-${{ matrix.toolchain }} 54 - name: Target size after restoring cache 55 run: du -sh target | sort -k 2 || true 56 57 - name: Execute build.sh 58 run: ./ci/verify-build.sh 59 - name: Target size after job completion 60 run: du -sh target | sort -k 2 61 62 test_tier1: 63 name: Test tier1 64 strategy: 65 matrix: 66 include: 67 - target: i686-unknown-linux-gnu 68 docker: true 69 os: ubuntu-24.04 70 - target: x86_64-unknown-linux-gnu 71 docker: true 72 os: ubuntu-24.04 73 - target: aarch64-apple-darwin 74 os: macos-14 75 - target: x86_64-pc-windows-gnu 76 os: windows-2022 77 env: 78 ARCH_BITS: 64 79 ARCH: x86_64 80 - target: x86_64-pc-windows-msvc 81 os: windows-2022 82 # FIXME: It currently causes segfaults. 83 #- target: i686-pc-windows-gnu 84 # env: 85 # ARCH_BITS: 32 86 # ARCH: i686 87 - target: i686-pc-windows-msvc 88 os: windows-2022 89 runs-on: ${{ matrix.os }} 90 timeout-minutes: 25 91 env: 92 TARGET: ${{ matrix.target }} 93 steps: 94 - uses: actions/checkout@v4 95 - name: Setup Rust toolchain 96 run: ./ci/install-rust.sh 97 - uses: Swatinem/rust-cache@v2 98 with: 99 key: ${{ matrix.target }} 100 101 - name: Run natively 102 if: "!matrix.docker" 103 run: ./ci/run.sh ${{ matrix.target }} 104 - name: Run in Docker 105 if: "matrix.docker" 106 run: ./ci/run-docker.sh ${{ matrix.target }} 107 108 - name: Create CI artifacts 109 if: always() 110 run: ./ci/create-artifacts.py 111 - uses: actions/upload-artifact@v4 112 with: 113 name: ${{ env.ARCHIVE_NAME }}-${{ matrix.target }} 114 path: ${{ env.ARCHIVE_PATH }} 115 retention-days: 5 116 117 test_tier2: 118 name: Test tier2 119 needs: [test_tier1, style_check] 120 runs-on: ubuntu-24.04 121 strategy: 122 fail-fast: true 123 max-parallel: 12 124 matrix: 125 target: 126 # FIXME(sparc): this takes much longer to run than any other job, put 127 # it first to make sure it gets a head start. 128 - sparc64-unknown-linux-gnu 129 - aarch64-linux-android 130 - aarch64-unknown-linux-gnu 131 - aarch64-unknown-linux-musl 132 - arm-linux-androideabi 133 - arm-unknown-linux-gnueabihf 134 - arm-unknown-linux-musleabihf 135 - i686-linux-android 136 - i686-unknown-linux-musl 137 - loongarch64-unknown-linux-gnu 138 - loongarch64-unknown-linux-musl 139 # FIXME(ppc): SIGILL running tests, see 140 # https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713 141 # - powerpc-unknown-linux-gnu 142 - powerpc64-unknown-linux-gnu 143 - powerpc64le-unknown-linux-gnu 144 - riscv64gc-unknown-linux-gnu 145 - s390x-unknown-linux-gnu 146 - wasm32-unknown-emscripten 147 - wasm32-wasip1 148 - wasm32-wasip2 149 - x86_64-linux-android 150 # FIXME: Exec format error (os error 8) 151 # - x86_64-unknown-linux-gnux32 152 - x86_64-unknown-linux-musl 153 # FIXME: It seems some items in `src/unix/mod.rs` 154 # aren't defined on redox actually. 155 # - x86_64-unknown-redox 156 timeout-minutes: 25 157 env: 158 TARGET: ${{ matrix.target }} 159 steps: 160 - uses: actions/checkout@v4 161 - name: Setup Rust toolchain 162 run: ./ci/install-rust.sh 163 - uses: Swatinem/rust-cache@v2 164 with: 165 key: ${{ matrix.target }} 166 167 - name: Execute run-docker.sh 168 run: ./ci/run-docker.sh ${{ matrix.target }} 169 170 - name: Create CI artifacts 171 if: always() 172 run: ./ci/create-artifacts.py 173 - uses: actions/upload-artifact@v4 174 with: 175 name: ${{ env.ARCHIVE_NAME }}-${{ matrix.target }} 176 path: ${{ env.ARCHIVE_PATH }} 177 retention-days: 5 178 179 test_tier2_vm: 180 name: Test tier2 VM 181 needs: [test_tier1, style_check] 182 runs-on: ubuntu-latest 183 strategy: 184 fail-fast: true 185 matrix: 186 target: 187 - x86_64-pc-solaris 188 timeout-minutes: 25 189 steps: 190 - uses: actions/checkout@v4 191 - name: test on Solaris 192 uses: vmactions/solaris-vm@v1 193 with: 194 release: "11.4-gcc" 195 usesh: true 196 mem: 4096 197 copyback: false 198 prepare: | 199 set -x 200 source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install) 201 rustc --version 202 uname -a 203 run: | 204 export PATH=$HOME/.rust_solaris/bin:$PATH 205 ./ci/run.sh ${{ matrix.target }} 206 207 # One job that "summarizes" the success state of this pipeline. This can then be added to branch 208 # protection, rather than having to add each job separately. 209 success: 210 name: success 211 runs-on: ubuntu-24.04 212 needs: 213 - style_check 214 - test_tier1 215 - test_tier2 216 - test_tier2_vm 217 - verify_build 218 # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency 219 # failed" as success. So we have to do some contortions to ensure the job fails if any of its 220 # dependencies fails. 221 if: always() # make sure this is never "skipped" 222 steps: 223 # Manually check the status of all dependencies. `if: failure()` does not work. 224 - name: check if any dependency failed 225 run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' 226