|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: master |
| 6 | + pull_request: |
| 7 | + branches: master |
| 8 | + schedule: |
| 9 | + - cron: "0 12 * * 1" |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +env: |
| 15 | + CARGO_INCREMENTAL: 0 |
| 16 | + RUSTFLAGS: "-Dwarnings" |
| 17 | + |
| 18 | +jobs: |
| 19 | + macos: |
| 20 | + name: Apple Other |
| 21 | + # visionOS requires Xcode 15.2+, which is only available on the arm64 runners. |
| 22 | + runs-on: macos-14 |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + - uses: dtolnay/rust-toolchain@nightly |
| 26 | + with: |
| 27 | + targets: aarch64-apple-darwin, aarch64-apple-ios |
| 28 | + components: rust-src |
| 29 | + - uses: Swatinem/rust-cache@v2 |
| 30 | + - run: cargo test --no-run --target=aarch64-apple-darwin --features=std |
| 31 | + - run: cargo test --no-run --target=aarch64-apple-ios --features=std |
| 32 | + - run: cargo test --no-run --target=aarch64-apple-tvos -Zbuild-std --features=std |
| 33 | + - run: cargo test --no-run --target=aarch64-apple-watchos -Zbuild-std --features=std |
| 34 | + # visionOS requires Xcode 15.2+, GitHub Actions defaults to an older version. |
| 35 | + - run: sudo xcode-select -switch /Applications/Xcode_15.2.app |
| 36 | + - run: cargo test --no-run --target=aarch64-apple-visionos -Zbuild-std --features=std |
| 37 | + |
| 38 | + cross: |
| 39 | + name: Cross |
| 40 | + runs-on: ubuntu-22.04 |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + target: [ |
| 44 | + sparcv9-sun-solaris, |
| 45 | + x86_64-unknown-illumos, |
| 46 | + x86_64-unknown-freebsd, |
| 47 | + x86_64-unknown-netbsd, |
| 48 | + ] |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + - name: Install precompiled cross |
| 52 | + run: | |
| 53 | + VERSION=v0.2.5 |
| 54 | + URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz |
| 55 | + wget -O - $URL | tar -xz -C ~/.cargo/bin |
| 56 | + cross --version |
| 57 | + - name: Build Tests |
| 58 | + run: cross test --no-run --target=${{ matrix.target }} --features=std |
| 59 | + |
| 60 | + wasm64: |
| 61 | + name: Wasm64 |
| 62 | + runs-on: ubuntu-22.04 |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - uses: dtolnay/rust-toolchain@nightly # Need to build libstd |
| 66 | + with: |
| 67 | + components: rust-src |
| 68 | + - uses: Swatinem/rust-cache@v2 |
| 69 | + - name: Build and Link tests (build-std) |
| 70 | + env: |
| 71 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" |
| 72 | + # This target is Tier 3, so we have to build libstd ourselves. |
| 73 | + # We currently cannot run these tests because wasm-bindgen-test-runner |
| 74 | + # does not yet support memory64. |
| 75 | + run: cargo test --no-run -Z build-std=std,panic_abort --target=wasm64-unknown-unknown |
| 76 | + |
| 77 | + tier2: |
| 78 | + name: Tier 2 |
| 79 | + runs-on: ubuntu-22.04 |
| 80 | + strategy: |
| 81 | + matrix: |
| 82 | + target: [ |
| 83 | + x86_64-unknown-fuchsia, |
| 84 | + x86_64-unknown-redox, |
| 85 | + x86_64-fortanix-unknown-sgx, |
| 86 | + ] |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + - uses: dtolnay/rust-toolchain@stable |
| 90 | + with: |
| 91 | + targets: ${{ matrix.target }} |
| 92 | + - uses: Swatinem/rust-cache@v2 |
| 93 | + - name: Build |
| 94 | + run: cargo build --target=${{ matrix.target }} --features=std |
| 95 | + |
| 96 | + tier3: |
| 97 | + name: Tier 3 |
| 98 | + runs-on: ubuntu-22.04 |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + # Supported tier 3 targets without libstd support |
| 102 | + target: [ |
| 103 | + x86_64-unknown-hermit, |
| 104 | + x86_64-wrs-vxworks, |
| 105 | + aarch64-kmc-solid_asp3, |
| 106 | + armv6k-nintendo-3ds, |
| 107 | + armv7-sony-vita-newlibeabihf, |
| 108 | + aarch64-unknown-nto-qnx710, |
| 109 | + ] |
| 110 | + # Supported tier 3 targets with libstd support |
| 111 | + include: |
| 112 | + - target: aarch64-unknown-nto-qnx710 |
| 113 | + features: ["std"] |
| 114 | + - target: x86_64-unknown-openbsd |
| 115 | + features: ["std"] |
| 116 | + - target: x86_64-unknown-dragonfly |
| 117 | + features: ["std"] |
| 118 | + - target: x86_64-unknown-haiku |
| 119 | + features: ["std"] |
| 120 | + - target: i686-unknown-hurd-gnu |
| 121 | + features: ["std"] |
| 122 | + steps: |
| 123 | + - uses: actions/checkout@v4 |
| 124 | + - uses: dtolnay/rust-toolchain@nightly # Required to build libcore |
| 125 | + with: |
| 126 | + components: rust-src |
| 127 | + - uses: Swatinem/rust-cache@v2 |
| 128 | + - run: cargo build -Z build-std=${{ contains(matrix.features, 'std') && 'std' || 'core'}} --target=${{ matrix.target }} --features="${{ join(matrix.features, ',') }}" |
| 129 | + |
| 130 | + rdrand: |
| 131 | + name: RDRAND |
| 132 | + runs-on: ubuntu-22.04 |
| 133 | + strategy: |
| 134 | + matrix: |
| 135 | + target: [ |
| 136 | + x86_64-unknown-uefi, |
| 137 | + x86_64-unknown-l4re-uclibc, |
| 138 | + ] |
| 139 | + steps: |
| 140 | + - uses: actions/checkout@v4 |
| 141 | + - uses: dtolnay/rust-toolchain@nightly # Required to build libcore |
| 142 | + with: |
| 143 | + components: rust-src |
| 144 | + - uses: Swatinem/rust-cache@v2 |
| 145 | + - env: |
| 146 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand" |
| 147 | + run: cargo build -Z build-std=core --target=${{ matrix.target }} |
| 148 | + |
| 149 | + rndr: |
| 150 | + name: RNDR |
| 151 | + runs-on: ubuntu-22.04 |
| 152 | + steps: |
| 153 | + - uses: actions/checkout@v4 |
| 154 | + - uses: dtolnay/rust-toolchain@master |
| 155 | + with: |
| 156 | + toolchain: stable |
| 157 | + targets: aarch64-unknown-linux-gnu, aarch64-apple-darwin |
| 158 | + - uses: Swatinem/rust-cache@v2 |
| 159 | + - name: RNDR enabled at compile time (Linux) |
| 160 | + env: |
| 161 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr" -C target-feature=+rand |
| 162 | + run: cargo build --target=aarch64-unknown-linux-gnu |
| 163 | + - name: Runtime RNDR detection without std (Linux) |
| 164 | + env: |
| 165 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr" |
| 166 | + run: cargo build --target=aarch64-unknown-linux-gnu |
| 167 | + - name: Runtime RNDR detection with std (macOS) |
| 168 | + env: |
| 169 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr" |
| 170 | + run: cargo build --target=aarch64-unknown-linux-gnu --features std |
| 171 | + |
| 172 | + esp-idf: |
| 173 | + name: ESP-IDF |
| 174 | + runs-on: ubuntu-22.04 |
| 175 | + steps: |
| 176 | + - uses: actions/checkout@v4 |
| 177 | + - uses: dtolnay/rust-toolchain@nightly # Required to build libcore |
| 178 | + with: |
| 179 | + components: rust-src |
| 180 | + - uses: Swatinem/rust-cache@v2 |
| 181 | + - env: |
| 182 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="esp_idf" |
| 183 | + run: cargo build -Z build-std=core --target=riscv32imc-esp-espidf |
| 184 | + |
| 185 | + no-atomics: |
| 186 | + name: No Atomics |
| 187 | + runs-on: ubuntu-22.04 |
| 188 | + steps: |
| 189 | + - uses: actions/checkout@v4 |
| 190 | + - uses: dtolnay/rust-toolchain@stable |
| 191 | + with: |
| 192 | + targets: riscv32i-unknown-none-elf |
| 193 | + - uses: Swatinem/rust-cache@v2 |
| 194 | + - env: |
| 195 | + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="custom" |
| 196 | + run: cargo build --target riscv32i-unknown-none-elf |
0 commit comments