Migrate CI to GitHub Actions (#180)
This commit is contained in:
parent
2d899940a2
commit
6f11660dde
186
.github/workflows/tests.yml
vendored
Normal file
186
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,186 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request:
|
||||
branches: master
|
||||
schedule:
|
||||
- cron: "0 12 * * 1"
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUSTFLAGS: "-Dwarnings"
|
||||
|
||||
jobs:
|
||||
check-doc:
|
||||
name: Doc deadlinks
|
||||
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
|
||||
- run: cargo deadlinks -- --features custom
|
||||
|
||||
main-tests:
|
||||
name: Main tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
toolchain: [nightly, beta, stable, 1.34]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
override: true
|
||||
- run: cargo test
|
||||
- run: cargo test --features std
|
||||
- if: ${{ matrix.toolchain == 'nightly' }}
|
||||
run: cargo build --benches
|
||||
|
||||
linux-tests:
|
||||
name: Additional Linux targets
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [
|
||||
x86_64-unknown-linux-musl,
|
||||
i686-unknown-linux-gnu,
|
||||
i686-unknown-linux-musl,
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
target: ${{ matrix.target }}
|
||||
toolchain: stable
|
||||
override: true
|
||||
- run: sudo apt install gcc-multilib
|
||||
- run: cargo test --target ${{ matrix.target }}
|
||||
|
||||
windows-tests:
|
||||
name: Additional Windows targets
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain: [
|
||||
stable-x86_64-gnu,
|
||||
stable-i686-gnu,
|
||||
stable-i686-msvc,
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
override: true
|
||||
- run: cargo test
|
||||
|
||||
cross-tests:
|
||||
name: Cross tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
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 }}
|
||||
|
||||
build:
|
||||
name: Build-only
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [
|
||||
x86_64-sun-solaris,
|
||||
x86_64-unknown-freebsd,
|
||||
x86_64-fuchsia,
|
||||
x86_64-unknown-netbsd,
|
||||
x86_64-unknown-redox,
|
||||
x86_64-fortanix-unknown-sgx,
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
target: ${{ matrix.target }}
|
||||
toolchain: nightly
|
||||
override: true
|
||||
- name: Build
|
||||
run: cargo build --target ${{ matrix.target }}
|
||||
|
||||
build-rdrand:
|
||||
name: Build-only RDRAND
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
override: true
|
||||
- name: Cache cargo plugins
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/bin/
|
||||
key: ${{ runner.os }}-cargo-plugins
|
||||
- name: Install xbuild
|
||||
run: cargo install cargo-xbuild || true
|
||||
- name: UEFI
|
||||
run: cargo xbuild --features=rdrand --target x86_64-unknown-uefi
|
||||
- name: Hermit
|
||||
run: cargo xbuild --features=rdrand --target x86_64-unknown-hermit
|
||||
- name: L4Re
|
||||
run: cargo xbuild --features=rdrand --target x86_64-unknown-l4re-uclibc
|
||||
- name: VxWorks
|
||||
run: cargo xbuild --features=rdrand --target x86_64-wrs-vxworks
|
||||
|
||||
clippy-fmt:
|
||||
name: Clippy + rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
- name: clippy
|
||||
run: cargo clippy --all
|
||||
- name: fmt
|
||||
run: cargo fmt --all -- --check
|
214
.travis.yml
214
.travis.yml
@ -1,214 +0,0 @@
|
||||
language: rust
|
||||
os: linux
|
||||
dist: focal
|
||||
|
||||
env:
|
||||
global:
|
||||
# All of the supported x86 Linux targets
|
||||
- LINUX_TARGETS="x86_64-unknown-linux-gnu x86_64-unknown-linux-musl i686-unknown-linux-gnu i686-unknown-linux-musl"
|
||||
# Targets that we just build (rather than run and test)
|
||||
- STD_TARGETS="x86_64-sun-solaris x86_64-unknown-freebsd x86_64-fuchsia x86_64-unknown-netbsd x86_64-unknown-redox x86_64-fortanix-unknown-sgx"
|
||||
- NO_STD_TARGETS="x86_64-unknown-cloudabi x86_64-unknown-uefi x86_64-unknown-hermit x86_64-unknown-l4re-uclibc x86_64-uwp-windows-gnu x86_64-wrs-vxworks"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "Linux, 1.34.0"
|
||||
rust: 1.34.0
|
||||
|
||||
- name: "OSX, 1.34.0"
|
||||
rust: 1.34.0
|
||||
os: osx
|
||||
|
||||
- name: "Linux, stable"
|
||||
rust: stable
|
||||
|
||||
- name: "OSX+iOS, stable"
|
||||
rust: stable
|
||||
os: osx
|
||||
install:
|
||||
- rustup target add aarch64-apple-ios
|
||||
script:
|
||||
- cargo test
|
||||
- cargo build --target aarch64-apple-ios
|
||||
|
||||
- name: "Linux, beta"
|
||||
rust: beta
|
||||
|
||||
- name: "WASM via stdweb, wasm-bindgen and WASI"
|
||||
rust: stable
|
||||
addons:
|
||||
# firefox: latest
|
||||
chrome: stable
|
||||
install:
|
||||
- rustup target add wasm32-unknown-unknown
|
||||
- rustup target add wasm32-wasi
|
||||
# Get latest geckodriver
|
||||
- export VERSION=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r ".tag_name")
|
||||
- wget -O geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/$VERSION/geckodriver-$VERSION-linux64.tar.gz
|
||||
- tar -xzf geckodriver.tar.gz -C $HOME
|
||||
# Get latest chromedirver
|
||||
- export VERSION=$(wget -q -O - https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
|
||||
- wget -O chromedriver.zip https://chromedriver.storage.googleapis.com/$VERSION/chromedriver_linux64.zip
|
||||
- unzip chromedriver.zip -d $HOME
|
||||
# Get cargo-web
|
||||
# - export VERSION=0.6.26 # Pin version for stability
|
||||
# - wget -O cargo-web.gz https://github.com/koute/cargo-web/releases/download/$VERSION/cargo-web-x86_64-unknown-linux-gnu.gz
|
||||
# - gunzip cargo-web.gz
|
||||
# - chmod +x cargo-web
|
||||
# Get wasmtime
|
||||
- export VERSION=v0.19.0 # Pin version for stability
|
||||
- wget -O wasmtime.tar.xz https://github.com/CraneStation/wasmtime/releases/download/$VERSION/wasmtime-$VERSION-x86_64-linux.tar.xz
|
||||
- tar -xf wasmtime.tar.xz --strip-components=1
|
||||
# Get wasm-bindgen-test-runner which matches our wasm-bindgen version
|
||||
- export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version')
|
||||
- wget -O wasm-bindgen.tar.gz https://github.com/rustwasm/wasm-bindgen/releases/download/$VERSION/wasm-bindgen-$VERSION-x86_64-unknown-linux-musl.tar.gz
|
||||
- tar -xzf wasm-bindgen.tar.gz --strip-components=1
|
||||
# Place the runner binaries in our PATH
|
||||
- mv wasmtime wasm-bindgen-test-runner $HOME/.cargo/bin
|
||||
script:
|
||||
- cargo test --target wasm32-wasi
|
||||
# stdweb (wasm32-unknown-unknown) tests are currently broken (see https://github.com/koute/cargo-web/issues/243)
|
||||
# - cargo web test --features js --nodejs
|
||||
# - cargo web test --features js
|
||||
- cargo build --features js
|
||||
# wasm-bindgen (wasm32-unknown-unknown) tests (Node, Firefox, Chrome)
|
||||
- cargo test --target wasm32-unknown-unknown --features js
|
||||
- GECKODRIVER=$HOME/geckodriver
|
||||
cargo test --target wasm32-unknown-unknown --features js,test-in-browser
|
||||
- CHROMEDRIVER=$HOME/chromedriver
|
||||
cargo test --target wasm32-unknown-unknown --features js,test-in-browser
|
||||
|
||||
- name: "WASM via Emscripten"
|
||||
rust: stable
|
||||
env:
|
||||
- CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node
|
||||
- CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
|
||||
install:
|
||||
- rustup target add wasm32-unknown-emscripten
|
||||
- rustup target add asmjs-unknown-emscripten
|
||||
- export VERSION=2.0.2 # Pin version for stability
|
||||
- git clone https://github.com/emscripten-core/emsdk.git
|
||||
- ./emsdk/emsdk install $VERSION
|
||||
- ./emsdk/emsdk activate $VERSION
|
||||
- source ./emsdk/emsdk_env.sh
|
||||
script:
|
||||
- cargo test --target wasm32-unknown-emscripten
|
||||
# Prevent 'wasm2js does not support source maps yet' error.
|
||||
- RUSTFLAGS='-C debuginfo=0' cargo test --target asmjs-unknown-emscripten
|
||||
|
||||
|
||||
- &nightly_and_docs
|
||||
name: "Linux, nightly, docs"
|
||||
rust: nightly
|
||||
install:
|
||||
- rustup target add wasm32-unknown-unknown
|
||||
- cargo install cargo-deadlinks
|
||||
- cargo deadlinks -V
|
||||
script:
|
||||
# Check that setting various features does not break the build
|
||||
- cargo build --features=std
|
||||
- cargo build --features=custom
|
||||
# remove cached documentation, otherwise files from previous PRs can get included
|
||||
- rm -rf target/doc
|
||||
- cargo doc --no-deps --features=std,custom
|
||||
- cargo deadlinks --dir target/doc
|
||||
# Check that our tests pass in the default/minimal configuration
|
||||
- cargo test --tests --benches --features=std,custom
|
||||
- cargo generate-lockfile -Z minimal-versions
|
||||
- cargo test --tests --benches
|
||||
|
||||
- <<: *nightly_and_docs
|
||||
name: "OSX, nightly, docs"
|
||||
os: osx
|
||||
|
||||
- name: "cross-platform tests"
|
||||
rust: nightly
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
install:
|
||||
- echo $LINUX_TARGETS | xargs -n1 rustup target add
|
||||
script:
|
||||
# We run tests for all supported x86 Linux targets
|
||||
- echo $LINUX_TARGETS | xargs -t -n1 cargo test --target
|
||||
|
||||
- name: "cross-platform build only"
|
||||
rust: nightly
|
||||
install:
|
||||
- echo $STD_TARGETS | xargs -n1 rustup target add
|
||||
# For no_std targets
|
||||
- rustup component add rust-src
|
||||
- cargo --list | egrep "^\s*xbuild$" -q || cargo install cargo-xbuild
|
||||
script:
|
||||
# We test that getrandom builds for all targets
|
||||
- echo $STD_TARGETS | xargs -t -n1 cargo build --target
|
||||
- echo $NO_STD_TARGETS | xargs -t -n1 cargo xbuild --features=rdrand --target
|
||||
# also test minimum dependency versions are usable
|
||||
- cargo generate-lockfile -Z minimal-versions
|
||||
- echo $STD_TARGETS | xargs -t -n1 cargo build --target
|
||||
- echo $NO_STD_TARGETS | xargs -t -n1 cargo xbuild --features=rdrand --target
|
||||
|
||||
# Trust cross-built/emulated targets. We must repeat all non-default values.
|
||||
- name: "Linux (MIPS, big-endian)"
|
||||
env: TARGET=mips-unknown-linux-gnu
|
||||
rust: stable
|
||||
dist: trusty
|
||||
services: docker
|
||||
install:
|
||||
- sh utils/ci/install.sh
|
||||
- source ~/.cargo/env || true
|
||||
script:
|
||||
- bash utils/ci/script.sh
|
||||
|
||||
- name: "Android (ARMv7)"
|
||||
env: TARGET=armv7-linux-androideabi
|
||||
rust: stable
|
||||
dist: trusty
|
||||
services: docker
|
||||
install:
|
||||
- sh utils/ci/install.sh
|
||||
- source ~/.cargo/env || true
|
||||
script:
|
||||
- bash utils/ci/script.sh
|
||||
|
||||
- name: "rustfmt"
|
||||
rust: stable
|
||||
install:
|
||||
- rustup component add rustfmt
|
||||
script:
|
||||
- cargo fmt --all -- */*.rs --check
|
||||
|
||||
allow_failures:
|
||||
# Formatting errors should appear in Travis, but not break the build.
|
||||
- name: "rustfmt"
|
||||
|
||||
before_install:
|
||||
- set -e
|
||||
- rustup self update
|
||||
|
||||
before_script:
|
||||
- export RUSTFLAGS="-D warnings"
|
||||
|
||||
script:
|
||||
- cargo test
|
||||
|
||||
after_script: set +e
|
||||
|
||||
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
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- 0.1
|
53
appveyor.yml
53
appveyor.yml
@ -1,53 +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
|
||||
CHANNEL: 1.34.0
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
CHANNEL: stable
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
CHANNEL: nightly
|
||||
- TARGET: i686-pc-windows-msvc
|
||||
CHANNEL: nightly
|
||||
- TARGET: x86_64-pc-windows-gnu
|
||||
CHANNEL: nightly
|
||||
- TARGET: i686-pc-windows-gnu
|
||||
CHANNEL: nightly
|
||||
|
||||
install:
|
||||
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %CHANNEL%
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- rustc -V
|
||||
- cargo -V
|
||||
|
||||
build: false
|
||||
|
||||
test_script:
|
||||
- set RUSTFLAGS=-D warnings
|
||||
- cargo test
|
||||
- cargo test --examples
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- 0.1
|
@ -72,7 +72,7 @@ use core::num::NonZeroU32;
|
||||
///
|
||||
/// Now any user of `getrandom` (direct or indirect) on this target will use the
|
||||
/// registered function. As noted in the
|
||||
/// [top-level documentation](index.html#use-a-custom-implementation) this
|
||||
/// [top-level documentation](index.html#custom-implementations) this
|
||||
/// registration only has an effect on unsupported targets.
|
||||
#[macro_export]
|
||||
macro_rules! register_custom_getrandom {
|
||||
|
@ -1,41 +0,0 @@
|
||||
# From https://github.com/japaric/trust
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
local host=
|
||||
if [ $TRAVIS_OS_NAME = linux ]; then
|
||||
host=x86_64-unknown-linux-musl
|
||||
else
|
||||
host=x86_64-apple-darwin
|
||||
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
|
||||
|
||||
# Pin the Cross version to avoid breaking the CI
|
||||
local cross_version="v0.2.0"
|
||||
wget -O cross.tar.gz https://github.com/rust-embedded/cross/releases/download/${cross_version}/cross-${cross_version}-${host}.tar.gz
|
||||
tar -xzf cross.tar.gz
|
||||
rm -f cross.tar.gz
|
||||
mv ./cross $HOME/.cargo/bin
|
||||
}
|
||||
|
||||
main
|
@ -1,13 +0,0 @@
|
||||
# Derived from https://github.com/japaric/trust
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
cross test --target $TARGET
|
||||
cross test --target $TARGET --examples
|
||||
}
|
||||
|
||||
# we don't run the "test phase" when doing deploys
|
||||
if [ -z $TRAVIS_TAG ]; then
|
||||
main
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user