about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThom Chiovoloni <chiovolonit@gmail.com>2020-10-07 01:39:56 -0700
committerThom Chiovoloni <chiovolonit@gmail.com>2020-10-07 09:02:34 -0700
commite8a7f474bbdf4002da52f853f2ff6d48c880be5e (patch)
treed5f853149aa2eca38a4a8a6017a2dab9df40c950
parenta1c327a034425b1cc44f47a825ab2dcbfdd24b22 (diff)
downloadrust-e8a7f474bbdf4002da52f853f2ff6d48c880be5e.tar.gz
rust-e8a7f474bbdf4002da52f853f2ff6d48c880be5e.zip
Rewrite (and improve) CI.
-rw-r--r--.github/workflows/ci.yml151
-rw-r--r--.travis.yml249
2 files changed, 184 insertions, 216 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000000..2104c74a4d9
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,151 @@
+name: CI
+
+on:
+  pull_request:
+  push:
+    branches:
+      - master
+
+env:
+  CARGO_NET_RETRY: 10
+  RUSTUP_MAX_RETRIES: 10
+
+jobs:
+  x86-tests:
+    name: "${{ matrix.target_feature }} on ${{ matrix.target }}"
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, i586-pc-windows-msvc, x86_64-unknown-linux-gnu, x86_64-apple-darwin]
+        # `default` means we use the default target config for the target,
+        # `native` means we run with `-Ctarget-cpu=native`, and anything else is
+        # an arg to `-Ctarget-feature`
+        target_feature: [default, native, +sse3, +ssse3, +sse4.1, +sse4.2, +avx, +avx2]
+
+        exclude:
+          # The macos runners seem to only reliably support up to `avx`.
+          - { target: x86_64-apple-darwin, target_feature: +avx2 }
+          # These features are statically known to be present for all 64 bit
+          # macs, and thus are covered by the `default` test
+          - { target: x86_64-apple-darwin, target_feature: +sse3 }
+          - { target: x86_64-apple-darwin, target_feature: +ssse3 }
+          # -Ctarget-cpu=native sounds like bad-news if target != host
+          - { target: i686-pc-windows-msvc, target_feature: native }
+          - { target: i586-pc-windows-msvc, target_feature: native }
+
+        include:
+          # Populate the `matrix.os` field
+          - { target: x86_64-apple-darwin,      os: macos-latest }
+          - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
+          - { target: x86_64-pc-windows-msvc,   os: windows-latest }
+          - { target: i686-pc-windows-msvc,     os: windows-latest }
+          - { target: i586-pc-windows-msvc,     os: windows-latest }
+
+          # These are globally available on all the other targets.
+          - { target: i586-pc-windows-msvc, target_feature: +sse, os: windows-latest }
+          - { target: i586-pc-windows-msvc, target_feature: +sse2, os: windows-latest }
+
+          # Annoyingly, the x86_64-unknown-linux-gnu runner *almost* always has
+          # avx512vl, but occasionally doesn't. As a result, we still run that
+          # one under travis.
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Setup Rust
+        run: |
+          rustup update nightly --no-self-update
+          rustup default nightly
+          rustup target add ${{ matrix.target }}
+
+      - name: Configure RUSTFLAGS
+        shell: bash
+        run: |
+          case "${{ matrix.target_feature }}" in
+            default)
+              ;;
+            native)
+              echo "RUSTFLAGS=-Ctarget-cpu=native" >> $GITHUB_ENV
+              ;;
+            *)
+              echo "RUSTFLAGS=-Ctarget-feature=${{ matrix.target_feature }}" >> $GITHUB_ENV
+              ;;
+          esac
+
+      # Super useful for debugging why a SIGILL occurred.
+      - name: Dump target configuration and support
+        run: |
+          rustc -Vv
+
+          echo "Caveat: not all target features are expected to be logged"
+
+          echo "## Requested target configuration (RUSTFLAGS=$RUSTFLAGS)"
+          rustc --print=cfg --target=${{ matrix.target }} $RUSTFLAGS
+
+          echo "## Supported target configuration for --target=${{ matrix.target }}"
+          rustc --print=cfg --target=${{ matrix.target }} -Ctarget-cpu=native
+
+          echo "## Natively supported target configuration"
+          rustc --print=cfg -Ctarget-cpu=native
+
+      - name: Test (debug)
+        run: cargo test --verbose --target=${{ matrix.target }}
+
+      - name: Test (release)
+        run: cargo test --verbose --target=${{ matrix.target }} --release
+
+  cross-tests:
+    name: "${{ matrix.target }} (via cross)"
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      # TODO: Sadly, we cant configure target-feature in a meaningful way
+      # because `cross` doesn't tell qemu to enable any non-default cpu
+      # features, nor does it give us a way to do so.
+      #
+      # Ultimately, we'd like to do something like [rust-lang/stdarch][stdarch].
+      # This is a lot more complex... but in practice it's likely that we can just
+      # snarf the docker config from around [here][1000-dockerfiles].
+      #
+      # [stdarch]: https://github.com/rust-lang/stdarch/blob/a5db4eaf/.github/workflows/main.yml#L67
+      # [1000-dockerfiles]: https://github.com/rust-lang/stdarch/tree/a5db4eaf/ci/docker
+
+      matrix:
+        target:
+          - i586-unknown-linux-gnu
+          # 32-bit arm has a few idiosyncracies like having subnormal flushing
+          # to zero on by default. Ideally we'd set
+          - armv7-unknown-linux-gnueabihf
+          # Note: The issue above means neither of these mips targets will use
+          # MSA (mips simd) but MIPS uses a nonstandard binary representation
+          # for NaNs which makes it worth testing on despite that.
+          - mips-unknown-linux-gnu
+          - mips64-unknown-linux-gnuabi64
+          - riscv64gc-unknown-linux-gnu
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Setup Rust
+        run: |
+          rustup update nightly --no-self-update
+          rustup default nightly
+          rustup target add ${{ matrix.target }}
+          rustup component add rust-src
+
+      - name: Install Cross
+        # Equivalent to `cargo install cross`, but downloading a prebuilt
+        # binary. Ideally we wouldn't hardcode a version, but the version number
+        # being part of the tarball means we can't just use the download/latest
+        # URL :(
+        run: |
+          CROSS_URL=https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz
+          mkdir -p "$HOME/.bin"
+          curl -sfSL --retry-delay 10 --retry 5 "${CROSS_URL}" | tar zxf - -C "$HOME/.bin"
+          echo "$HOME/.bin" >> $GITHUB_PATH
+
+      - name: Test (debug)
+        run: cross test --verbose --target=${{ matrix.target }}
+
+      - name: Test (release)
+        run: cross test --verbose --target=${{ matrix.target }} --release
+
diff --git a/.travis.yml b/.travis.yml
index b9df3638650..c1fda2e4f17 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,257 +5,74 @@ rust:
 matrix:
   fast_finish: true
   include:
