pipechecker 0.2.10

CI/CD Pipeline Auditor - Catch errors before you push
Documentation
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  RUST_BACKTRACE: 1
  CARGO_INCREMENTAL: 0
  SCCACHE_VERSION: "0.8.0"

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-registry-

      - name: Clippy
        run: cargo clippy -- -D warnings

      - name: Formatting check
        run: cargo fmt -- --check

  security:
    name: Security
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: security-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: security-cargo-registry-

      - name: Cache cargo-audit binary
        id: cache-cargo-audit
        uses: actions/cache@v4
        with:
          path: ~/.cargo/bin/cargo-audit
          key: cargo-audit-bin-v1

      - name: Install cargo-audit
        if: steps.cache-cargo-audit.outputs.cache-hit != 'true'
        run: cargo install cargo-audit --locked

      - name: Run security audit
        run: cargo audit
        env:
          ADVISORY_DB_CACHE_DIR: /tmp/advisory-db

      - name: Cache cargo-deny binary
        id: cache-cargo-deny
        uses: actions/cache@v4
        with:
          path: ~/.cargo/bin/cargo-deny
          key: cargo-deny-bin-v1

      - name: Install cargo-deny
        if: steps.cache-cargo-deny.outputs.cache-hit != 'true'
        run: cargo install cargo-deny --locked

      - name: Run cargo deny
        run: cargo deny --all-features check bans licenses sources

  docs:
    name: Docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: docs-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: docs-cargo-registry-

      - name: Build documentation
        run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items

  coverage:
    name: Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: coverage-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: coverage-cargo-registry-

      - name: Cache cargo-tarpaulin binary
        id: cache-tarpaulin
        uses: actions/cache@v4
        with:
          path: ~/.cargo/bin/cargo-tarpaulin
          key: cargo-tarpaulin-bin-v1

      - name: Install cargo-tarpaulin
        if: steps.cache-tarpaulin.outputs.cache-hit != 'true'
        run: cargo install cargo-tarpaulin --locked

      - name: Generate coverage report
        run: |
          mkdir -p coverage
          cargo tarpaulin \
            --out Json \
            --output-dir ./coverage \
            --fail-under 54

      - name: Upload coverage reports
        uses: actions/upload-artifact@v4
        with:
          name: coverage-report
          path: coverage/
        continue-on-error: true

      - name: Generate summary
        run: |
          echo "## Code Coverage" >> $GITHUB_STEP_SUMMARY
          REPORT=$(find coverage -name "*.json" -type f | head -1)
          if [ -z "$REPORT" ]; then
            echo "No coverage report found" >> $GITHUB_STEP_SUMMARY
          else
            python3 - "$REPORT" <<'PYEOF' >> $GITHUB_STEP_SUMMARY || echo "Failed to parse coverage report" >> $GITHUB_STEP_SUMMARY
          import json, sys
          with open(sys.argv[1]) as f:
              d = json.load(f)
          covered = d.get('covered', 0)
          coverable = d.get('coverable', 1)
          pct = covered / coverable * 100
          print(f'**Coverage: {pct:.1f}%** ({covered}/{coverable} lines)')
          PYEOF
          fi

  # Full matrix — push to main only
  test:
    name: Test (${{ matrix.target }})
    needs: [lint, security, docs]
    if: github.event_name != 'pull_request'
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            sccache-arch: x86_64-unknown-linux-musl

          - os: macos-latest
            target: aarch64-apple-darwin
            sccache-arch: aarch64-apple-darwin

          - os: windows-latest
            target: x86_64-pc-windows-msvc
            sccache-arch: x86_64-pc-windows-msvc

          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            sccache-arch: x86_64-unknown-linux-musl
            use-cross: true

    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install sccache (Linux / macOS)
        if: runner.os != 'Windows'
        shell: bash
        run: |
          URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${{ matrix.sccache-arch }}.tar.gz"
          curl -sSL "$URL" | tar -xz
          mkdir -p "$CARGO_HOME/bin"
          mv "sccache-v${SCCACHE_VERSION}-${{ matrix.sccache-arch }}/sccache" "$CARGO_HOME/bin/"
          chmod +x "$CARGO_HOME/bin/sccache"
          echo "RUSTC_WRAPPER=$CARGO_HOME/bin/sccache" >> "$GITHUB_ENV"
          "$CARGO_HOME/bin/sccache" --start-server

      - name: Install sccache (Windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          $url = "https://github.com/mozilla/sccache/releases/download/v$env:SCCACHE_VERSION/sccache-v$env:SCCACHE_VERSION-${{ matrix.sccache-arch }}.tar.gz"
          Invoke-WebRequest $url -OutFile sccache.tar.gz
          tar -xzf sccache.tar.gz
          $dest = "$env:CARGO_HOME\bin"
          New-Item -ItemType Directory -Force -Path $dest | Out-Null
          Move-Item "sccache-v$env:SCCACHE_VERSION-${{ matrix.sccache-arch }}\sccache.exe" "$dest\sccache.exe"
          Add-Content $env:GITHUB_ENV "RUSTC_WRAPPER=$dest\sccache.exe"
          & "$dest\sccache.exe" --start-server

      - name: Cache sccache storage
        uses: actions/cache@v4
        with:
          path: |
            ~/.cache/sccache
            ~/AppData/Local/Mozilla/sccache
          key: ${{ runner.os }}-sccache-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-sccache-${{ matrix.target }}-
            ${{ runner.os }}-sccache-

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-registry-

      - name: Cache build artifacts
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-${{ matrix.target }}-target-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-${{ matrix.target }}-target-

      - name: Cache cross binary
        if: matrix.use-cross == true
        id: cache-cross
        uses: actions/cache@v4
        with:
          path: ~/.cargo/bin/cross
          key: cross-bin-v1

      - name: Install cross
        if: matrix.use-cross == true && steps.cache-cross.outputs.cache-hit != 'true'
        run: cargo install cross --locked

      - name: Build
        shell: bash
        run: |
          if [ "${{ matrix.use-cross }}" = "true" ]; then
            cross build --target ${{ matrix.target }}
          else
            cargo build --target ${{ matrix.target }}
          fi

      - name: Run tests
        shell: bash
        run: |
          if [ "${{ matrix.use-cross }}" = "true" ]; then
            cross test --target ${{ matrix.target }}
          else
            cargo test --target ${{ matrix.target }}
          fi

      - name: Test CLI
        if: matrix.use-cross != true
        shell: bash
        run: |
          cargo run -- -- tests/fixtures/github/valid.yml
          cargo run -- tests/fixtures/github/circular.yml || true

      - name: Print sccache stats
        if: always() && runner.os != 'Windows'
        shell: bash
        run: $CARGO_HOME/bin/sccache --show-stats
        continue-on-error: true

  # Reduced matrix — pull requests only
  test-pr:
    name: Test PR (${{ matrix.target }})
    needs: [lint, security, docs]
    if: github.event_name == 'pull_request'
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            sccache-arch: x86_64-unknown-linux-musl

          - os: macos-latest
            target: aarch64-apple-darwin
            sccache-arch: aarch64-apple-darwin

          - os: windows-latest
            target: x86_64-pc-windows-msvc
            sccache-arch: x86_64-pc-windows-msvc

    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install sccache (Linux / macOS)
        if: runner.os != 'Windows'
        shell: bash
        run: |
          URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${{ matrix.sccache-arch }}.tar.gz"
          curl -sSL "$URL" | tar -xz
          mkdir -p "$CARGO_HOME/bin"
          mv "sccache-v${SCCACHE_VERSION}-${{ matrix.sccache-arch }}/sccache" "$CARGO_HOME/bin/"
          chmod +x "$CARGO_HOME/bin/sccache"
          echo "RUSTC_WRAPPER=$CARGO_HOME/bin/sccache" >> "$GITHUB_ENV"
          "$CARGO_HOME/bin/sccache" --start-server

      - name: Install sccache (Windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          $url = "https://github.com/mozilla/sccache/releases/download/v$env:SCCACHE_VERSION/sccache-v$env:SCCACHE_VERSION-${{ matrix.sccache-arch }}.tar.gz"
          Invoke-WebRequest $url -OutFile sccache.tar.gz
          tar -xzf sccache.tar.gz
          $dest = "$env:CARGO_HOME\bin"
          New-Item -ItemType Directory -Force -Path $dest | Out-Null
          Move-Item "sccache-v$env:SCCACHE_VERSION-${{ matrix.sccache-arch }}\sccache.exe" "$dest\sccache.exe"
          Add-Content $env:GITHUB_ENV "RUSTC_WRAPPER=$dest\sccache.exe"
          & "$dest\sccache.exe" --start-server

      - name: Cache sccache storage
        uses: actions/cache@v4
        with:
          path: |
            ~/.cache/sccache
            ~/AppData/Local/Mozilla/sccache
          key: ${{ runner.os }}-sccache-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-sccache-${{ matrix.target }}-
            ${{ runner.os }}-sccache-

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-registry-

      - name: Cache build artifacts
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-${{ matrix.target }}-target-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-${{ matrix.target }}-target-

      - name: Build
        shell: bash
        run: cargo build --target ${{ matrix.target }}

      - name: Run tests
        shell: bash
        run: cargo test --target ${{ matrix.target }}

      - name: Test CLI
        shell: bash
        run: |
          cargo run -- -- tests/fixtures/github/valid.yml
          cargo run -- tests/fixtures/github/circular.yml || true

      - name: Print sccache stats
        if: always() && runner.os != 'Windows'
        shell: bash
        run: $CARGO_HOME/bin/sccache --show-stats
        continue-on-error: true