11 RUSTUP_MAX_RETRIES: 10
16 runs-on: ubuntu-latest
19 - uses: actions/checkout@v2
22 rustup update nightly --no-self-update
23 rustup default nightly
24 rustup component add rustfmt
26 run: cargo fmt --all -- --check
29 name: "clippy on ${{ matrix.target }}"
30 runs-on: ubuntu-latest
35 # We shouldn't really have any OS-specific code, so think of this as a list of architectures
36 - x86_64-unknown-linux-gnu
37 - i686-unknown-linux-gnu
38 - i586-unknown-linux-gnu
39 - aarch64-unknown-linux-gnu
40 - armv7-unknown-linux-gnueabihf
41 - mips-unknown-linux-gnu
42 - mips64-unknown-linux-gnuabi64
43 - powerpc-unknown-linux-gnu
44 - powerpc64-unknown-linux-gnu
45 - riscv64gc-unknown-linux-gnu
46 - s390x-unknown-linux-gnu
47 - sparc64-unknown-linux-gnu
48 - wasm32-unknown-unknown
51 - uses: actions/checkout@v2
54 rustup update nightly --no-self-update
55 rustup default nightly
56 rustup target add ${{ matrix.target }}
57 rustup component add clippy
59 run: cargo clippy --all-targets --target ${{ matrix.target }}
62 name: "${{ matrix.target_feature }} on ${{ matrix.target }}"
63 runs-on: ${{ matrix.os }}
67 target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, i586-pc-windows-msvc, x86_64-unknown-linux-gnu, x86_64-apple-darwin]
68 # `default` means we use the default target config for the target,
69 # `native` means we run with `-Ctarget-cpu=native`, and anything else is
70 # an arg to `-Ctarget-feature`
71 target_feature: [default, native, +sse3, +ssse3, +sse4.1, +sse4.2, +avx, +avx2]
74 # The macos runners seem to only reliably support up to `avx`.
75 - { target: x86_64-apple-darwin, target_feature: +avx2 }
76 # These features are statically known to be present for all 64 bit
77 # macs, and thus are covered by the `default` test
78 - { target: x86_64-apple-darwin, target_feature: +sse3 }
79 - { target: x86_64-apple-darwin, target_feature: +ssse3 }
80 # -Ctarget-cpu=native sounds like bad-news if target != host
81 - { target: i686-pc-windows-msvc, target_feature: native }
82 - { target: i586-pc-windows-msvc, target_feature: native }
85 # Populate the `matrix.os` field
86 - { target: x86_64-apple-darwin, os: macos-latest }
87 - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
88 - { target: x86_64-pc-windows-msvc, os: windows-latest }
89 - { target: i686-pc-windows-msvc, os: windows-latest }
90 - { target: i586-pc-windows-msvc, os: windows-latest }
92 # These are globally available on all the other targets.
93 - { target: i586-pc-windows-msvc, target_feature: +sse, os: windows-latest }
94 - { target: i586-pc-windows-msvc, target_feature: +sse2, os: windows-latest }
96 # Annoyingly, the x86_64-unknown-linux-gnu runner *almost* always has
97 # avx512vl, but occasionally doesn't. Maybe one day we can enable it.
100 - uses: actions/checkout@v2
103 rustup update nightly --no-self-update
104 rustup default nightly
105 rustup target add ${{ matrix.target }}
107 - name: Configure RUSTFLAGS
110 case "${{ matrix.target_feature }}" in
114 echo "RUSTFLAGS=-Ctarget-cpu=native" >> $GITHUB_ENV
117 echo "RUSTFLAGS=-Ctarget-feature=${{ matrix.target_feature }}" >> $GITHUB_ENV
121 # Super useful for debugging why a SIGILL occurred.
122 - name: Dump target configuration and support
126 echo "Caveat: not all target features are expected to be logged"
128 echo "## Requested target configuration (RUSTFLAGS=$RUSTFLAGS)"
129 rustc --print=cfg --target=${{ matrix.target }} $RUSTFLAGS
131 echo "## Supported target configuration for --target=${{ matrix.target }}"
132 rustc --print=cfg --target=${{ matrix.target }} -Ctarget-cpu=native
134 echo "## Natively supported target configuration"
135 rustc --print=cfg -Ctarget-cpu=native
138 run: cargo test --verbose --target=${{ matrix.target }}
140 - name: Test (release)
141 run: cargo test --verbose --target=${{ matrix.target }} --release
144 name: "wasm (firefox, ${{ matrix.name }})"
145 runs-on: ubuntu-latest
149 - { name: default, RUSTFLAGS: "" }
150 - { name: simd128, RUSTFLAGS: "-C target-feature=+simd128" }
152 - uses: actions/checkout@v2
155 rustup update nightly --no-self-update
156 rustup default nightly
157 - name: Install wasm-pack
158 run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
160 run: wasm-pack test --firefox --headless crates/core_simd
162 RUSTFLAGS: ${{ matrix.rustflags }}
163 - name: Test (release)
164 run: wasm-pack test --firefox --headless crates/core_simd --release
166 RUSTFLAGS: ${{ matrix.rustflags }}
169 name: "${{ matrix.target }} (via cross)"
170 runs-on: ubuntu-latest
173 # TODO: Sadly, we cant configure target-feature in a meaningful way
174 # because `cross` doesn't tell qemu to enable any non-default cpu
175 # features, nor does it give us a way to do so.
177 # Ultimately, we'd like to do something like [rust-lang/stdarch][stdarch].
178 # This is a lot more complex... but in practice it's likely that we can just
179 # snarf the docker config from around [here][1000-dockerfiles].
181 # [stdarch]: https://github.com/rust-lang/stdarch/blob/a5db4eaf/.github/workflows/main.yml#L67
182 # [1000-dockerfiles]: https://github.com/rust-lang/stdarch/tree/a5db4eaf/ci/docker
186 - i586-unknown-linux-gnu
187 # 32-bit arm has a few idiosyncracies like having subnormal flushing
188 # to zero on by default. Ideally we'd set
189 - armv7-unknown-linux-gnueabihf
190 - aarch64-unknown-linux-gnu
191 # Note: The issue above means neither of these mips targets will use
192 # MSA (mips simd) but MIPS uses a nonstandard binary representation
193 # for NaNs which makes it worth testing on despite that.
194 - mips-unknown-linux-gnu
195 - mips64-unknown-linux-gnuabi64
196 - riscv64gc-unknown-linux-gnu
197 # TODO this test works, but it appears to time out
198 # - powerpc-unknown-linux-gnu
199 # TODO this test is broken, but it appears to be a problem with QEMU, not us.
200 # - powerpc64le-unknown-linux-gnu
201 # TODO enable this once a new version of cross is released
202 # - powerpc64-unknown-linux-gnu
205 - uses: actions/checkout@v2
208 rustup update nightly --no-self-update
209 rustup default nightly
210 rustup target add ${{ matrix.target }}
211 rustup component add rust-src
213 - name: Install Cross
214 # Equivalent to `cargo install cross`, but downloading a prebuilt
215 # binary. Ideally we wouldn't hardcode a version, but the version number
216 # being part of the tarball means we can't just use the download/latest
219 CROSS_URL=https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz
220 mkdir -p "$HOME/.bin"
221 curl -sfSL --retry-delay 10 --retry 5 "${CROSS_URL}" | tar zxf - -C "$HOME/.bin"
222 echo "$HOME/.bin" >> $GITHUB_PATH
225 run: cross test --verbose --target=${{ matrix.target }}
227 - name: Test (release)
228 run: cross test --verbose --target=${{ matrix.target }} --release
231 name: "Check cargo features (${{ matrix.features }} ${{ matrix.rustflags }})"
232 runs-on: ubuntu-latest
238 - "-Ctarget-feature=+avx512f" # AVX-512 uses packed bit masks, so enable it to test more code paths
242 - "--features generic_const_exprs"
243 - "--features std --features generic_const_exprs"
246 - uses: actions/checkout@v2
249 rustup update nightly --no-self-update
250 rustup default nightly
252 run: cargo check --all-targets --no-default-features ${{ matrix.features }}
254 RUSTFLAGS: ${{ matrix.rustflags }}