|
9 | 9 | jobs:
|
10 | 10 | test-desktop:
|
11 | 11 | name: Build and test
|
12 |
| - runs-on: ubuntu-latest |
| 12 | + runs-on: ubuntu-18.04 |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + args: [ |
| 16 | + "--no-default-features", |
| 17 | + "--all-features", |
| 18 | + "--benches --all-features", |
| 19 | + ] |
13 | 20 | steps:
|
14 |
| - - uses: actions/checkout@v1 |
15 |
| - - name: Cache cargo registry |
16 |
| - uses: actions/cache@v1 |
17 |
| - with: |
18 |
| - path: ~/.cargo/registry |
19 |
| - key: cargo-registry-${{ hashFiles('Cargo.toml') }} |
20 |
| - - name: Cache cargo index |
21 |
| - uses: actions/cache@v1 |
| 21 | + |
| 22 | + - name: Cancel Previous Runs |
| 23 | + |
22 | 24 | with:
|
23 |
| - path: ~/.cargo/git |
24 |
| - key: cargo-index-${{ hashFiles('Cargo.toml') }} |
25 |
| - - name: Cache cargo build |
26 |
| - uses: actions/cache@v1 |
| 25 | + access_token: ${{ github.token }} |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + - uses: Swatinem/[email protected] |
27 | 30 | with:
|
28 |
| - path: target |
29 |
| - key: cargo-build-target-${{ hashFiles('Cargo.toml') }} |
30 |
| - - name: Run tests, with no feature |
31 |
| - run: cargo test --workspace --no-default-features |
32 |
| - - name: Run tests, with all features |
33 |
| - run: cargo test --workspace --all-features |
| 31 | + key: ${{ matrix.args }} |
| 32 | + |
| 33 | + - run: cargo test --workspace ${{ matrix.args }} |
34 | 34 |
|
35 | 35 | test-wasm:
|
36 | 36 | name: Build on WASM
|
37 |
| - runs-on: ubuntu-latest |
| 37 | + runs-on: ubuntu-18.04 |
| 38 | + strategy: |
| 39 | + matrix: |
| 40 | + toolchain: [ |
| 41 | + wasm32-unknown-emscripten, |
| 42 | + wasm32-wasi |
| 43 | + ] |
| 44 | + include: |
| 45 | + - toolchain: wasm32-unknown-unknown |
| 46 | + args: "--features wasm-bindgen" |
38 | 47 | container:
|
39 | 48 | image: rust
|
40 | 49 | env:
|
41 |
| - CC: clang-10 |
| 50 | + CC: clang-11 |
42 | 51 | steps:
|
43 |
| - - uses: actions/checkout@v1 |
44 |
| - - name: Install Rust |
45 |
| - uses: actions-rs/toolchain@v1 |
| 52 | + |
| 53 | + - name: Cancel Previous Runs |
| 54 | + |
| 55 | + with: |
| 56 | + access_token: ${{ github.token }} |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + - name: Install Rust ${{ matrix.toolchain }} |
| 61 | + uses: actions-rs/[email protected] |
46 | 62 | with:
|
47 | 63 | toolchain: stable
|
48 |
| - target: wasm32-unknown-unknown |
| 64 | + target: ${{ matrix.toolchain }} |
49 | 65 | override: true
|
| 66 | + |
50 | 67 | - name: Install a recent version of clang
|
51 | 68 | run: |
|
52 |
| - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - |
53 |
| - echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main" >> /etc/apt/sources.list |
54 | 69 | apt-get update
|
55 |
| - apt-get install -y clang-10 |
| 70 | + apt-get install -y clang-11 |
| 71 | +
|
56 | 72 | - name: Install CMake
|
57 | 73 | run: apt-get install -y cmake
|
58 |
| - - name: Cache cargo registry |
59 |
| - uses: actions/cache@v1 |
60 |
| - with: |
61 |
| - path: ~/.cargo/registry |
62 |
| - key: wasm-cargo-registry-${{ hashFiles('Cargo.toml') }} |
63 |
| - - name: Cache cargo index |
64 |
| - uses: actions/cache@v1 |
65 |
| - with: |
66 |
| - path: ~/.cargo/git |
67 |
| - key: wasm-cargo-index-${{ hashFiles('Cargo.toml') }} |
68 |
| - - name: Cache cargo build |
69 |
| - uses: actions/cache@v1 |
| 74 | + |
| 75 | + - uses: Swatinem/[email protected] |
70 | 76 | with:
|
71 |
| - path: target |
72 |
| - key: wasm-cargo-build-target-${{ hashFiles('Cargo.toml') }} |
73 |
| - - name: Build on WASM |
| 77 | + key: ${{ matrix.toolchain }} |
| 78 | + |
| 79 | + - name: Build on ${{ matrix.toolchain }} |
74 | 80 | # TODO: also run `cargo test`
|
75 | 81 | # TODO: ideally we would build `--workspace`, but not all crates compile for WASM
|
76 |
| - run: cargo build --target=wasm32-unknown-unknown |
| 82 | + run: cargo build --target=${{ matrix.toolchain }} ${{ matrix.args }} |
77 | 83 |
|
78 | 84 | check-rustdoc-links:
|
79 | 85 | name: Check rustdoc intra-doc links
|
80 |
| - runs-on: ubuntu-latest |
| 86 | + runs-on: ubuntu-18.04 |
81 | 87 | container:
|
82 | 88 | image: rust
|
83 | 89 | steps:
|
84 |
| - - uses: actions/checkout@v1 |
85 |
| - - name: Install nightly Rust |
86 |
| - # TODO: intra-doc links are available on nightly only |
87 |
| - # see https://doc.rust-lang.org/nightly/rustdoc/lints.html#intra_doc_link_resolution_failure |
88 |
| - run: rustup default nightly-2020-05-20 |
| 90 | + |
| 91 | + - name: Cancel Previous Runs |
| 92 | + |
| 93 | + with: |
| 94 | + access_token: ${{ github.token }} |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + - uses: Swatinem/[email protected] |
| 99 | + |
89 | 100 | - name: Check rustdoc links
|
90 |
| - run: RUSTDOCFLAGS="--deny intra_doc_link_resolution_failure" cargo doc --verbose --workspace --no-deps --document-private-items |
| 101 | + run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items |
| 102 | + |
| 103 | + check-clippy: |
| 104 | + runs-on: ubuntu-18.04 |
| 105 | + steps: |
| 106 | + |
| 107 | + - name: Cancel Previous Runs |
| 108 | + |
| 109 | + with: |
| 110 | + access_token: ${{ github.token }} |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + - uses: actions-rs/[email protected] |
| 115 | + with: |
| 116 | + profile: minimal |
| 117 | + toolchain: stable |
| 118 | + override: true |
| 119 | + components: clippy |
| 120 | + |
| 121 | + - uses: Swatinem/[email protected] |
| 122 | + |
| 123 | + - name: Run cargo clippy |
| 124 | + uses: actions-rs/[email protected] |
| 125 | + with: |
| 126 | + command: custom-clippy # cargo alias to allow reuse of config locally |
91 | 127 |
|
92 | 128 | integration-test:
|
93 | 129 | name: Integration tests
|
94 |
| - runs-on: ubuntu-latest |
| 130 | + runs-on: ubuntu-18.04 |
95 | 131 | container:
|
96 | 132 | image: rust
|
97 | 133 | steps:
|
98 |
| - - uses: actions/checkout@v1 |
99 |
| - - name: Cache cargo registry |
100 |
| - uses: actions/cache@v1 |
101 |
| - with: |
102 |
| - path: ~/.cargo/registry |
103 |
| - key: cargo-registry-${{ hashFiles('Cargo.toml') }} |
104 |
| - - name: Cache cargo index |
105 |
| - uses: actions/cache@v1 |
106 |
| - with: |
107 |
| - path: ~/.cargo/git |
108 |
| - key: cargo-index-${{ hashFiles('Cargo.toml') }} |
109 |
| - - name: Cache cargo build |
110 |
| - uses: actions/cache@v1 |
| 134 | + |
| 135 | + - name: Cancel Previous Runs |
| 136 | + |
111 | 137 | with:
|
112 |
| - path: target |
113 |
| - key: cargo-build-target-${{ hashFiles('Cargo.toml') }} |
| 138 | + access_token: ${{ github.token }} |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + - uses: Swatinem/[email protected] |
| 143 | + |
114 | 144 | - name: Run ipfs-kad example
|
115 | 145 | run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad
|
| 146 | + |
| 147 | + rustfmt: |
| 148 | + runs-on: ubuntu-18.04 |
| 149 | + steps: |
| 150 | + |
| 151 | + - name: Cancel Previous Runs |
| 152 | + |
| 153 | + with: |
| 154 | + access_token: ${{ github.token }} |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + - uses: actions-rs/[email protected] |
| 159 | + with: |
| 160 | + profile: minimal |
| 161 | + toolchain: stable |
| 162 | + override: true |
| 163 | + components: rustfmt |
| 164 | + |
| 165 | + - name: Check formatting |
| 166 | + run: cargo fmt -- --check |
0 commit comments