diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 00000000000..ad9b0943d4f --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,29 @@ +name: gh-pages + +on: + push: + branches: + - master + +jobs: + deploy: + name: GH-pages documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: doc (rand) + env: + RUSTDOCFLAGS: --cfg doc_cfg + # --all builds all crates, but with default features for other crates (okay in this case) + run: cargo doc --all --features nightly,serde1,getrandom,small_rng + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./target/doc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..b130cde75a0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: Tests + +on: + push: + branches: [ master, '0.[0-9]+' ] + pull_request: + branches: [ master, '0.[0-9]+' ] + +jobs: + check-doc: + name: Check doc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - run: cargo install cargo-deadlinks + - name: doc (rand) + env: + RUSTDOCFLAGS: --cfg doc_cfg + # --all builds all crates, but with default features for other crates (okay in this case) + run: cargo deadlinks --ignore-fragments -- --all --features nightly,serde1,getrandom,small_rng + + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + toolchain: [stable, nightly] + steps: + - uses: actions/checkout@v2 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + - run: cargo test + - run: cargo test --all-features diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 35d755e3527..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,115 +0,0 @@ -language: rust -sudo: false - -# Since most OS-specific code has moved to the getrandom crate, we require -# few target-specific tests here. - -matrix: - include: - - rust: 1.36.0 - name: "Linux, 1.36.0" - os: linux - - - rust: stable - name: "Linux, stable" - - - rust: stable - name: "OSX+iOS, stable" - os: osx - install: - - rustup target add aarch64-apple-ios - script: - - bash utils/ci/script.sh - - cargo build --target=aarch64-apple-ios - - - rust: beta - name: "Linux, beta" - - - rust: nightly - os: linux - name: "Linux, nightly, docs" - env: NIGHTLY=1 - install: - - cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks - - cargo deadlinks -V - before_script: - - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH - script: - - bash utils/ci/script.sh - # remove cached documentation, otherwise files from previous PRs can get included - - rm -rf target/doc - - cargo doc --no-deps --all --all-features - - cargo deadlinks --dir target/doc - deploy: - local_dir: target/doc - provider: pages - skip_cleanup: true - github_token: $GITHUB_TOKEN - on: - branch: master - - # 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 utils/ci/install.sh - - source ~/.cargo/env || true - - # 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 --no-default-features - - - rust: nightly - name: "Linux, nightly (32-bit test)" - env: TARGET=i686-unknown-linux-musl - install: - - rustup target add $TARGET - - - rust: nightly - os: linux - name: "Miri, nightly" - script: - - sh utils/ci/miri.sh - - - rust: nightly - os: linux - name: "Minimal dep versions" - script: - - cargo generate-lockfile -Z minimal-versions - - bash utils/ci/script.sh - -before_install: - - set -e - - rustup self update - -script: - - bash utils/ci/script.sh - -after_script: set +e - -# Cache: this seems to do more harm than good -#cache: - #cargo: true - #directories: - #- .local/share/cargo-web - -#before_cache: - ## Travis can't cache files that are not readable by "others" - #- chmod -R a+r $HOME/.cargo - -env: - global: - secure: "BdDntVHSompN+Qxz5Rz45VI4ZqhD72r6aPl166FADlnkIwS6N6FLWdqs51O7G5CpoMXEDvyYrjmRMZe/GYLIG9cmqmn/wUrWPO+PauGiIuG/D2dmfuUNvSTRcIe7UQLXrfP3yyfZPgqsH6pSnNEVopquQKy3KjzqepgriOJtbyY=" - -notifications: - email: - on_success: never diff --git a/Cargo.toml b/Cargo.toml index 9284f3084fd..b6e87bab282 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,6 @@ autobenches = true edition = "2018" include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"] -[badges] -travis-ci = { repository = "rust-random/rand" } -appveyor = { repository = "rust-random/rand" } - [features] # Meta-features: default = ["std", "std_rng"] diff --git a/README.md b/README.md index 6d1db896ddd..3ca09b008b7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Rand -[![Build Status](https://travis-ci.org/rust-random/rand.svg?branch=master)](https://travis-ci.org/rust-random/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions) [![Crate](https://img.shields.io/crates/v/rand.svg)](https://crates.io/crates/rand) [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand) @@ -104,8 +103,8 @@ greater, and 0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or greater. Subsets of the Rand code may work with older Rust versions, but this is not supported. -Travis CI always has a build with a pinned version of Rustc matching the oldest -supported Rust release. The current policy is that this can be updated in any +Continuous Integration (CI) will always test the oldest supported Rustc version +(the MSRV). The current policy is that this can be updated in any Rand release if required, but the change must be noted in the changelog. ## Crate Features diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c7d35ef2b33..00000000000 --- a/appveyor.yml +++ /dev/null @@ -1,48 +0,0 @@ -environment: - - # At the time this was added AppVeyor was having troubles with checking - # revocation of SSL certificates of sites like static.rust-lang.org and what - # we think is crates.io. The libcurl HTTP client by default checks for - # revocation on Windows and according to a mailing list [1] this can be - # disabled. - # - # The `CARGO_HTTP_CHECK_REVOKE` env var here tells cargo to disable SSL - # revocation checking on Windows in libcurl. Note, though, that rustup, which - # we're using to download Rust here, also uses libcurl as the default backend. - # Unlike Cargo, however, rustup doesn't have a mechanism to disable revocation - # checking. To get rustup working we set `RUSTUP_USE_HYPER` which forces it to - # use the Hyper instead of libcurl backend. Both Hyper and libcurl use - # schannel on Windows but it appears that Hyper configures it slightly - # differently such that revocation checking isn't turned on by default. - # - # [1]: https://curl.haxx.se/mail/lib-2016-03/0202.html - RUSTUP_USE_HYPER: 1 - CARGO_HTTP_CHECK_REVOKE: false - - matrix: - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc -install: - - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --tests --no-default-features - - cargo test --tests --no-default-features --features=alloc,getrandom - - cargo test --features simd_support - # all stable features: - - cargo test --features=serde1,log - - cargo test --benches --features=nightly - - cargo test --examples - - cargo test --manifest-path rand_core/Cargo.toml - - cargo test --manifest-path rand_core/Cargo.toml --no-default-features - - cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc - - cargo test --manifest-path rand_distr/Cargo.toml - - cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1 - - cargo test --manifest-path rand_chacha/Cargo.toml - - cargo test --manifest-path rand_hc/Cargo.toml diff --git a/rand_chacha/Cargo.toml b/rand_chacha/Cargo.toml index 2a17aa172bc..703cc86ac9b 100644 --- a/rand_chacha/Cargo.toml +++ b/rand_chacha/Cargo.toml @@ -14,10 +14,6 @@ keywords = ["random", "rng", "chacha"] categories = ["algorithms", "no-std"] edition = "2018" -[badges] -travis-ci = { repository = "rust-random/rand" } -appveyor = { repository = "rust-random/rand" } - [dependencies] rand_core = { path = "../rand_core", version = "0.5" } ppv-lite86 = { version = "0.2.8", default-features = false, features = ["simd"] } diff --git a/rand_chacha/README.md b/rand_chacha/README.md index b1928fd9cc8..edd754d791e 100644 --- a/rand_chacha/README.md +++ b/rand_chacha/README.md @@ -1,7 +1,6 @@ # rand_chacha -[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions) [![Latest version](https://img.shields.io/crates/v/rand_chacha.svg)](https://crates.io/crates/rand_chacha) [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_chacha) diff --git a/rand_core/Cargo.toml b/rand_core/Cargo.toml index 4b85940ff70..831562689dc 100644 --- a/rand_core/Cargo.toml +++ b/rand_core/Cargo.toml @@ -14,10 +14,6 @@ keywords = ["random", "rng"] categories = ["algorithms", "no-std"] edition = "2018" -[badges] -travis-ci = { repository = "rust-random/rand" } -appveyor = { repository = "rust-random/rand" } - [features] std = ["alloc", "getrandom", "getrandom/std"] # use std library; should be default but for above bug alloc = [] # enables Vec and Box support without std diff --git a/rand_core/README.md b/rand_core/README.md index 78c8083fc82..aaec728672c 100644 --- a/rand_core/README.md +++ b/rand_core/README.md @@ -1,7 +1,6 @@ # rand_core -[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions) [![Latest version](https://img.shields.io/crates/v/rand_core.svg)](https://crates.io/crates/rand_core) [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_core) diff --git a/rand_distr/Cargo.toml b/rand_distr/Cargo.toml index fe40d179110..e6dc5462c24 100644 --- a/rand_distr/Cargo.toml +++ b/rand_distr/Cargo.toml @@ -15,10 +15,6 @@ categories = ["algorithms"] edition = "2018" include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"] -[badges] -travis-ci = { repository = "rust-random/rand" } -appveyor = { repository = "rust-random/rand" } - [dependencies] rand = { path = "..", version = "0.7", default-features = false } num-traits = { version = "0.2", default-features = false, features = ["libm"] } diff --git a/rand_distr/README.md b/rand_distr/README.md index 9a67e5b3f93..29b5fe0853e 100644 --- a/rand_distr/README.md +++ b/rand_distr/README.md @@ -1,7 +1,6 @@ # rand_distr -[![Build Status](https://travis-ci.org/rust-random/rand.svg?branch=master)](https://travis-ci.org/rust-random/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions) [![Latest version](https://img.shields.io/crates/v/rand_distr.svg)](https://crates.io/crates/rand_distr) [[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_distr) diff --git a/rand_distr/src/cauchy.rs b/rand_distr/src/cauchy.rs index ffe86d00a9b..1fadf0c6f61 100644 --- a/rand_distr/src/cauchy.rs +++ b/rand_distr/src/cauchy.rs @@ -160,7 +160,7 @@ mod test { let expected = [15.023088, -5.446413, 3.7092876, 3.112482]; for (a, b) in buf.iter().zip(expected.iter()) { let (a, b) = (*a, *b); - assert!((a - b).abs() < 1e-6, "expected: {} = {}", a, b); + assert!((a - b).abs() < 1e-5, "expected: {} = {}", a, b); } } } diff --git a/rand_hc/Cargo.toml b/rand_hc/Cargo.toml index 84f53f80cdd..048f9aaa208 100644 --- a/rand_hc/Cargo.toml +++ b/rand_hc/Cargo.toml @@ -14,9 +14,5 @@ keywords = ["random", "rng", "hc128"] categories = ["algorithms", "no-std"] edition = "2018" -[badges] -travis-ci = { repository = "rust-random/rand" } -appveyor = { repository = "rust-random/rand" } - [dependencies] rand_core = { path = "../rand_core", version = "0.5" } diff --git a/rand_hc/README.md b/rand_hc/README.md index 4d992fec0c5..87f1c8915c1 100644 --- a/rand_hc/README.md +++ b/rand_hc/README.md @@ -1,7 +1,6 @@ # rand_hc -[![Build Status](https://travis-ci.org/rust-random/rand.svg)](https://travis-ci.org/rust-random/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions) [![Latest version](https://img.shields.io/crates/v/rand_hc.svg)](https://crates.io/crates/rand_hc) [[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_hc) diff --git a/rand_pcg/Cargo.toml b/rand_pcg/Cargo.toml index 9eb2eaf51e1..33e65c547dd 100644 --- a/rand_pcg/Cargo.toml +++ b/rand_pcg/Cargo.toml @@ -14,10 +14,6 @@ keywords = ["random", "rng", "pcg"] categories = ["algorithms", "no-std"] edition = "2018" -[badges] -travis-ci = { repository = "rust-random/rand" } -appveyor = { repository = "rust-random/rand" } - [features] serde1 = ["serde"] diff --git a/rand_pcg/README.md b/rand_pcg/README.md index 97204213c8d..736a789035c 100644 --- a/rand_pcg/README.md +++ b/rand_pcg/README.md @@ -1,7 +1,6 @@ # rand_pcg -[![Build Status](https://travis-ci.org/rust-random/rand.svg?branch=master)](https://travis-ci.org/rust-random/rand) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand) +[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions) [![Latest version](https://img.shields.io/crates/v/rand_pcg.svg)](https://crates.io/crates/rand_pcg) [![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/) [![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/rand_pcg) diff --git a/utils/ci/install.sh b/utils/ci/install.sh deleted file mode 100644 index 8e636e18175..00000000000 --- a/utils/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/utils/ci/install_cargo_web.sh b/utils/ci/install_cargo_web.sh deleted file mode 100755 index b35f0691984..00000000000 --- a/utils/ci/install_cargo_web.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -euo pipefail -IFS=$'\n\t' - -CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest) -CARGO_WEB_VERSION=$(echo $CARGO_WEB_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') -CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/$CARGO_WEB_VERSION/cargo-web-x86_64-unknown-linux-gnu.gz" - -echo "Downloading cargo-web from: $CARGO_WEB_URL" -curl -L $CARGO_WEB_URL | gzip -d > cargo-web -chmod +x cargo-web - -mkdir -p ~/.cargo/bin -mv cargo-web ~/.cargo/bin diff --git a/utils/ci/miri.sh b/utils/ci/miri.sh deleted file mode 100644 index 7e06091ff32..00000000000 --- a/utils/ci/miri.sh +++ /dev/null @@ -1,18 +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 --no-default-features -cargo miri test --features=log -cargo miri test --manifest-path rand_core/Cargo.toml -cargo miri test --manifest-path rand_core/Cargo.toml --features=serde1 -cargo miri test --manifest-path rand_core/Cargo.toml --no-default-features -#cargo miri test --manifest-path rand_distr/Cargo.toml # no unsafe and lots of slow tests -cargo miri test --manifest-path rand_pcg/Cargo.toml --features=serde1 -cargo miri test --manifest-path rand_chacha/Cargo.toml --no-default-features -cargo miri test --manifest-path rand_hc/Cargo.toml diff --git a/utils/ci/script.sh b/utils/ci/script.sh deleted file mode 100644 index caef0767ca9..00000000000 --- a/utils/ci/script.sh +++ /dev/null @@ -1,59 +0,0 @@ -# Derived from https://github.com/japaric/trust - -set -ex - -# ----- Options ----- - -# TARGET enables cross-building -if [ -z $TARGET ]; then - CARGO=cargo -elif [ "$TARGET" = "i686-unknown-linux-musl" ]; then - CARGO=cargo - TARGET="--target $TARGET" -else - CARGO=cross - TARGET="--target $TARGET" -fi - -# ALLOC defaults on; is disabled for rustc < 1.36 -if [ -z $ALLOC ]; then - ALLOC=1 -fi - -# NIGHTLY defaults off - - -# ----- Script ----- - -main() { - if [ "0$NIGHTLY" -ge 1 ]; then - $CARGO test $TARGET --all-features - $CARGO test $TARGET --benches --features=nightly - $CARGO test $TARGET --manifest-path rand_distr/Cargo.toml --benches - else - # all stable features: - $CARGO test $TARGET --features=serde1,log,small_rng - fi - - if [ "$ALLOC" -ge 1 ]; then - $CARGO test $TARGET --tests --no-default-features --features=alloc,getrandom,small_rng - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc - fi - - $CARGO test $TARGET --tests --no-default-features - $CARGO test $TARGET --examples - - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=getrandom - - $CARGO test $TARGET --manifest-path rand_distr/Cargo.toml - $CARGO test $TARGET --manifest-path rand_pcg/Cargo.toml --features=serde1 - $CARGO test $TARGET --manifest-path rand_chacha/Cargo.toml - $CARGO test $TARGET --manifest-path rand_hc/Cargo.toml -} - -# we don't run the "test phase" when doing deploys -if [ -z $TRAVIS_TAG ]; then - main -fi