|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +env: |
| 12 | + RUSTFLAGS: -Dwarnings |
| 13 | + RUST_BACKTRACE: 1 |
| 14 | + nightly: nightly-2022-11-12 |
| 15 | + |
| 16 | +defaults: |
| 17 | + run: |
| 18 | + shell: bash |
| 19 | + |
| 20 | +jobs: |
| 21 | + # Check formatting |
| 22 | + rustfmt: |
| 23 | + name: rustfmt |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + - name: Install Rust |
| 28 | + run: rustup update stable && rustup default stable |
| 29 | + - name: Check formatting |
| 30 | + run: cargo fmt --all -- --check |
| 31 | + |
| 32 | + # TODO |
| 33 | + # # Apply clippy lints |
| 34 | + # clippy: |
| 35 | + # name: clippy |
| 36 | + # runs-on: ubuntu-latest |
| 37 | + # steps: |
| 38 | + # - uses: actions/checkout@v3 |
| 39 | + # - name: Apply clippy lints |
| 40 | + # run: cargo clippy --all-features |
| 41 | + |
| 42 | + # This represents the minimum Rust version supported by |
| 43 | + # Bytes. Updating this should be done in a dedicated PR. |
| 44 | + # |
| 45 | + # Tests are not run as tests may require newer versions of |
| 46 | + # rust. |
| 47 | + minrust: |
| 48 | + name: minrust |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v3 |
| 52 | + - name: Install Rust |
| 53 | + run: rustup update 1.39.0 && rustup default 1.39.0 |
| 54 | + - name: Check |
| 55 | + run: . ci/test-stable.sh check |
| 56 | + |
| 57 | + # Stable |
| 58 | + stable: |
| 59 | + name: stable |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + os: |
| 63 | + - ubuntu-latest |
| 64 | + - macos-latest |
| 65 | + - windows-latest |
| 66 | + runs-on: ${{ matrix.os }} |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v3 |
| 69 | + - name: Install Rust |
| 70 | + # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. |
| 71 | + run: rustup update stable --no-self-update && rustup default stable |
| 72 | + - name: Test |
| 73 | + run: . ci/test-stable.sh test |
| 74 | + |
| 75 | + # Nightly |
| 76 | + nightly: |
| 77 | + name: nightly |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v3 |
| 81 | + - name: Install Rust |
| 82 | + run: rustup update $nightly && rustup default $nightly |
| 83 | + - name: Test |
| 84 | + run: . ci/test-stable.sh test |
| 85 | + |
| 86 | + # Run tests on some extra platforms |
| 87 | + cross: |
| 88 | + name: cross |
| 89 | + strategy: |
| 90 | + matrix: |
| 91 | + target: |
| 92 | + - i686-unknown-linux-gnu |
| 93 | + - armv7-unknown-linux-gnueabihf |
| 94 | + - powerpc-unknown-linux-gnu |
| 95 | + - powerpc64-unknown-linux-gnu |
| 96 | + - wasm32-unknown-unknown |
| 97 | + runs-on: ubuntu-latest |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v3 |
| 100 | + - name: Install Rust |
| 101 | + run: rustup update stable && rustup default stable |
| 102 | + - name: cross build --target ${{ matrix.target }} |
| 103 | + run: | |
| 104 | + cargo install cross |
| 105 | + cross build --target ${{ matrix.target }} |
| 106 | + if: matrix.target != 'wasm32-unknown-unknown' |
| 107 | + # WASM support |
| 108 | + - name: cargo build --target ${{ matrix.target }} |
| 109 | + run: | |
| 110 | + rustup target add ${{ matrix.target }} |
| 111 | + cargo build --target ${{ matrix.target }} |
| 112 | + if: matrix.target == 'wasm32-unknown-unknown' |
| 113 | + |
| 114 | + # Sanitizers |
| 115 | + tsan: |
| 116 | + name: tsan |
| 117 | + runs-on: ubuntu-latest |
| 118 | + steps: |
| 119 | + - uses: actions/checkout@v3 |
| 120 | + - name: Install Rust |
| 121 | + run: rustup update $nightly && rustup default $nightly |
| 122 | + - name: Install rust-src |
| 123 | + run: rustup component add rust-src |
| 124 | + - name: ASAN / TSAN |
| 125 | + run: . ci/tsan.sh |
| 126 | + miri: |
| 127 | + name: miri |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v3 |
| 131 | + - name: Miri |
| 132 | + run: ci/miri.sh |
| 133 | + |
| 134 | + # Loom |
| 135 | + loom: |
| 136 | + name: loom |
| 137 | + runs-on: ubuntu-latest |
| 138 | + steps: |
| 139 | + - uses: actions/checkout@v3 |
| 140 | + - name: Install Rust |
| 141 | + run: rustup update $nightly && rustup default $nightly |
| 142 | + - name: Loom tests |
| 143 | + run: RUSTFLAGS="--cfg loom -Dwarnings" cargo test --lib |
| 144 | + |
| 145 | + publish_docs: |
| 146 | + name: Publish Documentation |
| 147 | + needs: |
| 148 | + - rustfmt |
| 149 | + # - clippy |
| 150 | + - stable |
| 151 | + - nightly |
| 152 | + - minrust |
| 153 | + - cross |
| 154 | + - tsan |
| 155 | + - loom |
| 156 | + runs-on: ubuntu-latest |
| 157 | + steps: |
| 158 | + - uses: actions/checkout@v3 |
| 159 | + - name: Install Rust |
| 160 | + run: rustup update $nightly && rustup default $nightly |
| 161 | + - name: Build documentation |
| 162 | + run: cargo doc --no-deps --all-features |
| 163 | + env: |
| 164 | + RUSTDOCFLAGS: --cfg docsrs |
| 165 | + - name: Publish documentation |
| 166 | + run: | |
| 167 | + cd target/doc |
| 168 | + git init |
| 169 | + git add . |
| 170 | + git -c user.name='ci' -c user.email='ci' commit -m 'Deploy Bytes API documentation' |
| 171 | + git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages |
| 172 | + if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' && github.repository == 'tokio-rs/bytes' |
0 commit comments