summaryrefslogtreecommitdiffstats
path: root/.github/workflows/test_tokio.yml
blob: d6d32b8f54b625e72d24ccaa55607afc3200ec7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]

name: Test tokio

env:
  RUSTFLAGS: -Dwarnings
  RUST_BACKTRACE: 1
  nightly: nightly-2020-01-25

jobs:
  test_tokio:
    name: Test tokio full
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - windows-latest
          - ubuntu-latest
          - macos-latest
    steps:
      - uses: actions/checkout@master
      - name: Install Rust
        run: rustup update stable

      # Run `tokio` with only `full`
      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full
        name: tokio - cargo test --features full

      # Run `tokio` with "unstable" cfg flag
      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --manifest-path ${{ github.workspace }}/tokio/Cargo.toml --features full
        env:
          RUSTFLAGS: '--cfg tokio_unstable'
        name: tokio - cargo test --features full --cfg tokio_unstable

  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
        include:
          - crate: tokio-macros
            os: ubuntu-latest
          - crate: tokio-test
            os: ubuntu-latest
          - crate: tokio-util
            os: ubuntu-latest
          - crate: examples
            os: ubuntu-latest

    steps:
      - uses: actions/checkout@master
      - name: Install Rust
        run: rustup update stable

      # Run with all crate features
      - name: ${{ matrix.crate }} - cargo test --all-features
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features

        # 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

      - name: Patch Cargo.toml
        shell: bash
        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 --all-features
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --manifest-path ${{ github.workspace }}/${{ matrix.crate }}/Cargo.toml --all-features

  test_integration:
    name: Integration tests
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - windows-latest
          - ubuntu-latest
          - macos-latest
    steps:
      - uses: actions/checkout@master
      - name: Install Rust
        run: rustup update stable
      - 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