Switch CI to GitHub Actions

This commit is contained in:
Josh Stone
2020-04-09 21:22:41 -07:00
parent bfcefc3dc2
commit b3e9d7fa67
9 changed files with 243 additions and 79 deletions
+98
View File
@@ -0,0 +1,98 @@
name: CI
on:
push:
branches:
- staging
- trying
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.8.0, 1.15.0, 1.20.0, 1.26.0, 1.31.0, stable, beta, nightly]
steps:
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Test
run: ./ci/test_full.sh
# i586 presents floating point challenges for lack of SSE/SSE2
i586:
name: Test (i586)
runs-on: ubuntu-latest
steps:
- name: System install
run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: i586-unknown-linux-gnu
- name: Checkout
uses: actions/checkout@v1
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --target i586-unknown-linux-gnu --all-features
# try a target that doesn't have std at all
no_std:
name: No Std
runs-on: ubuntu-latest
steps:
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: thumbv6m-none-eabi
- name: Checkout
uses: actions/checkout@v1
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --target thumbv6m-none-eabi --no-default-features --features i128
- name: Build (libm)
uses: actions-rs/cargo@v1
with:
command: build
args: --target thumbv6m-none-eabi --no-default-features --features libm
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: 1.42.0
profile: minimal
override: true
components: rustfmt
- name: Checkout
uses: actions/checkout@v2
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
+31
View File
@@ -0,0 +1,31 @@
name: master
on:
push:
branches:
- master
schedule:
- cron: '0 0 * * 0' # 00:00 Sunday
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.8.0, stable]
steps:
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Test
run: ./ci/test_full.sh
+46
View File
@@ -0,0 +1,46 @@
name: PR
on:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.8.0, stable]
steps:
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Test
run: ./ci/test_full.sh
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- name: Rust install
uses: actions-rs/toolchain@v1
with:
toolchain: 1.42.0
profile: minimal
override: true
components: rustfmt
- name: Checkout
uses: actions/checkout@v2
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
-52
View File
@@ -1,52 +0,0 @@
language: rust
sudo: false
rust:
- 1.8.0
- 1.15.0
- 1.20.0
- 1.26.0 # has_i128
- 1.31.0 # 2018!
- stable
- beta
- nightly
script:
- cargo build --verbose
- ./ci/test_full.sh
matrix:
include:
# i586 presents floating point challenges for lack of SSE/SSE2
- name: "i586"
rust: stable
env: TARGET=i586-unknown-linux-gnu
addons:
apt:
packages:
- gcc-multilib
before_script:
- rustup target add $TARGET
script:
- cargo test --verbose --target $TARGET --all-features
# try a target that doesn't have std at all
- name: "no_std"
rust: stable
env: TARGET=thumbv6m-none-eabi
before_script:
- rustup target add $TARGET
script:
- cargo build --verbose --target $TARGET --no-default-features --features i128
- cargo build --verbose --target $TARGET --no-default-features --features libm
- name: "rustfmt"
rust: 1.31.0
before_script:
- rustup component add rustfmt
script:
- cargo fmt --all -- --check
notifications:
email:
on_success: never
branches:
only:
- master
- next
- staging
- trying
+1 -1
View File
@@ -11,7 +11,7 @@ name = "num-traits"
version = "0.2.11"
readme = "README.md"
build = "build.rs"
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
[package.metadata.docs.rs]
features = ["std"]
+1 -1
View File
@@ -3,7 +3,7 @@
[![crate](https://img.shields.io/crates/v/num-traits.svg)](https://crates.io/crates/num-traits)
[![documentation](https://docs.rs/num-traits/badge.svg)](https://docs.rs/num-traits)
![minimum rustc 1.8](https://img.shields.io/badge/rustc-1.8+-red.svg)
[![Travis status](https://travis-ci.org/rust-num/num-traits.svg?branch=master)](https://travis-ci.org/rust-num/num-traits)
![build status](https://github.com/rust-num/num-traits/workflows/master/badge.svg)
Numeric traits for generic mathematics in Rust.
+11 -1
View File
@@ -1,3 +1,13 @@
status = [
"continuous-integration/travis-ci/push",
"Test (1.8.0)",
"Test (1.15.0)",
"Test (1.20.0)",
"Test (1.26.0)",
"Test (1.31.0)",
"Test (stable)",
"Test (beta)",
"Test (nightly)",
"Test (i586)",
"No Std",
"Format",
]
+5 -6
View File
@@ -1,11 +1,10 @@
#!/bin/sh
# Use rustup to locally run the same suite of tests as .travis.yml.
# (You should first install/update 1.8.0, stable, beta, and nightly.)
# Use rustup to locally run the same suite of tests as .github/workflows/
# (You should first install/update all of the versions below.)
set -ex
export TRAVIS_RUST_VERSION
for TRAVIS_RUST_VERSION in 1.8.0 1.15.0 1.20.0 stable beta nightly; do
run="rustup run $TRAVIS_RUST_VERSION"
$run $PWD/ci/test_full.sh
ci=$(dirname $0)
for version in 1.8.0 1.15.0 1.20.0 1.26.0 1.31.0 stable beta nightly; do
rustup run "$version" "$ci/test_full.sh"
done
+50 -18
View File
@@ -1,27 +1,59 @@
#!/bin/bash
set -ex
set -e
echo Testing num-traits on rustc ${TRAVIS_RUST_VERSION}
CRATE=num-traits
MSRV=1.8
# num-traits should build and test everywhere.
cargo build --verbose
cargo test --verbose
get_rust_version() {
local array=($(rustc --version));
echo "${array[1]}";
return 0;
}
RUST_VERSION=$(get_rust_version)
check_version() {
IFS=. read -ra rust <<< "$RUST_VERSION"
IFS=. read -ra want <<< "$1"
[[ "${rust[0]}" -gt "${want[0]}" ||
( "${rust[0]}" -eq "${want[0]}" &&
"${rust[1]}" -ge "${want[1]}" )
]]
}
echo "Testing $CRATE on rustc $RUST_VERSION"
if ! check_version $MSRV ; then
echo "The minimum for $CRATE is rustc $MSRV"
exit 1
fi
FEATURES=()
check_version 1.26 && FEATURES+=(i128)
check_version 1.27 && FEATURES+=(libm)
echo "Testing supported features: ${FEATURES[*]}"
set -x
# test the default
cargo build
cargo test
# test `no_std`
cargo build --verbose --no-default-features
cargo test --verbose --no-default-features
cargo build --no-default-features
cargo test --no-default-features
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable)$ ]]; then
# test `i128`
cargo build --verbose --features=i128
cargo test --verbose --features=i128
# test each isolated feature, with and without std
for feature in ${FEATURES[*]}; do
cargo build --no-default-features --features="std $feature"
cargo test --no-default-features --features="std $feature"
# test with std and libm (libm build fails on Rust 1.26 and earlier)
cargo build --verbose --features "libm"
cargo test --verbose --features "libm"
cargo build --no-default-features --features="$feature"
cargo test --no-default-features --features="$feature"
done
# test `no_std` with libm (libm build fails on Rust 1.26 and earlier)
cargo build --verbose --no-default-features --features "libm"
cargo test --verbose --no-default-features --features "libm"
fi
# test all supported features, with and without std
cargo build --features="std ${FEATURES[*]}"
cargo test --features="std ${FEATURES[*]}"
cargo build --features="${FEATURES[*]}"
cargo test --features="${FEATURES[*]}"