|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: 0.1 |
| 6 | + pull_request: |
| 7 | + branches: 0.1 |
| 8 | + schedule: |
| 9 | + - cron: "0 12 * * 1" |
| 10 | + |
| 11 | +env: |
| 12 | + CARGO_INCREMENTAL: 0 |
| 13 | + RUSTFLAGS: "-Dwarnings" |
| 14 | + |
| 15 | +jobs: |
| 16 | + check-doc: |
| 17 | + name: Docs, deadlinks, minimal dependencies |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - uses: actions-rs/toolchain@v1 |
| 22 | + with: |
| 23 | + profile: minimal |
| 24 | + toolchain: nightly # Needed for -Z minimal-versions |
| 25 | + override: true |
| 26 | + - name: Install precompiled cargo-deadlinks |
| 27 | + run: | |
| 28 | + export URL=$(curl -s https://api.github.com/repos/deadlinks/cargo-deadlinks/releases/latest | jq -r '.assets[] | select(.name | contains("cargo-deadlinks-linux")) | .browser_download_url') |
| 29 | + wget -O /tmp/cargo-deadlinks $URL |
| 30 | + chmod +x /tmp/cargo-deadlinks |
| 31 | + mv /tmp/cargo-deadlinks ~/.cargo/bin |
| 32 | + - run: cargo deadlinks -- --features=log,std |
| 33 | + - run: | |
| 34 | + cargo generate-lockfile -Z minimal-versions |
| 35 | + cargo test --features=log,std |
| 36 | +
|
| 37 | + main-tests: |
| 38 | + name: Main tests |
| 39 | + runs-on: ${{ matrix.os }} |
| 40 | + strategy: |
| 41 | + matrix: |
| 42 | + os: [ubuntu-latest, windows-latest] |
| 43 | + toolchain: [nightly, beta, stable, 1.34] |
| 44 | + # Only Test macOS on stable to reduce macOS CI jobs |
| 45 | + include: |
| 46 | + - os: macos-latest |
| 47 | + toolchain: stable |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v2 |
| 50 | + - uses: actions-rs/toolchain@v1 |
| 51 | + with: |
| 52 | + profile: minimal |
| 53 | + toolchain: ${{ matrix.toolchain }} |
| 54 | + override: true |
| 55 | + - run: cargo test |
| 56 | + - run: cargo test --features=std |
| 57 | + - run: cargo test --features=log |
| 58 | + - if: ${{ matrix.toolchain == 'nightly' }} |
| 59 | + run: cargo build --benches |
| 60 | + |
| 61 | + linux-tests: |
| 62 | + name: Additional Linux targets |
| 63 | + runs-on: ubuntu-latest |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + target: [ |
| 67 | + x86_64-unknown-linux-musl, |
| 68 | + i686-unknown-linux-gnu, |
| 69 | + i686-unknown-linux-musl, |
| 70 | + ] |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v2 |
| 73 | + - uses: actions-rs/toolchain@v1 |
| 74 | + with: |
| 75 | + profile: minimal |
| 76 | + target: ${{ matrix.target }} |
| 77 | + toolchain: stable |
| 78 | + - name: Install multilib |
| 79 | + # update is needed to fix the 404 error on install, see: |
| 80 | + # https://github.com/actions/virtual-environments/issues/675 |
| 81 | + run: | |
| 82 | + sudo apt-get update |
| 83 | + sudo apt-get install gcc-multilib |
| 84 | + - run: cargo test --target=${{ matrix.target }} --features=std |
| 85 | + |
| 86 | + # We can only Build/Link on these targets for now. |
| 87 | + # TODO: Run the iOS binaries in the simulator |
| 88 | + # TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac |
| 89 | + apple-tests: |
| 90 | + name: Additional Apple targets |
| 91 | + runs-on: macos-latest |
| 92 | + strategy: |
| 93 | + matrix: |
| 94 | + target: [ |
| 95 | + aarch64-apple-ios, |
| 96 | + x86_64-apple-ios, |
| 97 | + ] |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v2 |
| 100 | + - uses: actions-rs/toolchain@v1 |
| 101 | + with: |
| 102 | + profile: minimal |
| 103 | + target: ${{ matrix.target }} |
| 104 | + toolchain: stable |
| 105 | + - name: Build Tests |
| 106 | + run: cargo test --no-run --target=${{ matrix.target }} --features=std |
| 107 | + |
| 108 | + windows-tests: |
| 109 | + name: Additional Windows targets |
| 110 | + runs-on: windows-latest |
| 111 | + strategy: |
| 112 | + matrix: |
| 113 | + toolchain: [ |
| 114 | + stable-x86_64-gnu, |
| 115 | + stable-i686-gnu, |
| 116 | + stable-i686-msvc, |
| 117 | + ] |
| 118 | + steps: |
| 119 | + - uses: actions/checkout@v2 |
| 120 | + - name: Install toolchain |
| 121 | + uses: actions-rs/toolchain@v1 |
| 122 | + with: |
| 123 | + profile: minimal |
| 124 | + toolchain: ${{ matrix.toolchain }} |
| 125 | + override: true |
| 126 | + - run: cargo test --features=std |
| 127 | + |
| 128 | + # TODO: Add emscripten when it's working with Cross |
| 129 | + cross-tests: |
| 130 | + name: Cross Test |
| 131 | + runs-on: ubuntu-latest |
| 132 | + strategy: |
| 133 | + matrix: |
| 134 | + target: [ |
| 135 | + aarch64-unknown-linux-gnu, |
| 136 | + aarch64-linux-android, |
| 137 | + mips-unknown-linux-gnu, |
| 138 | + ] |
| 139 | + steps: |
| 140 | + - uses: actions/checkout@v2 |
| 141 | + - uses: actions-rs/toolchain@v1 |
| 142 | + with: |
| 143 | + profile: minimal |
| 144 | + target: ${{ matrix.target }} |
| 145 | + toolchain: stable |
| 146 | + - name: Install precompiled cross |
| 147 | + run: | |
| 148 | + export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url') |
| 149 | + wget -O /tmp/binaries.tar.gz $URL |
| 150 | + tar -C /tmp -xzf /tmp/binaries.tar.gz |
| 151 | + mv /tmp/cross ~/.cargo/bin |
| 152 | + - name: Test |
| 153 | + run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std |
| 154 | + |
| 155 | + cross-link: |
| 156 | + name: Cross Build/Link |
| 157 | + runs-on: ubuntu-latest |
| 158 | + strategy: |
| 159 | + matrix: |
| 160 | + target: [ |
| 161 | + x86_64-sun-solaris, |
| 162 | + x86_64-unknown-netbsd, |
| 163 | + ] |
| 164 | + steps: |
| 165 | + - uses: actions/checkout@v2 |
| 166 | + - uses: actions-rs/toolchain@v1 |
| 167 | + with: |
| 168 | + profile: minimal |
| 169 | + target: ${{ matrix.target }} |
| 170 | + toolchain: stable |
| 171 | + - name: Install precompiled cross |
| 172 | + run: | |
| 173 | + export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url') |
| 174 | + wget -O /tmp/binaries.tar.gz $URL |
| 175 | + tar -C /tmp -xzf /tmp/binaries.tar.gz |
| 176 | + mv /tmp/cross ~/.cargo/bin |
| 177 | + - name: Build Tests |
| 178 | + run: cross test --no-run --target=${{ matrix.target }} --features=std |
| 179 | + |
| 180 | + web-tests: |
| 181 | + name: Web tests |
| 182 | + runs-on: ubuntu-latest |
| 183 | + steps: |
| 184 | + - uses: actions/checkout@v2 |
| 185 | + - uses: actions-rs/toolchain@v1 |
| 186 | + with: |
| 187 | + profile: minimal |
| 188 | + target: wasm32-unknown-unknown |
| 189 | + toolchain: stable |
| 190 | + - name: Install precompiled wasm-bindgen-test-runner |
| 191 | + run: | |
| 192 | + export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version') |
| 193 | + wget -O /tmp/binaries.tar.gz https://github.com/rustwasm/wasm-bindgen/releases/download/$VERSION/wasm-bindgen-$VERSION-x86_64-unknown-linux-musl.tar.gz |
| 194 | + tar -C /tmp -xzf /tmp/binaries.tar.gz --strip-components=1 |
| 195 | + mv /tmp/wasm-bindgen-test-runner ~/.cargo/bin |
| 196 | + - name: Test (Node) |
| 197 | + run: cargo test --target=wasm32-unknown-unknown --features=wasm-bindgen |
| 198 | + - name: Test (Firefox) |
| 199 | + env: |
| 200 | + GECKODRIVER: /usr/bin/geckodriver |
| 201 | + run: cargo test --target=wasm32-unknown-unknown --features=test-in-browser |
| 202 | + - name: Test (Chrome) |
| 203 | + env: |
| 204 | + CHROMEDRIVER: /usr/bin/chromedriver |
| 205 | + run: cargo test --target=wasm32-unknown-unknown --features=test-in-browser |
| 206 | + - name: Build Tests (with dummy, without JS) |
| 207 | + run: cargo test --no-run --target=wasm32-unknown-unknown --features=dummy |
| 208 | + |
| 209 | + wasi-tests: |
| 210 | + name: WASI test |
| 211 | + runs-on: ubuntu-latest |
| 212 | + steps: |
| 213 | + - uses: actions/checkout@v2 |
| 214 | + - uses: actions-rs/toolchain@v1 |
| 215 | + with: |
| 216 | + profile: minimal |
| 217 | + target: wasm32-wasi |
| 218 | + toolchain: stable |
| 219 | + - name: Install precompiled wasmtime |
| 220 | + run: | |
| 221 | + export URL=$(curl -s https://api.github.com/repos/bytecodealliance/wasmtime/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-linux.tar.xz")) | .browser_download_url') |
| 222 | + wget -O /tmp/binaries.tar.xz $URL |
| 223 | + tar -C /tmp -xf /tmp/binaries.tar.xz --strip-components=1 |
| 224 | + mv /tmp/wasmtime ~/.cargo/bin |
| 225 | + - run: cargo test --target wasm32-wasi |
| 226 | + |
| 227 | + build: |
| 228 | + name: Build only |
| 229 | + runs-on: ubuntu-latest |
| 230 | + strategy: |
| 231 | + matrix: |
| 232 | + target: [ |
| 233 | + x86_64-unknown-freebsd, |
| 234 | + x86_64-fuchsia, |
| 235 | + x86_64-unknown-redox, |
| 236 | + x86_64-fortanix-unknown-sgx, |
| 237 | + ] |
| 238 | + steps: |
| 239 | + - uses: actions/checkout@v2 |
| 240 | + - uses: actions-rs/toolchain@v1 |
| 241 | + with: |
| 242 | + profile: minimal |
| 243 | + target: ${{ matrix.target }} |
| 244 | + toolchain: nightly # Required to build libc for Redox |
| 245 | + override: true |
| 246 | + - name: Build |
| 247 | + run: cargo build --target=${{ matrix.target }} --features=std |
| 248 | + |
| 249 | + build-std: |
| 250 | + name: Build-only (build-std) |
| 251 | + runs-on: ubuntu-latest |
| 252 | + steps: |
| 253 | + - uses: actions/checkout@v2 |
| 254 | + - name: Install toolchain |
| 255 | + uses: actions-rs/toolchain@v1 |
| 256 | + with: |
| 257 | + profile: minimal |
| 258 | + toolchain: nightly # Required to build libcore |
| 259 | + components: rust-src |
| 260 | + override: true |
| 261 | + - name: UEFI (RDRAND) |
| 262 | + run: cargo build -Z build-std=core --target=x86_64-unknown-uefi |
| 263 | + - name: Hermit (RDRAND) |
| 264 | + run: cargo build -Z build-std=core --target=x86_64-unknown-hermit |
| 265 | + - name: L4Re (RDRAND) |
| 266 | + run: cargo build -Z build-std=core --target=x86_64-unknown-l4re-uclibc |
| 267 | + - name: VxWorks |
| 268 | + run: cargo build -Z build-std=core --target=x86_64-wrs-vxworks |
| 269 | + |
| 270 | + clippy-fmt: |
| 271 | + name: Clippy + rustfmt |
| 272 | + runs-on: ubuntu-latest |
| 273 | + steps: |
| 274 | + - uses: actions/checkout@v1 |
| 275 | + - uses: actions-rs/toolchain@v1 |
| 276 | + with: |
| 277 | + profile: minimal |
| 278 | + # https://github.com/rust-lang/rust-clippy/pull/6379 added MSRV |
| 279 | + # support, so we need to use nightly until this is on stable. |
| 280 | + toolchain: nightly |
| 281 | + components: rustfmt, clippy |
| 282 | + override: true |
| 283 | + - name: clippy |
| 284 | + run: cargo clippy --all --features=std |
| 285 | + - name: fmt |
| 286 | + run: cargo fmt --all -- --check |
0 commit comments