File: lint.yml

package info (click to toggle)
libvpl-tools 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,640 kB
  • sloc: cpp: 107,613; python: 4,303; ansic: 3,202; sh: 159; lisp: 52; makefile: 13
file content (67 lines) | stat: -rw-r--r-- 1,647 bytes parent folder | download | duplicates (3)
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
---
name: Lint

permissions: read-all

on:
  workflow_call:
    inputs:
      docker_opts:
        description: 'extra options for docker build'
        required: false
        type: string
  workflow_dispatch:
    inputs:
      docker_opts:
        description: 'extra options for docker build'
        required: false
        type: string
jobs:
  lint:
    name: Lint
    runs-on: [self-hosted, linux, docker]
    steps:

      - name: Cleanup workspace
        run: sudo rm -rf ..?* .[!.]* *

      - name: Checkout PR branch and all history
        uses: actions/checkout@v4
        with:
          path: source
          fetch-depth: 0

      - name: Build Docker image
        run: >
          docker build ${{ inputs.docker_opts }}
          -f "source/.github/workflows/lint/Dockerfile.ubuntu.lint"
          --build-arg USER_ID=$(id -u)
          --build-arg GROUP_ID=$(id -g)
          -t vpl_lint:ubuntu
          "source/.github/workflows/lint"

      - name: Lint source in container
        run: |
          cat <<'EOL' > lint.sh
          #!/bin/bash
          set -x
          set -o pipefail
          source/script/test lint | tee lint.log
          ret=$?
          set +o pipefail
          exit $ret
          EOL
          chmod +x lint.sh

          docker run --rm -v $(pwd):/tmp/work -w /tmp/work \
          vpl_lint:ubuntu ./lint.sh

      - name: Report
        if: success() || failure()
        run: |
            echo '```' >> $GITHUB_STEP_SUMMARY
            cat lint.log >> $GITHUB_STEP_SUMMARY
            echo '```' >> $GITHUB_STEP_SUMMARY

      - name: Cleanup workspace
        run: sudo rm -rf ..?* .[!.]* *