|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: |
| 5 | + - '**' |
| 6 | + - '!/*.md' |
| 7 | + - '!/docs/**' |
| 8 | + - "!/LICENSE-*" |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + paths: |
| 13 | + - '**' |
| 14 | + - '!/*.md' |
| 15 | + - '!/docs/**' |
| 16 | + - "!/LICENSE-*" |
| 17 | + schedule: |
| 18 | + - cron: '16 16 */2 * *' |
| 19 | +jobs: |
| 20 | + ci: |
| 21 | + name: CI |
| 22 | + needs: [smoke, test, msrv, docs, rustfmt, clippy] |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Done |
| 26 | + run: exit 0 |
| 27 | + smoke: |
| 28 | + name: Quick Check |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v2 |
| 33 | + - name: Install Rust |
| 34 | + uses: actions-rs/toolchain@v1 |
| 35 | + with: |
| 36 | + toolchain: stable |
| 37 | + profile: minimal |
| 38 | + override: true |
| 39 | + - uses: Swatinem/rust-cache@v1 |
| 40 | + - name: Default features |
| 41 | + run: cargo check --workspace --all-targets |
| 42 | + - name: All features |
| 43 | + run: cargo check --workspace --all-targets --all-features |
| 44 | + - name: No-default features |
| 45 | + run: cargo check --workspace --all-targets --no-default-features |
| 46 | + test: |
| 47 | + name: Test |
| 48 | + needs: smoke |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 52 | + rust: ["stable"] |
| 53 | + continue-on-error: ${{ matrix.rust != 'stable' }} |
| 54 | + runs-on: ${{ matrix.os }} |
| 55 | + steps: |
| 56 | + - name: Checkout repository |
| 57 | + uses: actions/checkout@v2 |
| 58 | + - name: Install Rust |
| 59 | + uses: actions-rs/toolchain@v1 |
| 60 | + with: |
| 61 | + toolchain: ${{ matrix.rust }} |
| 62 | + profile: minimal |
| 63 | + override: true |
| 64 | + - uses: Swatinem/rust-cache@v1 |
| 65 | + - name: Default features |
| 66 | + run: cargo test --workspace |
| 67 | + - name: All features |
| 68 | + run: cargo test --workspace --all-features |
| 69 | + - name: No-default features |
| 70 | + run: cargo test --workspace --no-default-features |
| 71 | + msrv: |
| 72 | + name: "Check MSRV: 1.46.0" |
| 73 | + needs: smoke |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Checkout repository |
| 77 | + uses: actions/checkout@v2 |
| 78 | + - name: Install Rust |
| 79 | + uses: actions-rs/toolchain@v1 |
| 80 | + with: |
| 81 | + toolchain: 1.46.0 # MSRV |
| 82 | + profile: minimal |
| 83 | + override: true |
| 84 | + - uses: Swatinem/rust-cache@v1 |
| 85 | + - name: Default features |
| 86 | + run: cargo check --workspace --all-targets |
| 87 | + - name: All features |
| 88 | + run: cargo check --workspace --all-targets --all-features |
| 89 | + - name: No-default features |
| 90 | + run: cargo check --workspace --all-targets --no-default-features |
| 91 | + docs: |
| 92 | + name: Docs |
| 93 | + needs: smoke |
| 94 | + runs-on: ubuntu-latest |
| 95 | + steps: |
| 96 | + - name: Checkout repository |
| 97 | + uses: actions/checkout@v2 |
| 98 | + - name: Install Rust |
| 99 | + uses: actions-rs/toolchain@v1 |
| 100 | + with: |
| 101 | + toolchain: stable |
| 102 | + profile: minimal |
| 103 | + override: true |
| 104 | + - uses: Swatinem/rust-cache@v1 |
| 105 | + - name: Check documentation |
| 106 | + env: |
| 107 | + RUSTDOCFLAGS: -D warnings |
| 108 | + run: cargo doc --no-deps --document-private-items --workspace |
| 109 | + rustfmt: |
| 110 | + name: rustfmt |
| 111 | + runs-on: ubuntu-latest |
| 112 | + steps: |
| 113 | + - name: Checkout repository |
| 114 | + uses: actions/checkout@v2 |
| 115 | + - name: Install Rust |
| 116 | + uses: actions-rs/toolchain@v1 |
| 117 | + with: |
| 118 | + # Not MSRV because its harder to jump between versions and people are |
| 119 | + # more likely to have stable |
| 120 | + toolchain: stable |
| 121 | + profile: minimal |
| 122 | + override: true |
| 123 | + components: rustfmt |
| 124 | + - uses: Swatinem/rust-cache@v1 |
| 125 | + - name: Check formatting |
| 126 | + run: cargo fmt --all -- --check |
| 127 | + clippy: |
| 128 | + name: clippy |
| 129 | + runs-on: ubuntu-latest |
| 130 | + steps: |
| 131 | + - name: Checkout repository |
| 132 | + uses: actions/checkout@v2 |
| 133 | + - name: Install Rust |
| 134 | + uses: actions-rs/toolchain@v1 |
| 135 | + with: |
| 136 | + toolchain: 1.46.0 # MSRV |
| 137 | + profile: minimal |
| 138 | + override: true |
| 139 | + components: clippy |
| 140 | + - uses: Swatinem/rust-cache@v1 |
| 141 | + - uses: actions-rs/clippy-check@v1 |
| 142 | + with: |
| 143 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 144 | + args: --workspace --all-features --all-targets -- -D warnings |
0 commit comments