Skip to content

Commit 1feb8d6

Browse files
authored
Try #33:
2 parents cd3a827 + cba0dac commit 1feb8d6

File tree

9 files changed

+216
-63
lines changed

9 files changed

+216
-63
lines changed

.github/workflows/ci.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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: [1.8.0, 1.15.0, 1.20.0, 1.26.0, 1.31.0, stable, beta, nightly]
16+
steps:
17+
- name: Rust install
18+
uses: actions-rs/toolchain@v1
19+
with:
20+
toolchain: ${{ matrix.rust }}
21+
profile: minimal
22+
override: true
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- name: Build
26+
uses: actions-rs/cargo@v1
27+
with:
28+
command: build
29+
- name: Test
30+
run: ./ci/test_full.sh
31+
32+
# try a target that doesn't have std at all
33+
no_std:
34+
name: No Std
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Rust install
38+
uses: actions-rs/toolchain@v1
39+
with:
40+
toolchain: stable
41+
profile: minimal
42+
override: true
43+
target: thumbv6m-none-eabi
44+
- name: Checkout
45+
uses: actions/checkout@v1
46+
- name: Build
47+
uses: actions-rs/cargo@v1
48+
with:
49+
command: build
50+
args: --target thumbv6m-none-eabi --no-default-features --features i128
51+
52+
fmt:
53+
name: Format
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Rust install
57+
uses: actions-rs/toolchain@v1
58+
with:
59+
toolchain: 1.42.0
60+
profile: minimal
61+
override: true
62+
components: rustfmt
63+
- name: Checkout
64+
uses: actions/checkout@v2
65+
- name: Check formatting
66+
uses: actions-rs/cargo@v1
67+
with:
68+
command: fmt
69+
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.8.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.8.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 & 39 deletions
This file was deleted.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name = "num-integer"
1111
version = "0.1.42"
1212
readme = "README.md"
1313
build = "build.rs"
14-
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
14+
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
1515

1616
[package.metadata.docs.rs]
1717
features = ["std"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![crate](https://img.shields.io/crates/v/num-integer.svg)](https://crates.io/crates/num-integer)
44
[![documentation](https://docs.rs/num-integer/badge.svg)](https://docs.rs/num-integer)
55
![minimum rustc 1.8](https://img.shields.io/badge/rustc-1.8+-red.svg)
6-
[![Travis status](https://travis-ci.org/rust-num/num-integer.svg?branch=master)](https://travis-ci.org/rust-num/num-integer)
6+
![build status](https://github.com/rust-num/num-integer/workflows/master/badge.svg)
77

88
`Integer` trait and functions for Rust.
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.8.0)",
3+
"Test (1.15.0)",
4+
"Test (1.20.0)",
5+
"Test (1.26.0)",
6+
"Test (1.31.0)",
7+
"Test (stable)",
8+
"Test (beta)",
9+
"Test (nightly)",
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 1.8.0, stable, beta, and nightly.)
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.8.0 1.15.0 1.20.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.8.0 1.15.0 1.20.0 1.26.0 1.31.0 stable beta nightly; do
9+
rustup run "$version" "$ci/test_full.sh"
1210
done

ci/test_full.sh

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,62 @@
11
#!/bin/bash
22

3-
set -ex
3+
set -e
44

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

7-
# num-integer should build and test everywhere.
8-
cargo build --verbose
9-
cargo test --verbose
8+
get_rust_version() {
9+
local array=($(rustc --version));
10+
echo "${array[1]}";
11+
return 0;
12+
}
13+
RUST_VERSION=$(get_rust_version)
1014

11-
# test `no_std`
12-
cargo build --verbose --no-default-features
13-
cargo test --verbose --no-default-features
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+
}
1423

15-
# test `i128`
16-
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable)$ ]]; then
17-
cargo build --verbose --features=i128
18-
cargo test --verbose --features=i128
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
1928
fi
2029

21-
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
22-
cargo test --verbose --all-features --benches
30+
FEATURES=()
31+
check_version 1.26 && FEATURES+=(i128)
32+
echo "Testing supported features: ${FEATURES[*]}"
33+
34+
set -x
35+
36+
# test the default
37+
cargo build
38+
cargo test
39+
40+
# test `no_std`
41+
cargo build --no-default-features
42+
cargo test --no-default-features
43+
44+
# test each isolated feature, with and without std
45+
for feature in ${FEATURES[*]}; do
46+
cargo build --no-default-features --features="std $feature"
47+
cargo test --no-default-features --features="std $feature"
48+
49+
cargo build --no-default-features --features="$feature"
50+
cargo test --no-default-features --features="$feature"
51+
done
52+
53+
# test all supported features, with and without std
54+
cargo build --features="std ${FEATURES[*]}"
55+
cargo test --features="std ${FEATURES[*]}"
56+
57+
cargo build --features="${FEATURES[*]}"
58+
cargo test --features="${FEATURES[*]}"
59+
60+
if rustc --version | grep -q nightly; then
61+
cargo test --all-features --benches
2362
fi

0 commit comments

Comments
 (0)