From 63e856d845064790ebb714712f4b0a3d11c6f91a Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 16:56:09 -0700 Subject: [PATCH 01/15] ci: start migrating the test_tokio job to github actions --- .github/workflows/test_tokio.yml | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/test_tokio.yml diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml new file mode 100644 index 00000000000..94e67c68068 --- /dev/null +++ b/.github/workflows/test_tokio.yml @@ -0,0 +1,43 @@ +on: [push, pull_request] + +# on: +# push: +# branches: ["master"] +# pull_request: +# branches: ["master"] + +name: Test tokio + +env: + RUSTFLAGS: -Dwarnings + nightly: nightly-2020-01-25 + +jobs: + test_tokio: + name: Test tokio + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + # Run `tokio` with only `full` + - uses: actions-rs/cargo@v1 + with: + command: test + args: --features full + env: + RUST_BACKTRACE: 1 + CI: 'True' + name: tokio - cargo test --features full + working-directory: ${{ github.workspace }}/tokio + + # Run `tokio` with "unstable" cfg flag + - uses: actions-rs/cargo@v1 + with: + command: test + args: --features full + env: + RUSTFLAGS: '--cfg tokio_unstable' + RUST_BACKTRACE: 1 + CI: 'True' + name: tokio - cargo test --features full + working-directory: ${{ github.workspace }}/tokio From 59fca7bd64845c86c2146c54776cfc89f6b6e06b Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 18:42:07 -0700 Subject: [PATCH 02/15] use manifest-path instead of working-directory --- .github/workflows/test_tokio.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 94e67c68068..796648bdf32 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -23,21 +23,19 @@ jobs: - uses: actions-rs/cargo@v1 with: command: test - args: --features full + args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full env: RUST_BACKTRACE: 1 CI: 'True' name: tokio - cargo test --features full - working-directory: ${{ github.workspace }}/tokio # Run `tokio` with "unstable" cfg flag - uses: actions-rs/cargo@v1 with: command: test - args: --features full + args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full env: RUSTFLAGS: '--cfg tokio_unstable' RUST_BACKTRACE: 1 CI: 'True' name: tokio - cargo test --features full - working-directory: ${{ github.workspace }}/tokio From cf690cf3ebc98bdbb4a1f494695597c3f58bd622 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 19:24:20 -0700 Subject: [PATCH 03/15] add tests for subcrates --- .github/workflows/test_tokio.yml | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 796648bdf32..9c00c109fed 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -39,3 +39,38 @@ jobs: RUST_BACKTRACE: 1 CI: 'True' name: tokio - cargo test --features full + + test_subcrates: + name: Test ${{ matrix.crate }} all-features + runs-on: ubuntu-latest + strategy: + matrix: + crate: + - tokio + - tests-integration + - tokio-macros + - tokio-test + - tokio-util + - examples + steps: + - uses: actions/checkout@master + + # Run with all crate features + - uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features + env: + RUST_BACKTRACE: 1 + CI: 'True' + name: tokio - cargo test --features full + + # Check benches + - uses: actions-rs/cargo@v1 + with: + command: check + args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches + env: + RUST_BACKTRACE: 1 + CI: 'True' + name: ${{ matrix.crate }} - cargo check --benches From c72586538bb9d7a7f841887bf977c52b60faa4d6 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 19:31:24 -0700 Subject: [PATCH 04/15] add dependency patching script and second test run --- .github/workflows/test_tokio.yml | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 9c00c109fed..06602d0910e 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -56,21 +56,47 @@ jobs: - uses: actions/checkout@master # Run with all crate features - - uses: actions-rs/cargo@v1 + - name: tokio - cargo test --features full + uses: actions-rs/cargo@v1 with: command: test args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features env: RUST_BACKTRACE: 1 CI: 'True' - name: tokio - cargo test --features full # Check benches - - uses: actions-rs/cargo@v1 + - name: ${{ matrix.crate }} - cargo check --benches + uses: actions-rs/cargo@v1 with: command: check args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches env: RUST_BACKTRACE: 1 CI: 'True' - name: ${{ matrix.crate }} - cargo check --benches + + - name: Patch Cargo.toml + run: | + set -e + + # Remove any existing patch statements + mv Cargo.toml Cargo.toml.bck + sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml + + # Patch all crates + cat ci/patch.toml >> Cargo.toml + + # Print `Cargo.toml` for debugging + echo "~~~~ Cargo.toml ~~~~" + cat Cargo.toml + echo "~~~~~~~~~~~~~~~~~~~~" + + # Run with all crate features + - name: tokio - cargo test --features full + uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features + env: + RUST_BACKTRACE: 1 + CI: 'True' From 35694bb6f7ec43649ad7f68bd0a998aa836c96aa Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 19:35:17 -0700 Subject: [PATCH 05/15] add os to both jobs --- .github/workflows/test_tokio.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 06602d0910e..9bcc595bd00 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -15,7 +15,13 @@ env: jobs: test_tokio: name: Test tokio - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - windows-latest + - ubuntu-latest + - macos-latest steps: - uses: actions/checkout@master @@ -45,6 +51,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: + os: + - windows-latest + - ubuntu-latest + - macos-latest crate: - tokio - tests-integration From 938915460e69534ec0d46f96914b50c23621eeb9 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 19:38:42 -0700 Subject: [PATCH 06/15] name the subcrate steps correctly --- .github/workflows/test_tokio.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 9bcc595bd00..0cbe3f13e71 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -66,7 +66,7 @@ jobs: - uses: actions/checkout@master # Run with all crate features - - name: tokio - cargo test --features full + - name: ${{ matrix.crate }} - cargo test --features full uses: actions-rs/cargo@v1 with: command: test @@ -102,7 +102,7 @@ jobs: echo "~~~~~~~~~~~~~~~~~~~~" # Run with all crate features - - name: tokio - cargo test --features full + - name: ${{ matrix.crate }} - cargo test --features full uses: actions-rs/cargo@v1 with: command: test From a20cdbbb86b530a9c1f964d5dc02e943e116db0b Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 19:57:30 -0700 Subject: [PATCH 07/15] Remove the os matrix dimension from all-features tests --- .github/workflows/test_tokio.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 0cbe3f13e71..f0ee67703da 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -14,7 +14,7 @@ env: jobs: test_tokio: - name: Test tokio + name: Test tokio full runs-on: ${{ matrix.os }} strategy: matrix: @@ -51,10 +51,6 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: - - windows-latest - - ubuntu-latest - - macos-latest crate: - tokio - tests-integration From 6771e5ffa5f9c091f65569edf72be04e2eafba5f Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 20:10:03 -0700 Subject: [PATCH 08/15] Correctly run tokio subcrate all-features and integration tests on all platforms --- .github/workflows/test_tokio.yml | 64 +++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index f0ee67703da..6956cc3116c 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -46,14 +46,74 @@ jobs: CI: 'True' name: tokio - cargo test --features full + test_cross_subcrates: + name: Test ${{ matrix.crate }} (${{ matrix.os }}) all-features + runs-on: ${{ matrix.os }} + strategy: + matrix: + crate: + - tokio + - tests-integration + os: + - windows-latest + - ubuntu-latest + - macos-latest + steps: + - uses: actions/checkout@master + + # Run with all crate features + - name: ${{ matrix.crate }} - cargo test --features full + uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features + env: + RUST_BACKTRACE: 1 + CI: 'True' + + # Check benches + - name: ${{ matrix.crate }} - cargo check --benches + uses: actions-rs/cargo@v1 + with: + command: check + args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches + env: + RUST_BACKTRACE: 1 + CI: 'True' + + - name: Patch Cargo.toml + run: | + set -e + + # Remove any existing patch statements + mv Cargo.toml Cargo.toml.bck + sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml + + # Patch all crates + cat ci/patch.toml >> Cargo.toml + + # Print `Cargo.toml` for debugging + echo "~~~~ Cargo.toml ~~~~" + cat Cargo.toml + echo "~~~~~~~~~~~~~~~~~~~~" + + # Run with all crate features + - name: ${{ matrix.crate }} - cargo test --features full + uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features + env: + RUST_BACKTRACE: 1 + CI: 'True' + + test_subcrates: name: Test ${{ matrix.crate }} all-features runs-on: ubuntu-latest strategy: matrix: crate: - - tokio - - tests-integration - tokio-macros - tokio-test - tokio-util From 06fc9e88ad941a0d5ef6d6d2e76db7f2a3279cd6 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 20:17:19 -0700 Subject: [PATCH 09/15] Specificy the shell so it works on windows --- .github/workflows/test_tokio.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 6956cc3116c..4ee93267809 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -142,6 +142,7 @@ jobs: CI: 'True' - name: Patch Cargo.toml + shell: bash run: | set -e From 3ff0051b7a826d7cb2a4ab7f7ba7308852001fcc Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 20:21:29 -0700 Subject: [PATCH 10/15] In all the places it's needed --- .github/workflows/test_tokio.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 4ee93267809..b6d531731ce 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -82,6 +82,7 @@ jobs: CI: 'True' - name: Patch Cargo.toml + shell: bash run: | set -e From e5495d70c9ba834898afc5ddb04a3e6f385c6f38 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Tue, 12 May 2020 21:05:15 -0700 Subject: [PATCH 11/15] Add integration tests with cargo hack --- .github/workflows/test_tokio.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index b6d531731ce..933d5695bd1 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -168,3 +168,24 @@ jobs: env: RUST_BACKTRACE: 1 CI: 'True' + + test_integration: + name: Integration tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - windows-latest + - ubuntu-latest + - macos-latest + steps: + - uses: actions/checkout@master + - run: cargo install cargo-hack + name: Install cargo-hack + - uses: actions-rs/cargo@v1 + name: cargo hack test --each-feature + with: + command: hack + args: test --manifest-path ${{ github.workspace }}/tests-integration/Cargo.toml --each-feature + env: + CI: 'True' From 372279cd68e641939fbd5656f2621ca1b42ab2df Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Fri, 15 May 2020 16:38:03 -0700 Subject: [PATCH 12/15] Fix test name for --all-features tests --- .github/workflows/test_tokio.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 933d5695bd1..4dd39486806 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -123,7 +123,7 @@ jobs: - uses: actions/checkout@master # Run with all crate features - - name: ${{ matrix.crate }} - cargo test --features full + - name: ${{ matrix.crate }} - cargo test --all-features uses: actions-rs/cargo@v1 with: command: test @@ -160,7 +160,7 @@ jobs: echo "~~~~~~~~~~~~~~~~~~~~" # Run with all crate features - - name: ${{ matrix.crate }} - cargo test --features full + - name: ${{ matrix.crate }} - cargo test --all-features uses: actions-rs/cargo@v1 with: command: test From 3dcba94840f0dfe0dd30e20041ebc200db73a98a Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Fri, 15 May 2020 16:38:20 -0700 Subject: [PATCH 13/15] Use matrix-include instead of duplicating job definition --- .github/workflows/test_tokio.yml | 69 +++++--------------------------- 1 file changed, 9 insertions(+), 60 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 4dd39486806..e9fdf963b21 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -58,67 +58,16 @@ jobs: - windows-latest - ubuntu-latest - macos-latest - steps: - - uses: actions/checkout@master - - # Run with all crate features - - name: ${{ matrix.crate }} - cargo test --features full - uses: actions-rs/cargo@v1 - with: - command: test - args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features - env: - RUST_BACKTRACE: 1 - CI: 'True' - - # Check benches - - name: ${{ matrix.crate }} - cargo check --benches - uses: actions-rs/cargo@v1 - with: - command: check - args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches - env: - RUST_BACKTRACE: 1 - CI: 'True' - - - name: Patch Cargo.toml - shell: bash - run: | - set -e + include: + - crate: tokio-macros + os: ubuntu-latest + - crate: tokio-test + os: ubuntu-latest + - crate: tokio-util + os: ubuntu-latest + - crate: examples + os: ubuntu-latest - # Remove any existing patch statements - mv Cargo.toml Cargo.toml.bck - sed -n '/\[patch.crates-io\]/q;p' Cargo.toml.bck > Cargo.toml - - # Patch all crates - cat ci/patch.toml >> Cargo.toml - - # Print `Cargo.toml` for debugging - echo "~~~~ Cargo.toml ~~~~" - cat Cargo.toml - echo "~~~~~~~~~~~~~~~~~~~~" - - # Run with all crate features - - name: ${{ matrix.crate }} - cargo test --features full - uses: actions-rs/cargo@v1 - with: - command: test - args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features - env: - RUST_BACKTRACE: 1 - CI: 'True' - - - test_subcrates: - name: Test ${{ matrix.crate }} all-features - runs-on: ubuntu-latest - strategy: - matrix: - crate: - - tokio-macros - - tokio-test - - tokio-util - - examples steps: - uses: actions/checkout@master From 97ee35669f626b792e56663dd28b3350af5c35af Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sat, 23 May 2020 22:35:32 -0700 Subject: [PATCH 14/15] Addres PR feedback --- .github/workflows/test_tokio.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index e9fdf963b21..3db6dfa1d2f 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -10,6 +10,7 @@ name: Test tokio env: RUSTFLAGS: -Dwarnings + RUST_BACKTRACE: 1 nightly: nightly-2020-01-25 jobs: @@ -30,9 +31,6 @@ jobs: with: command: test args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full - env: - RUST_BACKTRACE: 1 - CI: 'True' name: tokio - cargo test --features full # Run `tokio` with "unstable" cfg flag @@ -42,9 +40,7 @@ jobs: args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full env: RUSTFLAGS: '--cfg tokio_unstable' - RUST_BACKTRACE: 1 - CI: 'True' - name: tokio - cargo test --features full + name: tokio - cargo test --features full --cfg tokio_unstable test_cross_subcrates: name: Test ${{ matrix.crate }} (${{ matrix.os }}) all-features @@ -77,9 +73,6 @@ jobs: with: command: test args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features - env: - RUST_BACKTRACE: 1 - CI: 'True' # Check benches - name: ${{ matrix.crate }} - cargo check --benches @@ -87,9 +80,6 @@ jobs: with: command: check args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features --benches - env: - RUST_BACKTRACE: 1 - CI: 'True' - name: Patch Cargo.toml shell: bash @@ -114,9 +104,6 @@ jobs: with: command: test args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features - env: - RUST_BACKTRACE: 1 - CI: 'True' test_integration: name: Integration tests @@ -136,5 +123,3 @@ jobs: with: command: hack args: test --manifest-path ${{ github.workspace }}/tests-integration/Cargo.toml --each-feature - env: - CI: 'True' From 16b98832f0477a480b8d6e33c2838511134792c6 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 25 May 2020 00:01:06 +0900 Subject: [PATCH 15/15] Change `on:` conditions --- .github/workflows/test_tokio.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_tokio.yml b/.github/workflows/test_tokio.yml index 3db6dfa1d2f..47b0efab86d 100644 --- a/.github/workflows/test_tokio.yml +++ b/.github/workflows/test_tokio.yml @@ -1,10 +1,8 @@ -on: [push, pull_request] - -# on: -# push: -# branches: ["master"] -# pull_request: -# branches: ["master"] +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] name: Test tokio