Skip to content

Commit 821007a

Browse files
bors[bot]cuviper
andauthored
Merge #149
149: Switch CI to GitHub Actions r=cuviper a=cuviper Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents b3a21a0 + 3b4e082 commit 821007a

File tree

9 files changed

+253
-90
lines changed

9 files changed

+253
-90
lines changed

.github/workflows/ci.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- staging
6+
- trying
7+
8+
jobs:
9+
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
rust: [
16+
1.31.0, # 2018!
17+
1.32.0, # rand
18+
1.34.0, # quickcheck, has_try_from
19+
1.36.0, # alloc
20+
stable,
21+
beta,
22+
nightly
23+
]
24+
steps:
25+
- name: Rust install
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
toolchain: ${{ matrix.rust }}
29+
profile: minimal
30+
override: true
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
- name: Build
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: build
37+
- name: Test
38+
run: ./ci/test_full.sh
39+
40+
# try a target with `BigDigit = u32`
41+
i686:
42+
name: Test (i686)
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: System install
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install gcc-multilib
49+
- name: Rust install
50+
uses: actions-rs/toolchain@v1
51+
with:
52+
toolchain: stable-i686-unknown-linux-gnu
53+
profile: minimal
54+
override: true
55+
- name: Checkout
56+
uses: actions/checkout@v1
57+
- name: Build
58+
uses: actions-rs/cargo@v1
59+
with:
60+
command: build
61+
- name: Test
62+
run: ./ci/test_full.sh
63+
64+
# try a target that doesn't have std at all, but does have alloc
65+
no_std:
66+
name: No Std
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Rust install
70+
uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: stable
73+
profile: minimal
74+
override: true
75+
target: thumbv6m-none-eabi
76+
- name: Checkout
77+
uses: actions/checkout@v1
78+
- name: Build
79+
uses: actions-rs/cargo@v1
80+
with:
81+
command: build
82+
args: --target thumbv6m-none-eabi --no-default-features --features "serde rand"
83+
84+
fmt:
85+
name: Format
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Rust install
89+
uses: actions-rs/toolchain@v1
90+
with:
91+
toolchain: 1.42.0
92+
profile: minimal
93+
override: true
94+
components: rustfmt
95+
- name: Checkout
96+
uses: actions/checkout@v2
97+
- name: Check formatting
98+
uses: actions-rs/cargo@v1
99+
with:
100+
command: fmt
101+
args: --all -- --check

.github/workflows/master.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: master
2+
on:
3+
push:
4+
branches:
5+
- master
6+
schedule:
7+
- cron: '0 0 * * 0' # 00:00 Sunday
8+
9+
jobs:
10+
11+
test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
rust: [1.31.0, stable]
17+
steps:
18+
- name: Rust install
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: ${{ matrix.rust }}
22+
profile: minimal
23+
override: true
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
- name: Build
27+
uses: actions-rs/cargo@v1
28+
with:
29+
command: build
30+
- name: Test
31+
run: ./ci/test_full.sh

.github/workflows/pr.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PR
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
7+
test:
8+
name: Test
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
rust: [1.31.0, stable]
13+
steps:
14+
- name: Rust install
15+
uses: actions-rs/toolchain@v1
16+
with:
17+
toolchain: ${{ matrix.rust }}
18+
profile: minimal
19+
override: true
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Build
23+
uses: actions-rs/cargo@v1
24+
with:
25+
command: build
26+
- name: Test
27+
run: ./ci/test_full.sh
28+
29+
fmt:
30+
name: Format
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Rust install
34+
uses: actions-rs/toolchain@v1
35+
with:
36+
toolchain: 1.42.0
37+
profile: minimal
38+
override: true
39+
components: rustfmt
40+
- name: Checkout
41+
uses: actions/checkout@v2
42+
- name: Check formatting
43+
uses: actions-rs/cargo@v1
44+
with:
45+
command: fmt
46+
args: --all -- --check

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ version = "0.3.0-pre"
1212
readme = "README.md"
1313
build = "build.rs"
1414
publish = false
15+
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
1516
edition = "2018"
1617

