Skip to content

Commit 6682db1

Browse files
authored
Merge pull request #1073 from rust-random/work2
Migrate to GitHub Actions
2 parents eb02f0e + 33b8f37 commit 6682db1

File tree

24 files changed

+276
-358
lines changed

24 files changed

+276
-358
lines changed

.github/workflows/gh-pages.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: gh-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
deploy:
10+
name: GH-pages documentation
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Install toolchain
15+
uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: nightly
19+
override: true
20+
- name: doc (rand)
21+
env:
22+
RUSTDOCFLAGS: --cfg doc_cfg
23+
# --all builds all crates, but with default features for other crates (okay in this case)
24+
run: cargo doc --all --features nightly,serde1,getrandom,small_rng
25+
- name: Deploy
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
publish_dir: ./target/doc

.github/workflows/test.yml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master, '0.[0-9]+' ]
6+
pull_request:
7+
branches: [ master, '0.[0-9]+' ]
8+
9+
jobs:
10+
check-doc:
11+
name: Check doc
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Install toolchain
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
profile: minimal
19+
toolchain: nightly
20+
override: true
21+
- run: cargo install cargo-deadlinks
22+
- name: doc (rand)
23+
env:
24+
RUSTDOCFLAGS: --cfg doc_cfg
25+
# --all builds all crates, but with default features for other crates (okay in this case)
26+
run: cargo deadlinks --ignore-fragments -- --all --features nightly,serde1,getrandom,small_rng
27+
28+
test:
29+
runs-on: ${{ matrix.os }}
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- os: ubuntu-latest
35+
target: x86_64-unknown-linux-gnu
36+
toolchain: stable
37+
- os: macos-latest
38+
target: x86_64-apple-darwin
39+
toolchain: stable
40+
# TODO: also aarch64 / M1
41+
- os: windows-latest
42+
target: x86_64-pc-windows-gnu
43+
toolchain: stable
44+
- os: windows-latest
45+
target: x86_64-pc-windows-msvc
46+
toolchain: beta
47+
# Test both windows-gnu and windows-msvc; use beta rust on one
48+
- os: ubuntu-latest
49+
target: x86_64-unknown-linux-gnu
50+
toolchain: 1.36.0 # MSRV
51+
- os: ubuntu-latest
52+
deps: sudo apt install gcc-multilib
53+
target: i686-unknown-linux-gnu
54+
toolchain: nightly
55+
- os: ubuntu-latest
56+
target: x86_64-unknown-linux-gnu
57+
toolchain: nightly
58+
variant: minimal
59+
60+
steps:
61+
- uses: actions/checkout@v2
62+
- name: Install toolchain
63+
uses: actions-rs/toolchain@v1
64+
with:
65+
profile: minimal
66+
target: ${{ matrix.target }}
67+
toolchain: ${{ matrix.toolchain }}
68+
override: true
69+
- run: ${{ matrix.deps }}
70+
- name: Maybe minimal
71+
if: ${{ matrix.variant == 'minimal' }}
72+
run: cargo generate-lockfile -Z minimal-versions
73+
- name: Maybe nightly
74+
if: ${{ matrix.toolchain == 'nightly' }}
75+
run: |
76+
cargo test --target ${{ matrix.target }} --tests --features=nightly
77+
cargo test --target ${{ matrix.target }} --all-features
78+
cargo test --target ${{ matrix.target }} --benches --features=nightly
79+
cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --benches
80+
- name: Test rand
81+
run: |
82+
cargo test --target ${{ matrix.target }} --tests --no-default-features
83+
cargo test --target ${{ matrix.target }} --tests --no-default-features --features=alloc,getrandom,small_rng
84+
# all stable features:
85+
cargo test --target ${{ matrix.target }} --features=serde1,log,small_rng
86+
cargo test --target ${{ matrix.target }} --examples
87+
- name: Test rand_core
88+
run: |
89+
cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml
90+
cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml --no-default-features
91+
cargo test --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc,getrandom
92+
- name: Test rand_distr
93+
run: cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml
94+
- name: Test rand_pcg
95+
run: cargo test --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde1
96+
- name: Test rand_chacha
97+
run: cargo test --target ${{ matrix.target }} --manifest-path rand_chacha/Cargo.toml
98+
- name: Test rand_hc
99+
run: cargo test --target ${{ matrix.target }} --manifest-path rand_hc/Cargo.toml
100+
101+
test-cross:
102+
runs-on: ${{ matrix.os }}
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
include:
107+
- os: ubuntu-latest
108+
target: mips-unknown-linux-gnu
109+
toolchain: stable
110+
111+
steps:
112+
- uses: actions/checkout@v2
113+
- name: Install toolchain
114+
uses: actions-rs/toolchain@v1
115+
with:
116+
profile: minimal
117+
target: ${{ matrix.target }}
118+
toolchain: ${{ matrix.toolchain }}
119+
override: true
120+
- name: Cache cargo plugins
121+
uses: actions/cache@v1
122+
with:
123+
path: ~/.cargo/bin/
124+
key: ${{ runner.os }}-cargo-plugins
125+
- name: Install cross
126+
run: cargo install cross || true
127+
- name: Test
128+
run: |
129+
# all stable features:
130+
cross test --no-fail-fast --target ${{ matrix.target }} --features=serde1,log,small_rng
131+
cross test --no-fail-fast --target ${{ matrix.target }} --examples
132+
cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_core/Cargo.toml
133+
cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml
134+
cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde1
135+
cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_chacha/Cargo.toml
136+
cross test --no-fail-fast --target ${{ matrix.target }} --manifest-path rand_hc/Cargo.toml
137+
138+
test-miri:
139+
runs-on: ubuntu-latest
140+
steps:
141+
- uses: actions/checkout@v2
142+
- name: Install toolchain
143+
run: |
144+
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
145+
rustup default "$MIRI_NIGHTLY"
146+
rustup component add miri
147+
- name: Test rand
148+
run: |
149+
cargo miri test --no-default-features
150+
cargo miri test --features=log,small_rng
151+
cargo miri test --manifest-path rand_core/Cargo.toml
152+
cargo miri test --manifest-path rand_core/Cargo.toml --features=serde1
153+
cargo miri test --manifest-path rand_core/Cargo.toml --no-default-features
154+
#cargo miri test --manifest-path rand_distr/Cargo.toml # no unsafe and lots of slow tests
155+
cargo miri test --manifest-path rand_pcg/Cargo.toml --features=serde1
156+
cargo miri test --manifest-path rand_chacha/Cargo.toml --no-default-features
157+
cargo miri test --manifest-path rand_hc/Cargo.toml
158+
159+
test-no-std:
160+
runs-on: ubuntu-latest
161+
steps:
162+
- uses: actions/checkout@v2
163+
- name: Install toolchain
164+
uses: actions-rs/toolchain@v1
165+
with:
166+
profile: minimal
167+
toolchain: nightly
168+
target: thumbv6m-none-eabi
169+
override: true
170+
- name: Build top-level only
171+
run: cargo build --target=thumbv6m-none-eabi --no-default-features
172+
173+
test-ios:
174+
runs-on: macos-latest
175+
steps:
176+
- uses: actions/checkout@v2
177+
- name: Install toolchain
178+
uses: actions-rs/toolchain@v1
179+
with:
180+
profile: minimal
181+
toolchain: nightly
182+
target: aarch64-apple-ios
183+
override: true
184+
- name: Build top-level only
185+
run: cargo build --target=aarch64-apple-ios

