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. As a result, we still run that
101 - uses: actions/checkout@v2
104 rustup update nightly --no-self-update
105 rustup default nightly
106 rustup target add ${{ matrix.target }}
108 - name: Configure RUSTFLAGS
111 case "${{ matrix.target_feature }}" in
115 echo "RUSTFLAGS=-Ctarget-cpu=native" >> $GITHUB_ENV
118 echo "RUSTFLAGS=-Ctarget-feature=${{ matrix.target_feature }}" >> $GITHUB_ENV
122 # Super useful for debugging why a SIGILL occurred.
123 - name: Dump target configuration and support
127 echo "Caveat: not all target features are expected to be logged"
129 echo "## Requested target configuration (RUSTFLAGS=$RUSTFLAGS)"
130 rustc --print=cfg --target=${{ matrix.target }} $RUSTFLAGS
132 echo "## Supported target configuration for --target=${{ matrix.target }}"
133 rustc --print=cfg --target=${{ matrix.target }} -Ctarget-cpu=native
135 echo "## Natively supported target configuration"
136 rustc --print=cfg -Ctarget-cpu=native
139 run: cargo test --verbose --target=${{ matrix.target }}
141 - name: Test (release)
142 run: cargo test --verbose --target=${{ matrix.target }} --release
145 name: "${{ matrix.target }} (via cross)"
146 runs-on: ubuntu-latest
149 # TODO: Sadly, we cant configure target-feature in a meaningful way
150 # because `cross` doesn't tell qemu to enable any non-default cpu
151 # features, nor does it give us a way to do so.
153 # Ultimately, we'd like to do something like [rust-lang/stdarch][stdarch].
154 # This is a lot more complex... but in practice it's likely that we can just
155 # snarf the docker config from around [here][1000-dockerfiles].
157 # [stdarch]: https://github.com/rust-lang/stdarch/blob/a5db4eaf/.github/workflows/main.yml#L67
158 # [1000-dockerfiles]: https://github.com/rust-lang/stdarch/tree/a5db4eaf/ci/docker
162 - i586-unknown-linux-gnu
163 # 32-bit arm has a few idiosyncracies like having subnormal flushing
164 # to zero on by default. Ideally we'd set
165 - armv7-unknown-linux-gnueabihf
166 # Note: The issue above means neither of these mips targets will use
167 # MSA (mips simd) but MIPS uses a nonstandard binary representation
168 # for NaNs which makes it worth testing on despite that.
169 - mips-unknown-linux-gnu
170 - mips64-unknown-linux-gnuabi64
171 - riscv64gc-unknown-linux-gnu
174 - uses: actions/checkout@v2
177 rustup update nightly --no-self-update
178 rustup default nightly
179 rustup target add ${{ matrix.target }}
180 rustup component add rust-src
182 - name: Install Cross
183 # Equivalent to `cargo install cross`, but downloading a prebuilt
184 # binary. Ideally we wouldn't hardcode a version, but the version number
185 # being part of the tarball means we can't just use the download/latest
188 CROSS_URL=https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz
189 mkdir -p "$HOME/.bin"
190 curl -sfSL --retry-delay 10 --retry 5 "${CROSS_URL}" | tar zxf - -C "$HOME/.bin"
191 echo "$HOME/.bin" >> $GITHUB_PATH
194 run: cross test --verbose --target=${{ matrix.target }}
196 - name: Test (release)
197 run: cross test --verbose --target=${{ matrix.target }} --release