|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master, '0.[0-9]+' ] |
| 6 | + pull_request: |
| 7 | + branches: [ master, '0.[0-9]+' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + check-doc: |
| 11 | + name: Check doc |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + - name: Install toolchain |
| 16 | + uses: actions-rs/toolchain@v1 |
| 17 | + with: |
| 18 | + profile: minimal |
| 19 | + toolchain: nightly |
| 20 | + override: true |
| 21 | + - run: cargo install cargo-deadlinks |
| 22 | + - name: doc (rand) |
| 23 | + env: |
| 24 | + RUSTDOCFLAGS: --cfg doc_cfg |
| 25 | + # --all builds all crates, but with default features for other crates (okay in this case) |
| 26 | + run: cargo deadlinks --ignore-fragments -- --all --features nightly,serde1,getrandom,small_rng |
| 27 | + |
| 28 | + test: |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + include: |
| 34 | + - os: ubuntu-latest |
| 35 | + target: x86_64-unknown-linux-gnu |
| 36 | + toolchain: stable |
| 37 | + - os: macos-latest |
| 38 | + target: x86_64-apple-darwin |
| 39 | + toolchain: stable |
| 40 | + # TODO: also aarch64 / M1 |
| 41 | + - os: windows-latest |
| 42 | + target: x86_64-pc-windows-gnu |
| 43 | + toolchain: stable |
| 44 | + - os: windows-latest |
| 45 | + target: x86_64-pc-windows-msvc |
| 46 | + toolchain: beta |
| 47 | + # Test both windows-gnu and windows-msvc; use beta rust on one |
| 48 | + - os: ubuntu-latest |
| 49 | + target: x86_64-unknown-linux-gnu |
| 50 | + toolchain: 1.36.0 # MSRV |
| 51 | + - os: ubuntu-latest |
| 52 | + deps: sudo apt install gcc-multilib |
| 53 | + target: i686-unknown-linux-gnu |
| 54 | + toolchain: nightly |
| 55 | + - os: ubuntu-latest |
| 56 | + target: x86_64-unknown-linux-gnu |
| 57 | + toolchain: nightly |
| 58 | + variant: minimal |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v2 |
| 62 | + - name: Install toolchain |
| 63 | + uses: actions-rs/toolchain@v1 |
| 64 | + with: |
| 65 | + profile: minimal |
| 66 | + target: ${{ matrix.target }} |
| 67 | + toolchain: ${{ matrix.toolchain }} |
| 68 | + override: true |
| 69 | + - run: ${{ matrix.deps }} |
| 70 | + - name: Maybe minimal |
| 71 | + if: ${{ matrix.variant == 'minimal' }} |
| 72 | + run: cargo generate-lockfile -Z minimal-versions |
| 73 | + - name: Maybe nightly |
| 74 | + if: ${{ matrix.toolchain == 'nightly' }} |
| 75 | + run: | |
| 76 | + cargo test --target ${{ matrix.target }} --tests --features=nightly |
| 77 | + cargo test --target ${{ matrix.target }} --all-features |
| 78 | + cargo test --target ${{ matrix.target }} --benches --features=nightly |
| 79 | + cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --benches |
| 80 | + - name: Test rand |
| 81 | + run: | |
| 82 | + cargo test --target ${{ matrix.target }} --tests --no-default-features |
| 83 | + cargo test --target ${{ matrix.target }} --tests --no-default-features --features=alloc,getrandom,small_rng |
| 84 | + # all stable features: |
| 85 | + cargo test --target ${{ matrix.target }} --features=serde1,log,small_rng |
| 86 | + cargo test --target ${{ matrix.target }} --examples |
| 87 | + - name: Test rand_core |
| 88 | + run: | |
| 89 | + cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml |
| 90 | + cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml --no-default-features |
| 91 | + cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc,getrandom |
| 92 | + - name: Test rand_distr |
| 93 | + run: cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml |
| 94 | + - name: Test rand_pcg |
| 95 | + run: cargo test --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde1 |
| 96 | + - name: Test rand_chacha |
| 97 | + run: cargo test --target ${{ matrix.target }} --manifest-path rand_chacha/Cargo.toml |
| 98 | + - name: Test rand_hc |
| 99 | + run: cargo test --target ${{ matrix.target }} --manifest-path rand_hc/Cargo.toml |
| 100 | + |
| 101 | + test-cross: |
| 102 | + runs-on: ${{ matrix.os }} |
| 103 | + strategy: |
| 104 | + fail-fast: false |
| 105 | + matrix: |
| 106 | + include: |
| 107 | + - os: ubuntu-latest |
| 108 | + target: mips-unknown-linux-gnu |
| 109 | + toolchain: stable |
| 110 | + |
| 111 | + steps: |
| 112 | + - uses: actions/checkout@v2 |
| 113 | + - name: Install toolchain |
| 114 | + uses: actions-rs/toolchain@v1 |
| 115 | + with: |
| 116 | + profile: minimal |
| 117 | + target: ${{ matrix.target }} |
| 118 | + toolchain: ${{ matrix.toolchain }} |
| 119 | + override: true |
| 120 | + - name: Cache cargo plugins |
| 121 | + uses: actions/cache@v1 |
| 122 | + with: |
| 123 | + path: ~/.cargo/bin/ |
| 124 | + key: ${{ runner.os }}-cargo-plugins |
| 125 | + - name: Install cross |
| 126 | + run: cargo install cross || true |
| 127 | + - name: Test |
| 128 | + run: | |
| 129 | + # all stable features: |
| 130 | + cross test --no-fail-fast --target ${{ matrix.target }} --features=serde1,log,small_rng |
| 131 | + cross test --no-fail-fast --target ${{ matrix.target }} --examples |
| 132 | + cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml |
| 133 | + cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml |
| 134 | + cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde1 |
| 135 | + cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_chacha/Cargo.toml |
| 136 | + cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_hc/Cargo.toml |
| 137 | +
|
| 138 | + test-miri: |
| 139 | + runs-on: ubuntu-latest |
| 140 | + steps: |
| 141 | + - uses: actions/checkout@v2 |
| 142 | + - name: Install toolchain |
| 143 | + run: | |
| 144 | + MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri) |
| 145 | + rustup default "$MIRI_NIGHTLY" |
| 146 | + rustup component add miri |
| 147 | + - name: Test rand |
| 148 | + run: | |
| 149 | + cargo miri test --no-default-features |
| 150 | + cargo miri test --features=log,small_rng |
| 151 | + cargo miri test --manifest-path rand_core/Cargo.toml |
| 152 | + cargo miri test --manifest-path rand_core/Cargo.toml --features=serde1 |
| 153 | + cargo miri test --manifest-path rand_core/Cargo.toml --no-default-features |
| 154 | + #cargo miri test --manifest-path rand_distr/Cargo.toml # no unsafe and lots of slow tests |
| 155 | + cargo miri test --manifest-path rand_pcg/Cargo.toml --features=serde1 |
| 156 | + cargo miri test --manifest-path rand_chacha/Cargo.toml --no-default-features |
| 157 | + cargo miri test --manifest-path rand_hc/Cargo.toml |
| 158 | +
|
| 159 | + test-no-std: |
| 160 | + runs-on: ubuntu-latest |
| 161 | + steps: |
| 162 | + - uses: actions/checkout@v2 |
| 163 | + - name: Install toolchain |
| 164 | + uses: actions-rs/toolchain@v1 |
| 165 | + with: |
| 166 | + profile: minimal |
| 167 | + toolchain: nightly |
| 168 | + target: thumbv6m-none-eabi |
| 169 | + override: true |
| 170 | + - name: Build top-level only |
| 171 | + run: cargo build --target=thumbv6m-none-eabi --no-default-features |
| 172 | + |
| 173 | + test-ios: |
| 174 | + runs-on: macos-latest |
| 175 | + steps: |
| 176 | + - uses: actions/checkout@v2 |
| 177 | + - name: Install toolchain |
| 178 | + uses: actions-rs/toolchain@v1 |
| 179 | + with: |
| 180 | + profile: minimal |
| 181 | + toolchain: nightly |
| 182 | + target: aarch64-apple-ios |
| 183 | + override: true |
| 184 | + - name: Build top-level only |
| 185 | + run: cargo build --target=aarch64-apple-ios |
0 commit comments