.travis.yml

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

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ autobenches = true
1616
edition = "2018"
1717
include = ["src/", "LICENSE-*", "README.md", "CHANGELOG.md", "COPYRIGHT"]
1818

19-
[badges]
20-
travis-ci = { repository = "rust-random/rand" }
21-
appveyor = { repository = "rust-random/rand" }
22-
2319
[features]
2420
# Meta-features:
2521
default = ["std", "std_rng"]

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Rand
22

3-
[![Build Status](https://travis-ci.org/rust-random/rand.svg?branch=master)](https://travis-ci.org/rust-random/rand)
4-
[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-random/rand?svg=true)](https://ci.appveyor.com/project/rust-random/rand)
3+
[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions)
54
[![Crate](https://img.shields.io/crates/v/rand.svg)](https://crates.io/crates/rand)
65
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
76
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand)
@@ -104,8 +103,8 @@ greater, and 0.4 and 0.3 (since approx. June 2017) require Rustc version 1.15 or
104103
greater. Subsets of the Rand code may work with older Rust versions, but this is
105104
not supported.
106105

107-
Travis CI always has a build with a pinned version of Rustc matching the oldest
108-
supported Rust release. The current policy is that this can be updated in any
106+
Continuous Integration (CI) will always test the minimum supported Rustc version
107+
(the MSRV). The current policy is that this can be updated in any
109108
Rand release if required, but the change must be noted in the changelog.
110109

111110
## Crate Features

0 commit comments

Comments
 (0)