aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: c20c9dd95ffd7d420c1500b2254ba1256d1dc44f (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
name: ci

on:
  pull_request:
  push:
    branches:
      - master
      - staging
      - trying
  schedule:
    - cron: '00 01 * * *'

env:
  RUSTFLAGS: -Dwarnings

jobs:
  test:
    name: test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          # This is the minimum supported Rust version of this crate.
          # When updating this, the reminder to update the minimum supported
          # Rust version in README.md.
          #
          # Tests are not run as tests may require newer versions of Rust.
          - 1.31.0
          - stable
          - beta
          - nightly
    steps:
      - uses: actions/checkout@master
      - name: Install Rust
        shell: bash
        run: |
          . ./ci/install-rust.sh ${{ matrix.rust }}
      - name: Install cargo-hack
        if: matrix.rust != '1.31.0'
        run: |
          cargo install cargo-hack
      - name: cargo check
        if: matrix.rust == '1.31.0'
        run: |
          cargo check --all-features
      - name: cargo test
        if: matrix.rust != '1.31.0'
        run: |
          cargo test --all-features
      - name: cargo hack check --each-feature
        if: matrix.rust != '1.31.0'
        run: |
          cargo hack check --all --each-feature --no-dev-deps
      # Refs: https://github.com/rust-lang/cargo/issues/5657
      - name: cargo check -Zminimal-versions
        if: matrix.rust == 'nightly'
        run: |
          cargo update -Zminimal-versions
          cargo hack check --all --all-features --no-dev-deps --ignore-private

  style:
    name: style
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        component:
          - clippy
          - rustfmt
          - rustdoc
    steps:
      - uses: actions/checkout@master
      - name: Install Rust
        shell: bash
        run: |
          . ./ci/install-rust.sh
      - name: Install component
        if: matrix.component != 'rustdoc'
        shell: bash
        run: |
          . ./ci/install-component.sh ${{ matrix.component }}
      - name: cargo clippy
        if: matrix.component == 'clippy'
        run: |
          cargo clippy --all --all-features
      - name: cargo fmt -- --check
        if: matrix.component == 'rustfmt'
        run: |
          cargo fmt --all -- --check
      - name: cargo doc
        if: matrix.component == 'rustdoc'
        env:
          RUSTDOCFLAGS: -Dwarnings
        run: |
          cargo doc --no-deps --all --all-features