diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d6e8be9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,97 @@ +name: Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + target: x86_64-apple-darwin + toolchain: stable + # TODO: also aarch64 / M1 + - os: windows-latest + target: x86_64-pc-windows-gnu + toolchain: stable + - os: windows-latest + target: x86_64-pc-windows-msvc + toolchain: beta + # Test both windows-gnu and windows-msvc; use beta rust on one + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + toolchain: 1.36.0 # MSRV + - os: ubuntu-latest + deps: sudo apt-get update ; sudo apt install gcc-multilib + target: i686-unknown-linux-gnu + toolchain: nightly + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + toolchain: nightly + variant: minimal_versions + + steps: + - uses: actions/checkout@v2 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + target: ${{ matrix.target }} + toolchain: ${{ matrix.toolchain }} + override: true + - run: ${{ matrix.deps }} + - name: Maybe minimal versions + if: ${{ matrix.variant == 'minimal_versions' }} + run: cargo generate-lockfile -Z minimal-versions + - name: Test nightly + if: ${{ matrix.toolchain == 'nightly' }} + run: cargo test --target ${{ matrix.target }} --benches + - name: Test + run: cargo test + + test-cross: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: mips-unknown-linux-gnu + toolchain: stable + + steps: + - uses: actions/checkout@v2 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + target: ${{ matrix.target }} + toolchain: ${{ matrix.toolchain }} + override: true + - name: Cache cargo plugins + uses: actions/cache@v1 + with: + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-plugins + - name: Install cross + run: cargo install cross || true + - name: Test + run: cross test --no-fail-fast --target ${{ matrix.target }} + + test-miri: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install toolchain + run: | + MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri) + rustup default "$MIRI_NIGHTLY" + rustup component add miri + - name: Test + run: cargo miri test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5c2925..0000000 --- a/.travis.yml +++ /dev/null @@ -1,73 +0,0 @@ -language: rust -sudo: false -os: linux - -matrix: - include: - - rust: 1.32.0 - name: "Linux, 1.32.0" - script: - - cargo test - - - rust: stable - name: "Linux, stable" - - - rust: beta - name: "Linux, beta" - - - rust: nightly - name: "Linux, nightly, 64-bit" - script: - - cargo test --benches --examples - - - rust: nightly - name: "Linux, nightly, 32-bit" - env: TARGET=i686-unknown-linux-musl - install: - - rustup target add $TARGET - script: - - cargo test --target $TARGET --benches --examples - - # This target catches endianness issues - - rust: stable - sudo: required - dist: trusty - services: docker - name: "Linux (MIPS, big-endian)" - env: TARGET=mips-unknown-linux-gnu - install: - - sh ci/install.sh - - source ~/.cargo/env || true - script: - - cross test --target $TARGET - - # This target checks we really can build no_std binaries - - rust: nightly - name: "no_std platform test" - install: - - rustup target add thumbv6m-none-eabi - script: - # Test the top-level crate with all features: - - cargo build --target=thumbv6m-none-eabi - - - rust: nightly - name: "Miri, nightly" - script: - - sh ci/miri.sh - - - rust: nightly - name: "Linux, minimal versions" - script: - - cargo generate-lockfile -Z minimal-versions - - cargo test --benches --examples - -before_install: - - set -e - -script: - - cargo test - -after_script: set +e - -notifications: - email: false diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 8e636e1..0000000 --- a/ci/install.sh +++ /dev/null @@ -1,49 +0,0 @@ -# From https://github.com/japaric/trust - -set -ex - -main() { - local target= - if [ $TRAVIS_OS_NAME = linux ]; then - target=x86_64-unknown-linux-musl - sort=sort - else - target=x86_64-apple-darwin - sort=gsort # for `sort --sort-version`, from brew's coreutils. - fi - - # Builds for iOS are done on OSX, but require the specific target to be - # installed. - case $TARGET in - aarch64-apple-ios) - rustup target install aarch64-apple-ios - ;; - armv7-apple-ios) - rustup target install armv7-apple-ios - ;; - armv7s-apple-ios) - rustup target install armv7s-apple-ios - ;; - i386-apple-ios) - rustup target install i386-apple-ios - ;; - x86_64-apple-ios) - rustup target install x86_64-apple-ios - ;; - esac - - # This fetches latest stable release - local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ - | cut -d/ -f3 \ - | grep -E '^v[0.1.0-9.]+$' \ - | $sort --version-sort \ - | tail -n1) - curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- \ - --force \ - --git japaric/cross \ - --tag $tag \ - --target $target -} - -main diff --git a/ci/miri.sh b/ci/miri.sh deleted file mode 100644 index 8873a2c..0000000 --- a/ci/miri.sh +++ /dev/null @@ -1,10 +0,0 @@ -set -ex - -MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri) -echo "Installing latest nightly with Miri: $MIRI_NIGHTLY" -rustup default "$MIRI_NIGHTLY" - -rustup component add miri -cargo miri setup - -cargo miri test