blob: 80f360f1279494e28af68df2260155862454ea16 [file] [log] [blame]
Michal Vasko7f55a302021-06-03 10:17:37 +02001name: libyang devel push
2on:
3 push:
4 branches:
5 - devel
6
7env:
8 COVERITY_PROJECT: CESNET%2Flibyang
9
10jobs:
11 git-branch:
12 name: Get git branch
13 runs-on: ubuntu-18.04
14 outputs:
15 branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
16 steps:
17 - id: get-git-branch
18 run: |
19 if ${{ github.event_name == 'push' }}
20 then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
21 else
22 export GIT_BRANCH=${{ github.base_ref }}
23 fi
24 echo "::set-output name=branch-name::$GIT_BRANCH"
25 build:
26 name: ${{ matrix.config.name }}
27 runs-on: ${{ matrix.config.os }}
28 needs: git-branch
29 strategy:
30 fail-fast: false
31 matrix:
32 config:
33 - {
34 name: "Coverity",
35 os: "ubuntu-latest",
36 build-type: "Debug",
37 cc: "clang",
38 options: "",
39 packager: "sudo apt-get",
40 packages: "",
41 snaps: "",
42 make-prepend: "cov-build --dir cov-int",
43 make-target: ""
44 }
45 - {
46 name: "Codecov",
47 os: "ubuntu-latest",
48 build-type: "Debug",
49 cc: "gcc",
50 options: "-DENABLE_COVERAGE=ON",
51 packager: "sudo apt-get",
52 packages: "libcmocka-dev lcov",
53 snaps: "",
54 make-prepend: "",
55 make-target: ""
56 }
57
58 steps:
59 - uses: actions/checkout@v2
60
61 - name: Deps-packages
62 shell: bash
63 run: |
64 ${{ matrix.config.packager }} update
65 if ${{ matrix.config.packages != '' }}
66 then ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
67 fi
68 if ${{ matrix.config.snaps != '' }}
69 then sudo snap install ${{ matrix.config.snaps }}
70 fi
71
72 - name: Deps-coverity
73 shell: bash
74 working-directory: ${{ github.workspace }}
75 run: |
76 wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz
77 mkdir coverity-tools
78 tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools
79 env:
80 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
81 if: ${{ matrix.config.name == 'Coverity' }}
82
83 - name: Configure
84 shell: bash
85 working-directory: ${{ github.workspace }}
86 run: |
87 mkdir build
88 cd build
89 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
90
91 - name: Build
92 shell: bash
93 working-directory: ${{ github.workspace }}/build
94 run: |
95 export LC_ALL=C.UTF-8
96 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
97 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
98
99 - name: Test
100 shell: bash
101 working-directory: ${{ github.workspace }}/build
102 run: ctest --output-on-failure
103
104 - name: Upload to Coverity.com
105 shell: bash
106 working-directory: ${{ github.workspace }}/build
107 run: |
108 tar czvf libyang.tgz cov-int
109 curl \
110 --form token=$TOKEN \
111 --form email=mvasko@cesnet.cz \
112 --form file=libyang.tgz \
113 --form version="`./yanglint -v | cut -d\" \" -f2`" \
114 --form description="libyang YANG library" \
115 https://scan.coverity.com/builds?project=$COVERITY_PROJECT
116 env:
117 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
118 if: ${{ matrix.config.name == 'Coverity' }}
119
120 - name: Upload to Codecov.io
121 shell: bash
122 working-directory: ${{ github.workspace }}/build
123 run: bash <(curl -s https://codecov.io/bash)
124 if: ${{ matrix.config.name == 'Codecov' }}