File: main.yaml

package info (click to toggle)
rust-async-codec-lite 0.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 256 kB
  • sloc: makefile: 2
file content (186 lines) | stat: -rw-r--r-- 5,769 bytes parent folder | download
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: main

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  # skip ci if the last commit contains the appropriate tag
  skip-commit:
    name: Conditionally skip ci
    runs-on: ubuntu-latest
    steps:
      - if: "contains(github.event.head_commit.message, '[skip-ci]')
          || contains(github.event.head_commit.message, '[skip ci]')
          || contains(github.event.head_commit.message, '[ci-skip]')
          || contains(github.event.head_commit.message, '[ci skip]')"
        run: exit 78

  # verify that Cargo.lock passes audit
  cargo-audit:
    name: Run cargo audit
    needs: [skip-commit]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Fetch latest release version of cargo-audit
      run: |
        mkdir -p .github/caching
        cargo search cargo-audit | grep '^cargo-audit' | awk '{gsub(/"/,"",$3); print $3}' > .github/caching/cargo-audit.lock
    - name: Cache cargo-audit/bin
      id: cache-cargo-audit
      uses: actions/cache@v1
      with:
        path: ${{ runner.tool_cache }}/cargo-audit/bin
        key: cargo-audit-bin-${{ hashFiles('.github/caching/cargo-audit.lock') }}
    - name: Install cargo-audit
      if: "steps.cache-cargo-audit.outputs.cache-hit != 'true'"
      uses: actions-rs/cargo@v1
      with:
        command: install
        args: --root ${{ runner.tool_cache }}/cargo-audit --force cargo-audit
    - run: echo "${{ runner.tool_cache }}/cargo-audit/bin" >> $GITHUB_PATH
    - run: cargo audit

  # verify that project passes clippy lints
  cargo-clippy:
    name: Run cargo clippy
    needs: [skip-commit]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          components: clippy
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: true
      - name: Run cargo clippy
        uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-features --all-targets --workspace -- -D warnings

  # build the documentation
  cargo-docs:
    name: Run cargo docs
    needs: [skip-commit]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: nightly
    steps:
      - uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: true
      - name: Run cargo doc
        uses: actions-rs/cargo@v1
        with:
          command: doc
          args: --all-features --no-deps
      - uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./target/doc
        if: github.event_name == 'push' && github.ref == 'refs/heads/main'

  # verify that code is formatted
  cargo-fmt:
    name: Run cargo fmt
    needs: [skip-commit]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: nightly
    steps:
      - uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          components: rustfmt
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: true
      - name: Run cargo fmt
        uses: actions-rs/cargo@v1
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          command: fmt
          args: --all -- --check

  # verify that tests pass and calculate coverage with tarpaulin
  cargo-test-coverage:
    name: Run cargo tarpaulin
    needs: [skip-commit]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: nightly
    steps:
      - uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: true
      - name: Fetch latest release version of cargo-tarpaulin
        run: |
          mkdir -p .github/caching
          curl -sL https://api.github.com/repos/xd009642/tarpaulin/releases/latest | jq -r '.name' > .github/caching/cargo-tarpaulin.lock
      - name: Cache cargo-tarpaulin/bin
        id: cache-cargo-tarpaulin
        uses: actions/cache@v1
        with:
          path: ${{ runner.tool_cache }}/cargo-tarpaulin/bin
          key: cargo-tarpaulin-bin-${{ hashFiles('.github/caching/cargo-tarpaulin.lock') }}
      - name: Install cargo-tarpaulin
        if: "steps.cache-cargo-tarpaulin.outputs.cache-hit != 'true'"
        uses: actions-rs/cargo@v1
        with:
          command: install
          args: --root ${{ runner.tool_cache }}/cargo-tarpaulin --force cargo-tarpaulin
      - run: echo "${{ runner.tool_cache }}/cargo-tarpaulin/bin" >> $GITHUB_PATH
      - name: Run cargo tarpaulin
        uses: actions-rs/cargo@v1
        with:
          command: tarpaulin
          args: --all-features
      - name: Upload to codecov.io
        uses: codecov/codecov-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true

  # verify that tests pass
  cargo-test:
    name: Run cargo test
    needs: [skip-commit]
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    env:
      RUST_TOOLCHAIN: stable
    steps:
      - uses: actions/checkout@v2
      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          override: yes
      - name: Run cargo test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features