-    # Linux (x86_64)
-
-    - name: "x86_64-unknown-linux-gnu"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-
-    - name: "x86_64-unknown-linux-gnu+sse"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=sse
-
-    - name: "x86_64-unknown-linux-gnu+sse2"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=sse2
-
-    - name: "x86_64-unknown-linux-gnu+sse3"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=sse3
-
-    - name: "x86_64-unknown-linux-gnu+sse4.1"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=sse4.1
-
-    - name: "x86_64-unknown-linux-gnu+sse4.2"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=sse4.2
-
-    - name: "x86_64-unknown-linux-gnu+avx"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=avx
-
-    - name: "x86_64-unknown-linux-gnu+avx2"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=avx2
-
-    - name: "x86_64-unknown-linux-gnu+avx512vl"
-      os: linux
-      arch: amd64
-      env:
-        - TARGET=x86_64-unknown-linux-gnu
-        - TARGET_FEATURE=avx512vl
-
     # Linux (aarch64)
-
-    - name: "aarch64-unknown-linux-gnu"
+    - name: "aarch64-unknown-linux-gnu (neon)"
       os: linux
       arch: arm64
-      env:
-        - TARGET=aarch64-unknown-linux-gnu
 
-    - name: "aarch64-unknown-linux-gnu+neon"
+    - name: "aarch64-unknown-linux-gnu (neon, sve)"
       os: linux
       arch: arm64
-      env:
-        - TARGET=aarch64-unknown-linux-gnu
-        - TARGET_FEATURE=neon
+      env: RUSTFLAGS=-Ctarget-feature=+sve
 
-    - name: "aarch64-unknown-linux-gnu+sve"
+    - name: "aarch64-unknown-linux-gnu (native, see log for cfg)"
       os: linux
       arch: arm64
-      env:
-        - TARGET=aarch64-unknown-linux-gnu
-        - TARGET_FEATURE=sve
-
-    # Linux (powerpc64)
+      env: RUSTFLAGS=-Ctarget-cpu=native
 
