Skip to content

Commit bafa54c

Browse files
bors[bot]cuviper
andauthored
Merge #36
36: Switch CI to GitHub Actions r=cuviper a=cuviper Co-authored-by: Josh Stone <[email protected]>
2 parents 1b361d7 + d81b722 commit bafa54c

File tree

9 files changed

+205
-60
lines changed

9 files changed

+205
-60
lines changed

.github/workflows/ci.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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.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+
# This test crate is intentionally separate, because we need
51+
# independent features for no-std. (rust-lang/cargo#2589)
52+
args: --target thumbv6m-none-eabi --manifest-path check/Cargo.toml
53+
54+
fmt:
55+
name: Format
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Rust install
59+
uses: actions-rs/toolchain@v1
60+
with:
61+
toolchain: 1.42.0
62+
profile: minimal
63+
override: true
64+
components: rustfmt
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
- name: Check formatting
68+
uses: actions-rs/cargo@v1
69+
with:
70+
command: fmt
71+
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name = "num-derive"
1010
repository = "https://github.com/rust-num/num-derive"
1111
version = "0.3.0"
1212
readme = "README.md"
13-
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
13+
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
1414
edition = "2018"
1515

1616
[dependencies]

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-derive.svg)](https://crates.io/crates/num-derive)
44
[![documentation](https://docs.rs/num-derive/badge.svg)](https://docs.rs/num-derive)
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-derive.svg?branch=master)](https://travis-ci.org/rust-num/num-derive)
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-derive/workflows/master/badge.svg)](https://github.com/rust-num/num-derive/actions)
77

88
Procedural macros to derive numeric traits in Rust.
99

bors.toml

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

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 the rust 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 stable beta nightly; do
9-
run="rustup run $TRAVIS_RUST_VERSION"
10-
$run $PWD/ci/test_full.sh
11-
env FEATURES="full-syntax" $run $PWD/ci/test_full.sh
7+
ci=$(dirname $0)
8+
for version in 1.31.0 stable beta nightly; do
9+
rustup run "$version" "$ci/test_full.sh"
1210
done

ci/test_full.sh

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,47 @@
11
#!/bin/bash
22

3-
set -ex
3+
set -e
44

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

7-
# num-derive should build and test everywhere.
8-
cargo build --verbose --features="$FEATURES"
9-
cargo test --verbose --features="$FEATURES"
8+
get_rust_version() {
9+
local array=($(rustc --version));
10+
echo "${array[1]}";
11+
return 0;
12+
}
13+
RUST_VERSION=$(get_rust_version)
14+
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
29+
30+
FEATURES=(full-syntax)
31+
echo "Testing supported features: ${FEATURES[*]}"
32+
33+
set -x
34+
35+
# test the default
36+
cargo build
37+
cargo test
38+
39+
# test each isolated feature
40+
for feature in ${FEATURES[*]}; do
41+
cargo build --no-default-features --features="$feature"
42+
cargo test --no-default-features --features="$feature"
43+
done
44+
45+
# test all supported features
46+
cargo build --features="${FEATURES[*]}"
47+
cargo test --features="${FEATURES[*]}"

0 commit comments

Comments
 (0)