|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + merge_group: |
| 5 | + |
| 6 | +jobs: |
| 7 | + style: |
| 8 | + name: Check Style |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - name: Install Rust |
| 13 | + run: rustup update nightly --no-self-update && rustup default nightly |
| 14 | + - run: ci/style.sh |
| 15 | + |
| 16 | + docs: |
| 17 | + name: Build Documentation |
| 18 | + needs: [style] |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Install Rust |
| 23 | + run: rustup update nightly --no-self-update && rustup default nightly |
| 24 | + - run: ci/dox.sh |
| 25 | + env: |
| 26 | + CI: 1 |
| 27 | + |
| 28 | + verify: |
| 29 | + name: Automatic intrinsic verification |
| 30 | + needs: [style] |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - name: Install Rust |
| 35 | + run: rustup update nightly --no-self-update && rustup default nightly |
| 36 | + - run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml |
| 37 | + |
| 38 | + test: |
| 39 | + needs: [style] |
| 40 | + name: Test |
| 41 | + runs-on: ${{ matrix.target.os }} |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + profile: |
| 45 | + - dev |
| 46 | + - release |
| 47 | + target: |
| 48 | + # Dockers that are run through docker on linux |
| 49 | + - tuple: i686-unknown-linux-gnu |
| 50 | + os: ubuntu-latest |
| 51 | + - tuple: x86_64-unknown-linux-gnu |
| 52 | + os: ubuntu-latest |
| 53 | + - tuple: arm-unknown-linux-gnueabihf |
| 54 | + os: ubuntu-latest |
| 55 | + - tuple: armv7-unknown-linux-gnueabihf |
| 56 | + os: ubuntu-latest |
| 57 | + - tuple: aarch64-unknown-linux-gnu |
| 58 | + os: ubuntu-latest |
| 59 | + - tuple: aarch64_be-unknown-linux-gnu |
| 60 | + os: ubuntu-latest |
| 61 | + - tuple: riscv32gc-unknown-linux-gnu |
| 62 | + os: ubuntu-latest |
| 63 | + - tuple: riscv64gc-unknown-linux-gnu |
| 64 | + os: ubuntu-latest |
| 65 | + - tuple: powerpc-unknown-linux-gnu |
| 66 | + os: ubuntu-latest |
| 67 | + - tuple: powerpc64-unknown-linux-gnu |
| 68 | + os: ubuntu-latest |
| 69 | + - tuple: powerpc64le-unknown-linux-gnu |
| 70 | + os: ubuntu-latest |
| 71 | + # MIPS targets disabled since they are dropped to tier 3. |
| 72 | + # See https://github.com/rust-lang/compiler-team/issues/648 |
| 73 | + #- tuple: mips-unknown-linux-gnu |
| 74 | + # os: ubuntu-latest |
| 75 | + #- tuple: mips64-unknown-linux-gnuabi64 |
| 76 | + # os: ubuntu-latest |
| 77 | + #- tuple: mips64el-unknown-linux-gnuabi64 |
| 78 | + # os: ubuntu-latest |
| 79 | + #- tuple: mipsel-unknown-linux-musl |
| 80 | + # os: ubuntu-latest |
| 81 | + - tuple: s390x-unknown-linux-gnu |
| 82 | + os: ubuntu-latest |
| 83 | + - tuple: i586-unknown-linux-gnu |
| 84 | + os: ubuntu-latest |
| 85 | + - tuple: nvptx64-nvidia-cuda |
| 86 | + os: ubuntu-latest |
| 87 | + - tuple: thumbv6m-none-eabi |
| 88 | + os: ubuntu-latest |
| 89 | + - tuple: thumbv7m-none-eabi |
| 90 | + os: ubuntu-latest |
| 91 | + - tuple: thumbv7em-none-eabi |
| 92 | + os: ubuntu-latest |
| 93 | + - tuple: thumbv7em-none-eabihf |
| 94 | + os: ubuntu-latest |
| 95 | + - tuple: loongarch64-unknown-linux-gnu |
| 96 | + os: ubuntu-latest |
| 97 | + - tuple: wasm32-wasip1 |
| 98 | + os: ubuntu-latest |
| 99 | + |
| 100 | + # macOS targets |
| 101 | + - tuple: x86_64-apple-darwin |
| 102 | + os: macos-15-large |
| 103 | + - tuple: x86_64-apple-ios-macabi |
| 104 | + os: macos-15-large |
| 105 | + - tuple: aarch64-apple-darwin |
| 106 | + os: macos-15 |
| 107 | + - tuple: aarch64-apple-ios-macabi |
| 108 | + os: macos-15 |
| 109 | + # FIXME: gh-actions build environment doesn't have linker support |
| 110 | + # - tuple: i686-apple-darwin |
| 111 | + # os: macos-13 |
| 112 | + |
| 113 | + # Windows targets |
| 114 | + - tuple: x86_64-pc-windows-msvc |
| 115 | + os: windows-2025 |
| 116 | + - tuple: i686-pc-windows-msvc |
| 117 | + os: windows-2025 |
| 118 | + - tuple: aarch64-pc-windows-msvc |
| 119 | + os: windows-11-arm |
| 120 | + - tuple: x86_64-pc-windows-gnu |
| 121 | + os: windows-2025 |
| 122 | + # - tuple: i686-pc-windows-gnu |
| 123 | + # os: windows-latest |
| 124 | + |
| 125 | + # Add additional variables to the matrix variations generated above using `include`: |
| 126 | + include: |
| 127 | + # `TEST_EVERYTHING` setups - there should be at least 1 for each architecture |
| 128 | + - target: |
| 129 | + tuple: aarch64-unknown-linux-gnu |
| 130 | + os: ubuntu-latest |
| 131 | + test_everything: true |
| 132 | + - target: |
| 133 | + tuple: aarch64_be-unknown-linux-gnu |
| 134 | + os: ubuntu-latest |
| 135 | + test_everything: true |
| 136 | + build_std: true |
| 137 | + - target: |
| 138 | + tuple: armv7-unknown-linux-gnueabihf |
| 139 | + os: ubuntu-latest |
| 140 | + test_everything: true |
| 141 | + - target: |
| 142 | + tuple: loongarch64-unknown-linux-gnu |
| 143 | + os: ubuntu-latest |
| 144 | + test_everything: true |
| 145 | + - target: |
| 146 | + tuple: powerpc-unknown-linux-gnu |
| 147 | + os: ubuntu-latest |
| 148 | + disable_assert_instr: true |
| 149 | + test_everything: true |
| 150 | + - target: |
| 151 | + tuple: powerpc64-unknown-linux-gnu |
| 152 | + os: ubuntu-latest |
| 153 | + disable_assert_instr: true |
| 154 | + test_everything: true |
| 155 | + - target: |
| 156 | + tuple: powerpc64le-unknown-linux-gnu |
| 157 | + os: ubuntu-latest |
| 158 | + test_everything: true |
| 159 | + - target: |
| 160 | + tuple: riscv32gc-unknown-linux-gnu |
| 161 | + os: ubuntu-latest |
| 162 | + test_everything: true |
| 163 | + build_std: true |
| 164 | + - target: |
| 165 | + tuple: riscv64gc-unknown-linux-gnu |
| 166 | + os: ubuntu-latest |
| 167 | + test_everything: true |
| 168 | + - target: |
| 169 | + tuple: s390x-unknown-linux-gnu |
| 170 | + os: ubuntu-latest |
| 171 | + test_everything: true |
| 172 | + - target: |
| 173 | + tuple: x86_64-unknown-linux-gnu |
| 174 | + os: ubuntu-latest |
| 175 | + test_everything: true |
| 176 | + # MIPS targets disabled since they are dropped to tier 3. |
| 177 | + # See https://github.com/rust-lang/compiler-team/issues/648 |
| 178 | + #- target: |
| 179 | + # tuple: mips-unknown-linux-gnu |
| 180 | + # os: ubuntu-latest |
| 181 | + # norun: true |
| 182 | + #- target: |
| 183 | + # tuple: mips64-unknown-linux-gnuabi64 |
| 184 | + # os: ubuntu-latest |
| 185 | + # norun: true |
| 186 | + #- target: |
| 187 | + # tuple: mips64el-unknown-linux-gnuabi64 |
| 188 | + # os: ubuntu-latest |
| 189 | + # norun: true |
| 190 | + #- target: |
| 191 | + # tuple: mipsel-unknown-linux-musl |
| 192 | + # os: ubuntu-latest |
| 193 | + # norun: true |
| 194 | + - target: |
| 195 | + tuple: aarch64-apple-darwin |
| 196 | + os: macos-15 |
| 197 | + norun: true # https://github.com/rust-lang/stdarch/issues/1206 |
| 198 | + - target: |
| 199 | + tuple: aarch64-apple-ios-macabi |
| 200 | + os: macos-15 |
| 201 | + norun: true # https://github.com/rust-lang/stdarch/issues/1206 |
| 202 | + |
| 203 | + steps: |
| 204 | + - uses: actions/checkout@v4 |
| 205 | + - name: Install Rust |
| 206 | + run: | |
| 207 | + rustup update nightly --no-self-update |
| 208 | + rustup default nightly |
| 209 | + shell: bash |
| 210 | + if: matrix.target.os != 'windows-11-arm' |
| 211 | + - name: Install Rust for `windows-11-arm` runners |
| 212 | + # The arm runners don't have Rust pre-installed (https://github.com/actions/partner-runner-images/issues/77) |
| 213 | + run: | |
| 214 | + curl https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly |
| 215 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 216 | + shell: bash |
| 217 | + if: matrix.target.os == 'windows-11-arm' |
| 218 | + |
| 219 | + - run: rustup target add ${{ matrix.target.tuple }} |
| 220 | + shell: bash |
| 221 | + if: matrix.build_std == '' |
| 222 | + - run: | |
| 223 | + rustup component add rust-src |
| 224 | + echo "CARGO_UNSTABLE_BUILD_STD=std" >> $GITHUB_ENV |
| 225 | + shell: bash |
| 226 | + if: matrix.build_std != '' |
| 227 | +
|
| 228 | + # Configure some env vars based on matrix configuration |
| 229 | + - run: echo "PROFILE=--profile=${{matrix.profile}}" >> $GITHUB_ENV |
| 230 | + shell: bash |
| 231 | + - run: echo "NORUN=1" >> $GITHUB_ENV |
| 232 | + shell: bash |
| 233 | + if: matrix.norun != '' || startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda' |
| 234 | + - run: echo "STDARCH_TEST_EVERYTHING=1" >> $GITHUB_ENV |
| 235 | + shell: bash |
| 236 | + if: matrix.test_everything != '' |
| 237 | + - run: echo "STDARCH_DISABLE_ASSERT_INSTR=1" >> $GITHUB_ENV |
| 238 | + shell: bash |
| 239 | + if: matrix.disable_assert_instr != '' |
| 240 | + - run: echo "NOSTD=1" >> $GITHUB_ENV |
| 241 | + shell: bash |
| 242 | + if: startsWith(matrix.target.tuple, 'thumb') || matrix.target.tuple == 'nvptx64-nvidia-cuda' |
| 243 | + |
| 244 | + # Windows & OSX go straight to `run.sh` ... |
| 245 | + - run: ./ci/run.sh |
| 246 | + shell: bash |
| 247 | + if: matrix.target.os != 'ubuntu-latest' || startsWith(matrix.target.tuple, 'thumb') |
| 248 | + env: |
| 249 | + TARGET: ${{ matrix.target.tuple }} |
| 250 | + |
| 251 | + # ... while Linux goes to `run-docker.sh` |
| 252 | + - run: ./ci/run-docker.sh ${{ matrix.target.tuple }} |
| 253 | + shell: bash |
| 254 | + if: matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb') |
| 255 | + env: |
| 256 | + TARGET: ${{ matrix.target.tuple }} |
| 257 | + |
| 258 | + build-std-detect: |
| 259 | + needs: [style] |
| 260 | + name: Build std_detect |
| 261 | + runs-on: ubuntu-latest |
| 262 | + steps: |
| 263 | + - uses: actions/checkout@v4 |
| 264 | + - name: Install Rust |
| 265 | + run: rustup update nightly && rustup default nightly |
| 266 | + - run: ./ci/build-std-detect.sh |
| 267 | + |
| 268 | + conclusion: |
| 269 | + needs: |
| 270 | + - docs |
| 271 | + - verify |
| 272 | + - test |
| 273 | + - build-std-detect |
| 274 | + runs-on: ubuntu-latest |
| 275 | + # We need to ensure this job does *not* get skipped if its dependencies fail, |
| 276 | + # because a skipped job is considered a success by GitHub. So we have to |
| 277 | + # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run |
| 278 | + # when the workflow is canceled manually. |
| 279 | + # |
| 280 | + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
| 281 | + if: ${{ !cancelled() }} # make sure this is never "skipped" |
| 282 | + steps: |
| 283 | + - name: Conclusion |
| 284 | + run: | |
| 285 | + # Print the dependent jobs to see them in the CI log |
| 286 | + jq -C <<< '${{ toJson(needs) }}' |
| 287 | + # Check if all jobs that we depend on (in the needs array) were successful. |
| 288 | + jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |
0 commit comments