Skip to content

Commit

Permalink
Merge #149
Browse files Browse the repository at this point in the history
149: Switch CI to GitHub Actions r=cuviper a=cuviper



Co-authored-by: Josh Stone <[email protected]>
  • Loading branch information
bors[bot] and cuviper authored Apr 21, 2020
2 parents b3a21a0 + 3b4e082 commit 821007a
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 90 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: CI
on:
push:
branches:
- staging
- trying

jobs:

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [
1.31.0, # 2018!
1.32.0, # rand
1.34.0, # quickcheck, has_try_from
1.36.0, # alloc
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

# try a target with `BigDigit = u32`
i686:
name: Test (i686)
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-i686-unknown-linux-gnu
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v1
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Test
run: ./ci/test_full.sh

# try a target that doesn't have std at all, but does have alloc
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 "serde rand"

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 changes: 31 additions & 0 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
@@ -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.31.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 changes: 46 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PR
on:
pull_request:

jobs:

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.31.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
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version = "0.3.0-pre"
readme = "README.md"
build = "build.rs"
publish = false
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
edition = "2018"

[package.metadata.docs.rs]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![crate](https://img.shields.io/crates/v/num-bigint.svg)](https://crates.io/crates/num-bigint)
[![documentation](https://docs.rs/num-bigint/badge.svg)](https://docs.rs/num-bigint)
![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.31+-red.svg)
[![Travis status](https://travis-ci.org/rust-num/num-bigint.svg?branch=master)](https://travis-ci.org/rust-num/num-bigint)
[![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.31+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
[![build status](https://github.com/rust-num/num-bigint/workflows/master/badge.svg)](https://github.com/rust-num/num-bigint/actions)

Big integer types for Rust, `BigInt` and `BigUint`.

Expand Down
11 changes: 10 additions & 1 deletion bors.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
status = [
"continuous-integration/travis-ci/push",
"Test (1.31.0)",
"Test (1.32.0)",
"Test (1.34.0)",
"Test (1.36.0)",
"Test (stable)",
"Test (beta)",
"Test (nightly)",
"Test (i686)",
"No Std",
"Format",
]
12 changes: 5 additions & 7 deletions ci/rustup.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/sh
# Use rustup to locally run the same suite of tests as .travis.yml.
# (You should first install/update all versions listed below.)
# 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.31.0 1.32.0 1.34.0 1.36.0 stable beta nightly; do
run="rustup run $TRAVIS_RUST_VERSION"
$run cargo build --verbose
$run $PWD/ci/test_full.sh
ci=$(dirname $0)
for version in 1.31.0 1.32.0 1.34.0 1.36.0 stable beta nightly; do
rustup run "$version" "$ci/test_full.sh"
done
93 changes: 57 additions & 36 deletions ci/test_full.sh
Original file line number Diff line number Diff line change
@@ -1,60 +1,81 @@
#!/bin/bash

set -ex
set -e

echo Testing num-bigint on rustc ${TRAVIS_RUST_VERSION}
CRATE=num-bigint
MSRV=1.31

case "$TRAVIS_RUST_VERSION" in
1.31.*) STD_FEATURES="serde" ;;
1.3[23].*) STD_FEATURES="serde rand" ;;
*) STD_FEATURES="serde rand quickcheck" ;;
esac
get_rust_version() {
local array=($(rustc --version));
echo "${array[1]}";
return 0;
}
RUST_VERSION=$(get_rust_version)

case "$TRAVIS_RUST_VERSION" in
1.3[1-5].*) ;;
*) NO_STD_FEATURES="serde rand" ;;
esac
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

# num-bigint should build and test everywhere.
cargo build --verbose
cargo test --verbose
STD_FEATURES=(serde)
check_version 1.32 && STD_FEATURES+=(rand)
check_version 1.34 && STD_FEATURES+=(quickcheck)
check_version 1.36 && NO_STD_FEATURES=(serde rand)
echo "Testing supported features: ${STD_FEATURES[*]}"
if [ -n "${NO_STD_FEATURES[*]}" ]; then
echo " no_std supported features: ${NO_STD_FEATURES[*]}"
fi

set -x

# It should build with minimal features too.
cargo build --no-default-features --features="std"
cargo test --no-default-features --features="std"
# test the default with std
cargo build
cargo test

# Each isolated feature should also work everywhere.
for feature in $STD_FEATURES; do
cargo build --verbose --no-default-features --features="std $feature"
cargo test --verbose --no-default-features --features="std $feature"
# test each isolated feature with std
for feature in ${STD_FEATURES[*]}; do
cargo build --no-default-features --features="std $feature"
cargo test --no-default-features --features="std $feature"
done

# test all supported features together
cargo build --features="std $STD_FEATURES"
cargo test --features="std $STD_FEATURES"
# test all supported features with std
cargo build --no-default-features --features="std ${STD_FEATURES[*]}"
cargo test --no-default-features --features="std ${STD_FEATURES[*]}"

if test -n "${NO_STD_FEATURES:+true}"; then
# It should build with minimal features too.

if [ -n "${NO_STD_FEATURES[*]}" ]; then
# test minimal `no_std`
cargo build --no-default-features
cargo test --no-default-features

# Each isolated feature should also work everywhere.
for feature in $NO_STD_FEATURES; do
cargo build --verbose --no-default-features --features="$feature"
cargo test --verbose --no-default-features --features="$feature"
# test each isolated feature without std
for feature in ${NO_STD_FEATURES[*]}; do
cargo build --no-default-features --features="$feature"
cargo test --no-default-features --features="$feature"
done

# test all supported features together
cargo build --no-default-features --features="$NO_STD_FEATURES"
cargo test --no-default-features --features="$NO_STD_FEATURES"
# test all supported features without std
cargo build --no-default-features --features="${NO_STD_FEATURES[*]}"
cargo test --no-default-features --features="${NO_STD_FEATURES[*]}"
fi


# make sure benchmarks can be built and sanity-tested
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
cargo test --benches --all-features
if rustc --version | grep -q nightly; then
cargo test --all-features --benches
fi

case "$STD_FEATURES" in
case "${STD_FEATURES[*]}" in
*serde*) cargo test --manifest-path ci/big_serde/Cargo.toml ;;&
*rand*) cargo test --manifest-path ci/big_rand/Cargo.toml ;;&
*quickcheck*) cargo test --manifest-path ci/big_quickcheck/Cargo.toml ;;&
Expand Down

0 comments on commit 821007a

Please sign in to comment.