Skip to content

Commit 73ade1e

Browse files
committed
Migrate CI to GitHub Actions
1 parent bde29da commit 73ade1e

File tree

6 files changed

+240
-211
lines changed

6 files changed

+240
-211
lines changed

.github/workflows/ci.yml

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: '0 1 * * *'
10+
11+
env:
12+
RUSTFLAGS: -D warnings
13+
RUST_BACKTRACE: 1
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
test:
21+
name: cargo +${{ matrix.rust }} test (${{ matrix.os }})
22+
strategy:
23+
matrix:
24+
rust:
25+
- nightly
26+
os:
27+
- ubuntu-latest
28+
- macos-latest
29+
- windows-latest
30+
runs-on: ${{ matrix.os }}
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Install Rust
34+
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
35+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
36+
- run: cargo test --workspace --all-features
37+
- run: cargo test --workspace --all-features --release
38+
39+
core-msrv:
40+
name: cargo +${{ matrix.rust }} build (futures-{core, io, sink, task, channel})
41+
strategy:
42+
matrix:
43+
rust:
44+
# This is the minimum Rust version supported by futures-core, futures-io, futures-sink, futures-task, futures-channel.
45+
# When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.
46+
- 1.36.0
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: Install Rust
51+
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
52+
# cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead.
53+
# Refs: cargo#3620, cargo#4106, cargo#4463, cargo#4753, cargo#5015, cargo#5364, cargo#6195
54+
- run: cargo install cargo-hack
55+
# remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
56+
- run: cargo hack --remove-dev-deps --workspace
57+
# Check no-default-features
58+
- run: |
59+
cargo hack build --workspace --ignore-private --no-default-features \
60+
--exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test
61+
# Check alloc feature
62+
- run: |
63+
cargo hack build --workspace --ignore-private --no-default-features --features alloc --ignore-unknown-features \
64+
--exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test
65+
# Check std feature
66+
- run: |
67+
cargo hack build --workspace --ignore-private --no-default-features --features std \
68+
--exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test
69+
70+
util-msrv:
71+
name: cargo +${{ matrix.rust }} build
72+
strategy:
73+
matrix:
74+
rust:
75+
# This is the minimum Rust version supported by futures, futures-util, futures-macro, futures-executor, futures-test.
76+
# When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.
77+
- 1.37.0
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v2
81+
- name: Install Rust
82+
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
83+
- run: cargo install cargo-hack
84+
# remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
85+
- run: cargo hack --remove-dev-deps --workspace
86+
# Check no-default-features
87+
- run: cargo hack build --workspace --exclude futures-test --ignore-private --no-default-features
88+
# Check alloc feature
89+
- run: cargo hack build --workspace --exclude futures-test --ignore-private --no-default-features --features alloc --ignore-unknown-features
90+
# Check std feature
91+
- run: cargo hack build --workspace --ignore-private --no-default-features --features std --ignore-unknown-features
92+
# Check compat feature (futures, futures-util)
93+
- run: cargo hack build -p futures -p futures-util --no-default-features --features std,io-compat
94+
# Check thread-pool feature (futures, futures-executor)
95+
- run: cargo hack build -p futures -p futures-executor --no-default-features --features std,thread-pool
96+
97+
build:
98+
name: cargo +${{ matrix.rust }} build
99+
strategy:
100+
matrix:
101+
rust:
102+
# This is the minimum Rust version supported by `async-await` feature.
103+
# When updating this, the reminder to update the minimum required version of `async-await` feature in README.md.
104+
- 1.39.0
105+
- stable
106+
- beta
107+
- nightly
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@v2
111+
- name: Install Rust
112+
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
113+
- run: cargo install cargo-hack
114+
- run: cargo hack build --workspace --no-dev-deps
115+
- run: cargo build --tests --features default,thread-pool,io-compat --manifest-path futures/Cargo.toml
116+
117+
minimal-versions:
118+
name: cargo build -Z minimal-versions
119+
runs-on: ubuntu-latest
120+
steps:
121+
- uses: actions/checkout@v2
122+
- name: Install Rust
123+
run: rustup update nightly && rustup default nightly
124+
- run: cargo install cargo-hack
125+
# remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
126+
- run: cargo hack --remove-dev-deps --workspace
127+
- run: cargo update -Z minimal-versions
128+
- run: cargo build --workspace --all-features
129+
130+
thumbv6m:
131+
name: cargo build --target thumbv6m-none-eabi
132+
runs-on: ubuntu-latest
133+
steps:
134+
- uses: actions/checkout@v2
135+
- name: Install Rust
136+
run: rustup update nightly && rustup default nightly
137+
- run: rustup target add thumbv6m-none-eabi
138+
- run: cargo install cargo-hack
139+
# remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
140+
- run: cargo hack --remove-dev-deps --workspace
141+
- run: |
142+
cargo build --manifest-path futures/Cargo.toml \
143+
--target thumbv6m-none-eabi \
144+
--no-default-features \
145+
--features unstable,cfg-target-has-atomic
146+
- run: |
147+
cargo build --manifest-path futures/Cargo.toml \
148+
--target thumbv6m-none-eabi \
149+
--no-default-features \
150+
--features alloc,unstable,cfg-target-has-atomic
151+
- run: |
152+
cargo build --manifest-path futures/Cargo.toml \
153+
--target thumbv6m-none-eabi \
154+
--no-default-features \
155+
--features async-await,unstable,cfg-target-has-atomic
156+
157+
thumbv7m:
158+
name: cargo build --target thumbv7m-none-eabi
159+
runs-on: ubuntu-latest
160+
steps:
161+
- uses: actions/checkout@v2
162+
- name: Install Rust
163+
run: rustup update nightly && rustup default nightly
164+
- run: rustup target add thumbv7m-none-eabi
165+
- run: cargo install cargo-hack
166+
# remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
167+
- run: cargo hack --remove-dev-deps --workspace
168+
- run: |
169+
cargo build --manifest-path futures/Cargo.toml \
170+
--target thumbv7m-none-eabi \
171+
--no-default-features \
172+
--features unstable,cfg-target-has-atomic
173+
- run: |
174+
cargo build --manifest-path futures/Cargo.toml \
175+
--target thumbv7m-none-eabi \
176+
--no-default-features \
177+
--features alloc
178+
- run: |
179+
cargo build --manifest-path futures/Cargo.toml \
180+
--target thumbv7m-none-eabi \
181+
--no-default-features \
182+
--features async-await
183+
184+
bench:
185+
name: cargo bench
186+
runs-on: ubuntu-latest
187+
steps:
188+
- uses: actions/checkout@v2
189+
- name: Install Rust
190+
run: rustup update nightly && rustup default nightly
191+
- run: cargo bench --workspace
192+
- run: cargo bench --manifest-path futures-util/Cargo.toml --features=bilock,unstable
193+
194+
features:
195+
name: cargo hack check --each-feature
196+
runs-on: ubuntu-latest
197+
steps:
198+
- uses: actions/checkout@v2
199+
- name: Install Rust
200+
run: rustup update nightly && rustup default nightly
201+
- run: cargo install cargo-hack
202+
# Check each specified feature works properly
203+
# * `--each-feature` - run for each feature which includes --no-default-features and default features of package
204+
# * `--no-dev-deps` - build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
205+
# * `--exclude futures-test` - futures-test cannot be compiled with no-default features
206+
# * `--features unstable` - some features cannot be compiled without this feature
207+
# * `--ignore-unknown-features` - some crates doesn't have 'unstable' feature
208+
- run: |
209+
cargo hack check \
210+
--each-feature --no-dev-deps \
211+
--workspace --exclude futures-test \
212+
--features unstable --ignore-unknown-features
213+
214+
clippy:
215+
name: cargo clippy
216+
runs-on: ubuntu-latest
217+
steps:
218+
- uses: actions/checkout@v2
219+
- name: Install Rust and Clippy
220+
run: |
221+
toolchain=nightly-$(curl -sSf https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)
222+
rustup set profile minimal
223+
rustup default "$toolchain"
224+
rustup component add clippy
225+
- run: cargo clippy --workspace --all-features --all-targets
226+
227+
docs:
228+
name: cargo doc
229+
runs-on: ubuntu-latest
230+
steps:
231+
- uses: actions/checkout@v2
232+
- name: Install Rust
233+
run: rustup update nightly && rustup default nightly
234+
- run: RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo doc --workspace --no-deps --all-features

0 commit comments

Comments
 (0)