From 73ade1e1598efe06e66df3d2b7926a1820cbfe0e Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 16 Nov 2020 10:26:09 +0900 Subject: [PATCH] Migrate CI to GitHub Actions --- .github/workflows/ci.yml | 234 +++++++++++++++++++++++++ .travis.yml | 187 +------------------- README.md | 4 +- ci/remove-dev-dependencies/Cargo.toml | 11 -- ci/remove-dev-dependencies/src/main.rs | 12 -- futures/Cargo.toml | 3 - 6 files changed, 240 insertions(+), 211 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 ci/remove-dev-dependencies/Cargo.toml delete mode 100644 ci/remove-dev-dependencies/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..ade4a2f1f7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,234 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + schedule: + - cron: '0 1 * * *' + +env: + RUSTFLAGS: -D warnings + RUST_BACKTRACE: 1 + +defaults: + run: + shell: bash + +jobs: + test: + name: cargo +${{ matrix.rust }} test (${{ matrix.os }}) + strategy: + matrix: + rust: + - nightly + os: + - ubuntu-latest + - macos-latest + - windows-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Install Rust + # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. + run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} + - run: cargo test --workspace --all-features + - run: cargo test --workspace --all-features --release + + core-msrv: + name: cargo +${{ matrix.rust }} build (futures-{core, io, sink, task, channel}) + strategy: + matrix: + rust: + # This is the minimum Rust version supported by futures-core, futures-io, futures-sink, futures-task, futures-channel. + # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md. + - 1.36.0 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + # cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead. + # Refs: cargo#3620, cargo#4106, cargo#4463, cargo#4753, cargo#5015, cargo#5364, cargo#6195 + - run: cargo install cargo-hack + # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 + - run: cargo hack --remove-dev-deps --workspace + # Check no-default-features + - run: | + cargo hack build --workspace --ignore-private --no-default-features \ + --exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test + # Check alloc feature + - run: | + cargo hack build --workspace --ignore-private --no-default-features --features alloc --ignore-unknown-features \ + --exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test + # Check std feature + - run: | + cargo hack build --workspace --ignore-private --no-default-features --features std \ + --exclude futures --exclude futures-util --exclude futures-macro --exclude futures-executor --exclude futures-test + + util-msrv: + name: cargo +${{ matrix.rust }} build + strategy: + matrix: + rust: + # This is the minimum Rust version supported by futures, futures-util, futures-macro, futures-executor, futures-test. + # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md. + - 1.37.0 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - run: cargo install cargo-hack + # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 + - run: cargo hack --remove-dev-deps --workspace + # Check no-default-features + - run: cargo hack build --workspace --exclude futures-test --ignore-private --no-default-features + # Check alloc feature + - run: cargo hack build --workspace --exclude futures-test --ignore-private --no-default-features --features alloc --ignore-unknown-features + # Check std feature + - run: cargo hack build --workspace --ignore-private --no-default-features --features std --ignore-unknown-features + # Check compat feature (futures, futures-util) + - run: cargo hack build -p futures -p futures-util --no-default-features --features std,io-compat + # Check thread-pool feature (futures, futures-executor) + - run: cargo hack build -p futures -p futures-executor --no-default-features --features std,thread-pool + + build: + name: cargo +${{ matrix.rust }} build + strategy: + matrix: + rust: + # This is the minimum Rust version supported by `async-await` feature. + # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md. + - 1.39.0 + - stable + - beta + - nightly + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} + - run: cargo install cargo-hack + - run: cargo hack build --workspace --no-dev-deps + - run: cargo build --tests --features default,thread-pool,io-compat --manifest-path futures/Cargo.toml + + minimal-versions: + name: cargo build -Z minimal-versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - run: cargo install cargo-hack + # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 + - run: cargo hack --remove-dev-deps --workspace + - run: cargo update -Z minimal-versions + - run: cargo build --workspace --all-features + + thumbv6m: + name: cargo build --target thumbv6m-none-eabi + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - run: rustup target add thumbv6m-none-eabi + - run: cargo install cargo-hack + # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 + - run: cargo hack --remove-dev-deps --workspace + - run: | + cargo build --manifest-path futures/Cargo.toml \ + --target thumbv6m-none-eabi \ + --no-default-features \ + --features unstable,cfg-target-has-atomic + - run: | + cargo build --manifest-path futures/Cargo.toml \ + --target thumbv6m-none-eabi \ + --no-default-features \ + --features alloc,unstable,cfg-target-has-atomic + - run: | + cargo build --manifest-path futures/Cargo.toml \ + --target thumbv6m-none-eabi \ + --no-default-features \ + --features async-await,unstable,cfg-target-has-atomic + + thumbv7m: + name: cargo build --target thumbv7m-none-eabi + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - run: rustup target add thumbv7m-none-eabi + - run: cargo install cargo-hack + # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 + - run: cargo hack --remove-dev-deps --workspace + - run: | + cargo build --manifest-path futures/Cargo.toml \ + --target thumbv7m-none-eabi \ + --no-default-features \ + --features unstable,cfg-target-has-atomic + - run: | + cargo build --manifest-path futures/Cargo.toml \ + --target thumbv7m-none-eabi \ + --no-default-features \ + --features alloc + - run: | + cargo build --manifest-path futures/Cargo.toml \ + --target thumbv7m-none-eabi \ + --no-default-features \ + --features async-await + + bench: + name: cargo bench + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - run: cargo bench --workspace + - run: cargo bench --manifest-path futures-util/Cargo.toml --features=bilock,unstable + + features: + name: cargo hack check --each-feature + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - run: cargo install cargo-hack + # Check each specified feature works properly + # * `--each-feature` - run for each feature which includes --no-default-features and default features of package + # * `--no-dev-deps` - build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 + # * `--exclude futures-test` - futures-test cannot be compiled with no-default features + # * `--features unstable` - some features cannot be compiled without this feature + # * `--ignore-unknown-features` - some crates doesn't have 'unstable' feature + - run: | + cargo hack check \ + --each-feature --no-dev-deps \ + --workspace --exclude futures-test \ + --features unstable --ignore-unknown-features + + clippy: + name: cargo clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust and Clippy + run: | + toolchain=nightly-$(curl -sSf https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy) + rustup set profile minimal + rustup default "$toolchain" + rustup component add clippy + - run: cargo clippy --workspace --all-features --all-targets + + docs: + name: cargo doc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Rust + run: rustup update nightly && rustup default nightly + - run: RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo doc --workspace --no-deps --all-features diff --git a/.travis.yml b/.travis.yml index 9f05e9413e..bbdbf84793 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,187 +1,8 @@ -language: rust -sudo: false - -# Refs: https://levans.fr/rust_travis_cache.html -cache: - directories: - - /home/travis/.cargo -before_cache: - - rm -rf /home/travis/.cargo/registry - -matrix: - include: - # This is the minimum Rust version supported by futures-core, futures-io, futures-sink, futures-task, futures-channel. - # When updating this, the reminder to update the minimum required version in README.md. - - name: cargo check (minimum required version of futures-{core, io, sink, task}) - rust: 1.36.0 - install: - # cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead. - # Refs: cargo#3620, cargo#4106, cargo#4463, cargo#4753, cargo#5015, cargo#5364, cargo#6195 - - if ! cargo hack -V 2>/dev/null; then - cargo install cargo-hack; - fi - script: - # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 - - cargo hack --remove-dev-deps --workspace - # Check no-default-features - - cargo hack check --workspace --ignore-private --no-default-features - --exclude futures --exclude futures-util --exclude futures-executor --exclude futures-test - # Check alloc feature - - cargo hack check --workspace --ignore-private --no-default-features --features alloc --ignore-unknown-features - --exclude futures --exclude futures-util --exclude futures-executor --exclude futures-test - # Check std feature - - cargo hack check --workspace --ignore-private --no-default-features --features std --ignore-unknown-features - --exclude futures --exclude futures-util --exclude futures-executor --exclude futures-test - - # This is the minimum Rust version supported by futures, futures-util, futures-executor, futures-test. - # When updating this, the reminder to update the minimum required version in README.md. - - name: cargo check (minimum required version of futures-{util, executor, test}) - rust: 1.37.0 - install: - # cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead. - # Refs: cargo#3620, cargo#4106, cargo#4463, cargo#4753, cargo#5015, cargo#5364, cargo#6195 - - if ! cargo hack -V 2>/dev/null; then - cargo install cargo-hack; - fi - script: - # remove dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 - - cargo hack --remove-dev-deps --workspace - # Check no-default-features - - cargo hack check --workspace --exclude futures-test --ignore-private --no-default-features - # Check alloc feature - - cargo hack check --workspace --exclude futures-test --ignore-private --no-default-features --features alloc --ignore-unknown-features - # Check std feature - - cargo hack check --workspace --ignore-private --no-default-features --features std --ignore-unknown-features - # Check compat feature (futures, futures-util) - - cargo hack check -p futures -p futures-util --no-default-features --features std,io-compat - # Check thread-pool feature (futures, futures-executor) - - cargo hack check -p futures -p futures-executor --no-default-features --features std,thread-pool - - # This is the minimum Rust version supported by `async-await` feature. - # When updating this, the reminder to update the minimum required version of `async-await` feature in README.md. - - name: cargo build --features async-await (minimum required version) - rust: 1.39.0 - install: - # cargo does not support for --features/--no-default-features with workspace, so use cargo-hack instead. - # Refs: cargo#3620, cargo#4106, cargo#4463, cargo#4753, cargo#5015, cargo#5364, cargo#6195 - - if ! cargo hack -V 2>/dev/null; then - cargo install cargo-hack; - fi - script: - # async-await feature is activated by default. - - cargo hack build --workspace --no-dev-deps - - cargo build --tests --features default,thread-pool,io-compat --manifest-path futures/Cargo.toml - - - name: cargo +stable build - rust: stable - script: - - cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml - - cargo build --workspace - - - name: cargo +beta build - rust: beta - script: - - cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml - - cargo build --workspace - - - name: cargo test - rust: nightly - os: osx - - - name: cargo test - rust: nightly - os: linux +# TODO: CI has migrated to GitHub Actions, but branch protection requires the status of Travis. +# Once branch protection settings updated, delete this file. - - name: cargo build (with minimal versions) - rust: nightly - script: - - cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml - - cargo update -Zminimal-versions - - cargo build --workspace --all-features - - - name: cargo clippy - rust: nightly - install: - - if ! rustup component add clippy 2>/dev/null; then - target=`curl https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy`; - echo "'clippy' is unavailable on the toolchain 'nightly', use the toolchain 'nightly-$target' instead"; - rustup toolchain install nightly-$target; - rustup default nightly-$target; - rustup component add clippy; - fi - script: - - cargo clippy --workspace --all-features --all-targets - - - name: cargo bench - rust: nightly - script: - - cargo bench --workspace - - cargo bench --manifest-path futures-util/Cargo.toml --features=bilock,unstable - - - name: cargo build --target=thumbv6m-none-eabi - rust: nightly - install: - - rustup target add thumbv6m-none-eabi - script: - - cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml - - cargo build --manifest-path futures/Cargo.toml - --target thumbv6m-none-eabi - --no-default-features - --features unstable,cfg-target-has-atomic - - cargo build --manifest-path futures/Cargo.toml - --target thumbv6m-none-eabi - --no-default-features - --features unstable,cfg-target-has-atomic,alloc - - cargo build --manifest-path futures/Cargo.toml - --target thumbv6m-none-eabi - --no-default-features - --features unstable,cfg-target-has-atomic,async-await - - - name: cargo build --target=thumbv7m-none-eabi - rust: nightly - install: - - rustup target add thumbv7m-none-eabi - script: - - cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml */Cargo.toml - - cargo build --manifest-path futures/Cargo.toml - --target thumbv7m-none-eabi - --no-default-features - - cargo build --manifest-path futures/Cargo.toml - --target thumbv7m-none-eabi - --no-default-features - --features alloc - - cargo build --manifest-path futures/Cargo.toml - --target thumbv7m-none-eabi - --no-default-features - --features async-await - - - name: cargo check (features) - rust: nightly - install: - - cargo install cargo-hack - script: - # Check each specified feature works properly - # * `--each-feature` - run for each feature which includes --no-default-features and default features of package - # * `--no-dev-deps` - build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866 - # * `--exclude futures-test` - futures-test cannot be compiled with no-default features - # * `--features unstable` - some features cannot be compiled without this feature - # * `--ignore-unknown-features` - some crates doesn't have 'unstable' feature - - cargo hack check - --each-feature --no-dev-deps - --workspace --exclude futures-test - --features unstable --ignore-unknown-features - - - name: cargo doc - rust: nightly - script: - - RUSTDOCFLAGS="-Dwarnings --cfg docsrs" cargo doc --workspace --no-deps --all-features - -script: - - cargo test --workspace --all-features - - cargo test --workspace --all-features --release - -env: - - RUSTFLAGS=-Dwarnings +language: minimal +sudo: false notifications: email: diff --git a/README.md b/README.md index e134d4bea6..6e525e3bab 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@

