File: nightly-static-analysis.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (94 lines) | stat: -rw-r--r-- 2,773 bytes parent folder | download | duplicates (2)
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
name: Nightly static code analysis

on:
  workflow_dispatch:
  schedule:
    - cron: '30 0 * * *'

jobs:

  tics:
    runs-on: [self-hosted, linux, amd64, tiobe, jammy]
    env:
      GOPATH: ${{ github.workspace }}
      # Set PATH to ignore the load of magic binaries from /usr/local/bin and
      # to use the go snap automatically. Note that we install go from the
      # snap in a step below. Without this we get the GitHub-controlled latest
      # version of go.
      PATH: /snap/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:${{ github.workspace }}/bin
      GOROOT: ""
    strategy:
      matrix:
        gochannel:
          - 1.23
        unit-scenario:
          - normal

    steps:
    - name: Checkout code
      uses: actions/checkout@v4
      with:
        # needed for git commit history
        fetch-depth: 0
        # NOTE: checkout the code in a fixed location, even for forks, as this
        # is relevant for go's import system.
        path: ./src/github.com/snapcore/snapd

    - name: Download Debian dependencies
      run: |
          sudo apt clean
          sudo apt update
          sudo apt build-dep -y "${{ github.workspace }}/src/github.com/snapcore/snapd"

    - name: Install the go version
      uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.gochannel }}

    - name: Get deps
      run: |
          cd "${{ github.workspace }}/src/github.com/snapcore/snapd"
          ./get-deps.sh

    - name: Build C
      run: |
          cd "${{ github.workspace }}/src/github.com/snapcore/snapd/cmd"
          ./autogen.sh
          make -j$(nproc)

    - name: Build Go
      run: |
          go build github.com/snapcore/snapd/...

    - name: Test C
      run: |
          cd "${{ github.workspace }}/src/github.com/snapcore/snapd/cmd"
          make distcheck

    - name: Reset code coverage data
      run: |
          rm -rf "${{ github.workspace }}/src/github.com/snapcore/snapd/.coverage"

    - name: Test Go with coverage
      run: |
        go install github.com/boumenot/gocover-cobertura@latest

        cd "${{ github.workspace }}/src/github.com/snapcore/snapd"
        COVERAGE_OUT=.coverage/coverage.txt \
          IGNORE_MISSING=1 \
          ./run-checks --unit
        gocover-cobertura < .coverage/coverage.txt > .coverage/coverage.xml

    - name: Install TICS dependencies
      run: |
          go install honnef.co/go/tools/cmd/staticcheck@latest

    - name: TICS scan
      run: |
        set -x

        source ~/.profile
        export TICSAUTHTOKEN="${{ secrets.TICSAUTHTOKEN }}"
        export TICS=https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=GoProjects

        TICSQServer -project snapd -tmpdir /tmp/tics -branchdir "${{ github.workspace }}/src/github.com/snapcore/snapd"