-    - name: "powerpc64le-unknown-linux-gnu"
+    # Linux (powerpc64le)
+    - name: "powerpc64le-unknown-linux-gnu (altivec, vsx, power8-*)"
       os: linux
       arch: ppc64le
-      env:
-        - TARGET=powerpc64le-unknown-linux-gnu
 
-    - name: "powerpc64le-unknown-linux-gnu+vsx"
+    - name: "powerpc64le-unknown-linux-gnu (native, see log for cfg)"
       os: linux
       arch: ppc64le
-      env:
-        - TARGET=powerpc64le-unknown-linux-gnu
-        - TARGET_FEATURE=vsx
-
-    # Windows (x86_64)
-
-    - name: "x86_64-pc-windows-msvc"
-      os: windows
-      arch: amd64
-      env: TARGET=x86_64-pc-windows-msvc
-    
-    # Windows (i686)
-
-    - name: "i686-pc-windows-msvc"
-      os: windows
-      env: TARGET=i686-pc-windows-msvc
-
-    - name: "i686-pc-windows-msvc+sse"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=sse
+      env: RUSTFLAGS=-Ctarget-cpu=native
 
-    - name: "i686-pc-windows-msvc+sse2"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=sse2
-
-    - name: "i686-pc-windows-msvc+sse3"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=sse3
-
-    - name: "i686-pc-windows-msvc+sse4.1"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=sse4.1
-
-    - name: "i686-pc-windows-msvc+sse4.2"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=sse4.2
-
-    - name: "i686-pc-windows-msvc+avx"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=avx
-
-    - name: "i686-pc-windows-msvc+avx2"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i686-pc-windows-msvc
-        - TARGET_FEATURE=avx2
-
-    # Windows (i586)
-
-    - name: "i586-pc-windows-msvc"
-      os: windows
-      env: TARGET=i586-pc-windows-msvc
-
-    - name: "i586-pc-windows-msvc+sse"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=sse
-
-    - name: "i586-pc-windows-msvc+sse2"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=sse2
-
-    - name: "i586-pc-windows-msvc+sse3"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=sse3
-
-    - name: "i586-pc-windows-msvc+sse4.1"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=sse4.1
-
-    - name: "i586-pc-windows-msvc+sse4.2"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=sse4.2
-
-    - name: "i586-pc-windows-msvc+avx"
-      os: windows
-      arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=avx
-
-    - name: "i586-pc-windows-msvc+avx2"
-      os: windows
+    # Linux (x86_64) (for AVX512, which sadly seems to only *usually* be present
+    # on the github actions linux runner...)
+    - name: "x86_64-unknown-linux-gnu+avx512vl"
+      os: linux
       arch: amd64
-      env:
-        - TARGET=i586-pc-windows-msvc
-        - TARGET_FEATURE=avx2
-
-    # OSX (x86_64)
+      env: RUSTFLAGS=-Ctarget-feature=+avx512vl
 
-    - name: "x86_64-apple-darwin"
-      os: osx
-      arch: amd64
-      env:
-        - TARGET=x86_64-apple-darwin
-    
     # WebAssembly (wasm-bindgen)
-
     - name: "wasm32-unknown-unknown (node, firefox, chrome)"
       os: linux
       arch: amd64
       addons:
         firefox: latest
-        chrome : stable
+        chrome: stable
       install:
         - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
       script:
         - wasm-pack test --node --firefox --chrome --headless crates/core_simd
-    
+        - wasm-pack test --node --firefox --chrome --headless crates/core_simd --release
+
     - name: "wasm32-unknown-unknown+simd128 (chrome)"
       os: linux
       arch: amd64
       addons:
-        chrome : stable
+        chrome: stable
       install:
         - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
       script:
-        - RUSTFLAGS="-C target-feature=+simd128"
+        - export RUSTFLAGS="-C target-feature=+simd128"
         - wasm-pack test --chrome --headless crates/core_simd
+        - wasm-pack test --chrome --headless crates/core_simd --release
 
 script:
-  - rustup target add $TARGET
-  - if [ -n "$TARGET_FEATURE" ]; then RUSTFLAGS="-C target-feature=+$TARGET_FEATURE"; fi
-  - cargo test -v --target $TARGET
+  - echo "## Requested target configuration (RUSTFLAGS=$RUSTFLAGS)"
+  - rustc --print=cfg $RUSTFLAGS
+
+  - echo "## Supported target configuration"
+  - rustc --print=cfg -Ctarget-cpu=native
+
+  - echo "\n---\n"
+
+  - echo "## Running tests (debug)"
+  - cargo test -v
+
+  - echo "## Running tests (release)"
+  - cargo test -v --release