- - Build Status + + Build Status diff --git a/ci/remove-dev-dependencies/Cargo.toml b/ci/remove-dev-dependencies/Cargo.toml deleted file mode 100644 index bf0fc53853..0000000000 --- a/ci/remove-dev-dependencies/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "remove-dev-dependencies" -version = "0.1.0" -authors = ["Wim Looman "] -edition = "2018" -publish = false - -[workspace] - -[dependencies] -toml_edit = "0.1.3" diff --git a/ci/remove-dev-dependencies/src/main.rs b/ci/remove-dev-dependencies/src/main.rs deleted file mode 100644 index 0b5b0452fe..0000000000 --- a/ci/remove-dev-dependencies/src/main.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::{env, error::Error, fs}; - -fn main() -> Result<(), Box> { - for file in env::args().skip(1) { - let content = fs::read_to_string(&file)?; - let mut doc: toml_edit::Document = content.parse()?; - doc.as_table_mut().remove("dev-dependencies"); - fs::write(file, doc.to_string())?; - } - - Ok(()) -} diff --git a/futures/Cargo.toml b/futures/Cargo.toml index 4e58cd210a..d12c425ae8 100644 --- a/futures/Cargo.toml +++ b/futures/Cargo.toml @@ -15,9 +15,6 @@ composability, and iterator-like interfaces. """ categories = ["asynchronous"] -[badges] -travis-ci = { repository = "rust-lang/futures-rs" } - [dependencies] futures-core = { path = "../futures-core", version = "0.3.8", default-features = false } futures-task = { path = "../futures-task", version = "0.3.8", default-features = false }