1718
[package.metadata.docs.rs]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![crate](https://img.shields.io/crates/v/num-bigint.svg)](https://crates.io/crates/num-bigint)
44
[![documentation](https://docs.rs/num-bigint/badge.svg)](https://docs.rs/num-bigint)
5-
![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.31+-red.svg)
6-
[![Travis status](https://travis-ci.org/rust-num/num-bigint.svg?branch=master)](https://travis-ci.org/rust-num/num-bigint)
5+
[![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)
6+
[![build status](https://github.com/rust-num/num-bigint/workflows/master/badge.svg)](https://github.com/rust-num/num-bigint/actions)
77

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

bors.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
status = [
2-
"continuous-integration/travis-ci/push",
2+
"Test (1.31.0)",
3+
"Test (1.32.0)",
4+
"Test (1.34.0)",
5+
"Test (1.36.0)",
6+
"Test (stable)",
7+
"Test (beta)",
8+
"Test (nightly)",
9+
"Test (i686)",
10+
"No Std",
11+
"Format",
312
]

ci/rustup.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#!/bin/sh
2-
# Use rustup to locally run the same suite of tests as .travis.yml.
3-
# (You should first install/update all versions listed below.)
2+
# Use rustup to locally run the same suite of tests as .github/workflows/
3+
# (You should first install/update all of the versions below.)
44

55
set -ex
66

7-
export TRAVIS_RUST_VERSION
8-
for TRAVIS_RUST_VERSION in 1.31.0 1.32.0 1.34.0 1.36.0 stable beta nightly; do
9-
run="rustup run $TRAVIS_RUST_VERSION"
10-
$run cargo build --verbose
11-
$run $PWD/ci/test_full.sh
7+
ci=$(dirname $0)
8+
for version in 1.31.0 1.32.0 1.34.0 1.36.0 stable beta nightly; do
9+
rustup run "$version" "$ci/test_full.sh"
1210
done

ci/test_full.sh

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,81 @@
11
#!/bin/bash
22

3-
set -ex
3+
set -e
44

5-
echo Testing num-bigint on rustc ${TRAVIS_RUST_VERSION}
5+
CRATE=num-bigint
6+
MSRV=1.31
67

7-
case "$TRAVIS_RUST_VERSION" in
8-
1.31.*) STD_FEATURES="serde" ;;
9-
1.3[23].*) STD_FEATURES="serde rand" ;;
10-
*) STD_FEATURES="serde rand quickcheck" ;;
11-
esac
8+
get_rust_version() {
9+
local array=($(rustc --version));
10+
echo "${array[1]}";
11+
return 0;
12+
}
13+
RUST_VERSION=$(get_rust_version)
1214

13-
case "$TRAVIS_RUST_VERSION" in
14-
1.3[1-5].*) ;;
15-
*) NO_STD_FEATURES="serde rand" ;;
16-
esac
15+
check_version() {
16+
IFS=. read -ra rust <<< "$RUST_VERSION"
17+
IFS=. read -ra want <<< "$1"
18+
[[ "${rust[0]}" -gt "${want[0]}" ||
19+
( "${rust[0]}" -eq "${want[0]}" &&
20+
"${rust[1]}" -ge "${want[1]}" )
21+
]]
22+
}
23+
24+
echo "Testing $CRATE on rustc $RUST_VERSION"
25+
if ! check_version $MSRV ; then
26+
echo "The minimum for $CRATE is rustc $MSRV"
27+
exit 1
28+
fi
1729

18-
# num-bigint should build and test everywhere.
19-
cargo build --verbose
20-
cargo test --verbose
30+
STD_FEATURES=(serde)
31+
check_version 1.32 && STD_FEATURES+=(rand)
32+
check_version 1.34 && STD_FEATURES+=(quickcheck)
33+
check_version 1.36 && NO_STD_FEATURES=(serde rand)
34+
echo "Testing supported features: ${STD_FEATURES[*]}"
35+
if [ -n "${NO_STD_FEATURES[*]}" ]; then
36+
echo " no_std supported features: ${NO_STD_FEATURES[*]}"
37+
fi
38+
39+
set -x
2140

22-
# It should build with minimal features too.
23-
cargo build --no-default-features --features="std"
24-
cargo test --no-default-features --features="std"
41+
# test the default with std
42+
cargo build
43+
cargo test
2544

26-
# Each isolated feature should also work everywhere.
27-
for feature in $STD_FEATURES; do
28-
cargo build --verbose --no-default-features --features="std $feature"
29-
cargo test --verbose --no-default-features --features="std $feature"
45+
# test each isolated feature with std
46+
for feature in ${STD_FEATURES[*]}; do
47+
cargo build --no-default-features --features="std $feature"
48+
cargo test --no-default-features --features="std $feature"
3049
done
3150

32-
# test all supported features together
33-
cargo build --features="std $STD_FEATURES"
34-
cargo test --features="std $STD_FEATURES"
51+
# test all supported features with std
52+
cargo build --no-default-features --features="std ${STD_FEATURES[*]}"
53+
cargo test --no-default-features --features="std ${STD_FEATURES[*]}"
3554

36-
if test -n "${NO_STD_FEATURES:+true}"; then
37-
# It should build with minimal features too.
55+
56+
if [ -n "${NO_STD_FEATURES[*]}" ]; then
57+
# test minimal `no_std`
3858
cargo build --no-default-features
3959
cargo test --no-default-features
4060

41-
# Each isolated feature should also work everywhere.
42-
for feature in $NO_STD_FEATURES; do
43-
cargo build --verbose --no-default-features --features="$feature"
44-
cargo test --verbose --no-default-features --features="$feature"
61+
# test each isolated feature without std
62+
for feature in ${NO_STD_FEATURES[*]}; do
63+
cargo build --no-default-features --features="$feature"
64+
cargo test --no-default-features --features="$feature"
4565
done
4666

47-
# test all supported features together
48-
cargo build --no-default-features --features="$NO_STD_FEATURES"
49-
cargo test --no-default-features --features="$NO_STD_FEATURES"
67+
# test all supported features without std
68+
cargo build --no-default-features --features="${NO_STD_FEATURES[*]}"
69+
cargo test --no-default-features --features="${NO_STD_FEATURES[*]}"
5070
fi
5171

72+
5273
# make sure benchmarks can be built and sanity-tested
53-
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
54-
cargo test --benches --all-features
74+
if rustc --version | grep -q nightly; then
75+
cargo test --all-features --benches
5576
fi
5677

57-
case "$STD_FEATURES" in
78+
case "${STD_FEATURES[*]}" in
5879
*serde*) cargo test --manifest-path ci/big_serde/Cargo.toml ;;&
5980
*rand*) cargo test --manifest-path ci/big_rand/Cargo.toml ;;&
6081
*quickcheck*) cargo test --manifest-path ci/big_quickcheck/Cargo.toml ;;&

0 commit comments

Comments
 (0)