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 steps: 22 - uses: actions/checkout@v4 23 - name: Setup Rust toolchain 24 run: ./ci/install-rust.sh 25 - name: Check style 26 run: ./ci/style.sh 27 28 # This runs `cargo build --target ...` for all T1 and T2 targets` 29 verify_build: 30 name: Verify build 31 strategy: 32 matrix: 33 toolchain: [stable, nightly, 1.63.0] 34 os: [ubuntu-24.04, macos-14, windows-2022] 35 include: 36 - toolchain: beta 37 os: ubuntu-24.04 38 runs-on: ${{ matrix.os }} 39 env: 40 TOOLCHAIN: ${{ matrix.toolchain }} 41 steps: 42 - uses: actions/checkout@v4 43 - name: Setup Rust toolchain 44 run: ./ci/install-rust.sh 45 - name: Execute build.sh 46 run: ./ci/verify-build.sh 47 48 test_tier1: 49 name: Test tier1 50 strategy: 51 matrix: 52 include: 53 - target: i686-unknown-linux-gnu 54 docker: true 55 os: ubuntu-24.04 56 - target: x86_64-unknown-linux-gnu 57 docker: true 58 os: ubuntu-24.04 59 - target: aarch64-apple-darwin 60 os: macos-14 61 - target: x86_64-pc-windows-gnu 62 os: windows-2022 63 env: 64 ARCH_BITS: 64 65 ARCH: x86_64 66 - target: x86_64-pc-windows-msvc 67 os: windows-2022 68 # FIXME: It currently causes segfaults. 69 #- target: i686-pc-windows-gnu 70 # env: 71 # ARCH_BITS: 32 72 # ARCH: i686 73 - target: i686-pc-windows-msvc 74 os: windows-2022 75 runs-on: ${{ matrix.os }} 76 env: 77 TARGET: ${{ matrix.target }} 78 steps: 79 - uses: actions/checkout@v4 80 - name: Setup Rust toolchain 81 run: ./ci/install-rust.sh 82 - name: Run natively 83 if: "!matrix.docker" 84 run: ./ci/run.sh ${{ matrix.target }} 85 - name: Run in Docker 86 if: "matrix.docker" 87 run: ./ci/run-docker.sh ${{ matrix.target }} 88 89 test_tier2: 90 name: Test tier2 91 needs: [test_tier1, style_check] 92 runs-on: ubuntu-24.04 93 strategy: 94 fail-fast: true 95 max-parallel: 12 96 matrix: 97 target: 98 # FIXME(sparc): this takes much longer to run than any other job, put 99 # it first to make sure it gets a head start. 100 - sparc64-unknown-linux-gnu 101 - aarch64-linux-android 102 - aarch64-unknown-linux-gnu 103 - aarch64-unknown-linux-musl 104 - arm-linux-androideabi 105 - arm-unknown-linux-gnueabihf 106 - arm-unknown-linux-musleabihf 107 - i686-linux-android 108 - i686-unknown-linux-musl 109 - loongarch64-unknown-linux-gnu 110 - loongarch64-unknown-linux-musl 111 - powerpc-unknown-linux-gnu 112 - powerpc64-unknown-linux-gnu 113 - powerpc64le-unknown-linux-gnu 114 - riscv64gc-unknown-linux-gnu 115 - s390x-unknown-linux-gnu 116 - wasm32-unknown-emscripten 117 - wasm32-wasip1 118 - wasm32-wasip2 119 - x86_64-linux-android 120 # FIXME: Exec format error (os error 8) 121 # - x86_64-unknown-linux-gnux32 122 - x86_64-unknown-linux-musl 123 # FIXME: It seems some items in `src/unix/mod.rs` 124 # aren't defined on redox actually. 125 # - x86_64-unknown-redox 126 env: 127 TARGET: ${{ matrix.target }} 128 steps: 129 - uses: actions/checkout@v4 130 - name: Setup Rust toolchain 131 run: ./ci/install-rust.sh 132 - name: Execute run-docker.sh 133 run: ./ci/run-docker.sh ${{ matrix.target }} 134 135 test_tier2_vm: 136 name: Test tier2 VM 137 needs: [test_tier1, style_check] 138 runs-on: ubuntu-latest 139 strategy: 140 fail-fast: true 141 matrix: 142 target: 143 - x86_64-pc-solaris 144 steps: 145 - uses: actions/checkout@v4 146 - name: test on Solaris 147 uses: vmactions/solaris-vm@v1 148 with: 149 release: "11.4-gcc" 150 usesh: true 151 mem: 4096 152 copyback: false 153 prepare: | 154 set -x 155 source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install) 156 rustc --version 157 uname -a 158 run: | 159 export PATH=$HOME/.rust_solaris/bin:$PATH 160 ./ci/run.sh ${{ matrix.target }} 161 162 check_cfg: 163 name: "Check #[cfg]s" 164 runs-on: ubuntu-24.04 165 env: 166 TOOLCHAIN: nightly 167 steps: 168 - uses: actions/checkout@v4 169 - name: Setup Rust toolchain 170 run: ./ci/install-rust.sh 171 - name: Build with check-cfg 172 run: LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg 173 174 # One job that "summarizes" the success state of this pipeline. This can then be added to branch 175 # protection, rather than having to add each job separately. 176 success: 177 name: success 178 runs-on: ubuntu-24.04 179 needs: 180 - style_check 181 - test_tier1 182 - test_tier2 183 - test_tier2_vm 184 - verify_build 185 # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency 186 # failed" as success. So we have to do some contortions to ensure the job fails if any of its 187 # dependencies fails. 188 if: always() # make sure this is never "skipped" 189 steps: 190 # Manually check the status of all dependencies. `if: failure()` does not work. 191 - name: check if any dependency failed 192 run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' 193