diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 756b493de90..136fad57579 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,21 +25,8 @@ jobs: displayName: Test tokio cross: true crates: - tokio: - - fs - - io - - io-traits - - io-util - - net-driver - - process - - rt-full - - signal - - sync - - tcp - - timer - - udp - - uds - tests-integration: [] + - tokio + - tests-integration # Test crates that are NOT platform specific - template: ci/azure-test-stable.yml @@ -48,10 +35,10 @@ jobs: displayName: Test sub crates - rust: beta crates: - tokio-macros: [] - tokio-test: [] - tokio-util: [] - examples: [] + - tokio-macros + - tokio-test + - tokio-util + - examples # Test compilation failure # Disable pending: https://github.com/tokio-rs/tokio/pull/1695#issuecomment-547045383 diff --git a/ci/azure-test-stable.yml b/ci/azure-test-stable.yml index 8c3a75282dd..76365688910 100644 --- a/ci/azure-test-stable.yml +++ b/ci/azure-test-stable.yml @@ -20,6 +20,12 @@ jobs: # rust_version: stable rust_version: ${{ parameters.rust }} + - script: | + git clone https://github.com/taiki-e/cargo-hack + cargo install cargo-hack --path cargo-hack + rm -rf cargo-hack + displayName: Install cargo-hack + - template: azure-is-release.yml - ${{ each crate in parameters.crates }}: @@ -28,17 +34,26 @@ jobs: env: LOOM_MAX_PREEMPTIONS: 2 CI: 'True' - displayName: ${{ crate.key }} - cargo test - workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }} + displayName: ${{ crate }} - cargo test + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} + + # Run with all crate features + - script: cargo test --all-features + env: + LOOM_MAX_PREEMPTIONS: 2 + CI: 'True' + displayName: ${{ crate }} - cargo test --features ${{ feature }} + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} - # Run with each specified feature - - ${{ each feature in crate.value }}: - - script: cargo test --no-default-features --features ${{ feature }} - env: - LOOM_MAX_PREEMPTIONS: 2 - CI: 'True' - displayName: ${{ crate.key }} - cargo test --features ${{ feature }} - workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }} + # 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 + - script: cargo hack check --each-feature --no-dev-deps + env: + LOOM_MAX_PREEMPTIONS: 2 + CI: 'True' + displayName: ${{ crate }} - cargo hack check --each-feature + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} - template: azure-patch-crates.yml @@ -48,29 +63,23 @@ jobs: env: LOOM_MAX_PREEMPTIONS: 2 CI: 'True' - displayName: ${{ crate.key }} - cargo test - workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }} + displayName: ${{ crate }} - cargo test + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} - # Run with each specified feature - - ${{ each feature in crate.value }}: - - script: cargo test --no-default-features --features ${{ feature }} - env: - LOOM_MAX_PREEMPTIONS: 2 - CI: 'True' - displayName: ${{ crate.key }} - cargo test --features ${{ feature }} - workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }} - - # Remove all dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866. - - bash: cargo run --manifest-path ci/remove-dev-dependencies/Cargo.toml ./*/Cargo.toml - displayName: Remove dev-dependencies + # Run with all crate features + - script: cargo test --all-features + env: + LOOM_MAX_PREEMPTIONS: 2 + CI: 'True' + displayName: ${{ crate }} - cargo test --all-features + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} - # Check each specified feature works properly - - ${{ each crate in parameters.crates }}: - # Run with each specified feature - - ${{ each feature in crate.value }}: - - script: cargo check --no-default-features --features ${{ feature }} - env: - LOOM_MAX_PREEMPTIONS: 2 - CI: 'True' - displayName: ${{ crate.key }} - cargo check --features ${{ feature }} - workingDirectory: $(Build.SourcesDirectory)/${{ crate.key }} + # 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 + - script: cargo hack check --each-feature --no-dev-deps + env: + LOOM_MAX_PREEMPTIONS: 2 + CI: 'True' + displayName: ${{ crate }} - cargo hack check --each-feature + workingDirectory: $(Build.SourcesDirectory)/${{ crate }} diff --git a/ci/remove-dev-dependencies/Cargo.toml b/ci/remove-dev-dependencies/Cargo.toml deleted file mode 100644 index 0381bf65875..00000000000 --- a/ci/remove-dev-dependencies/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "remove-dev-dependencies" -version = "0.1.0" -authors = ["Tokio Contributors "] -edition = "2018" -publish = false - -[workspace] - -[dependencies] -toml_edit = "0.1.5" diff --git a/ci/remove-dev-dependencies/src/main.rs b/ci/remove-dev-dependencies/src/main.rs deleted file mode 100644 index fe4cbd42964..00000000000 --- a/ci/remove-dev-dependencies/src/main.rs +++ /dev/null @@ -1,25 +0,0 @@ -use std::{env, fs}; - -fn main() { - let res: Result<(), Box> = env::args_os().skip(1).try_for_each(|file| { - let mut doc: toml_edit::Document = fs::read_to_string(&file)?.parse()?; - let table = doc.as_table_mut(); - table.remove("dev-dependencies"); - if let Some(table) = table.entry("target").as_table_mut() { - // `toml_edit::Table` does not have `.iter_mut()`, so collect keys. - let keys: Vec = table.iter().map(|(key, _)| key.to_string()).collect(); - for key in keys { - if let Some(table) = table.entry(&key).as_table_mut() { - table.remove("dev-dependencies"); - } - } - } - fs::write(file, doc.to_string_in_original_order())?; - Ok(()) - }); - - if let Err(e) = res { - eprintln!("{}", e); - std::process::exit(1) - } -}