blob: 5d01a0c7bbe91591dc5e70707aab401cd3dead4b [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:
Michal Vasko7f55a302021-06-03 10:17:37 +020011 build:
12 name: ${{ matrix.config.name }}
13 runs-on: ${{ matrix.config.os }}
Michal Vasko7f55a302021-06-03 10:17:37 +020014 strategy:
15 fail-fast: false
16 matrix:
17 config:
18 - {
19 name: "Coverity",
20 os: "ubuntu-latest",
21 build-type: "Debug",
22 cc: "clang",
23 options: "",
24 packager: "sudo apt-get",
25 packages: "",
26 snaps: "",
27 make-prepend: "cov-build --dir cov-int",
28 make-target: ""
29 }
30 - {
31 name: "Codecov",
32 os: "ubuntu-latest",
33 build-type: "Debug",
34 cc: "gcc",
35 options: "-DENABLE_COVERAGE=ON",
36 packager: "sudo apt-get",
37 packages: "libcmocka-dev lcov",
38 snaps: "",
39 make-prepend: "",
40 make-target: ""
41 }
42
43 steps:
Vincent JARDINb66f0252024-03-20 14:03:30 +010044 - uses: actions/checkout@main
Michal Vasko7f55a302021-06-03 10:17:37 +020045
46 - name: Deps-packages
47 shell: bash
48 run: |
49 ${{ matrix.config.packager }} update
50 if ${{ matrix.config.packages != '' }}
51 then ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
52 fi
53 if ${{ matrix.config.snaps != '' }}
54 then sudo snap install ${{ matrix.config.snaps }}
55 fi
56
57 - name: Deps-coverity
58 shell: bash
59 working-directory: ${{ github.workspace }}
60 run: |
61 wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz
62 mkdir coverity-tools
63 tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools
64 env:
65 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
66 if: ${{ matrix.config.name == 'Coverity' }}
67
Michal Vasko7f55a302021-06-03 10:17:37 +020068 - name: Configure
69 shell: bash
70 working-directory: ${{ github.workspace }}
71 run: |
72 mkdir build
73 cd build
74 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
75
76 - name: Build
77 shell: bash
78 working-directory: ${{ github.workspace }}/build
79 run: |
80 export LC_ALL=C.UTF-8
81 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
82 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
83
84 - name: Test
85 shell: bash
86 working-directory: ${{ github.workspace }}/build
87 run: ctest --output-on-failure
88
89 - name: Upload to Coverity.com
90 shell: bash
91 working-directory: ${{ github.workspace }}/build
92 run: |
93 tar czvf libyang.tgz cov-int
94 curl \
95 --form token=$TOKEN \
96 --form email=mvasko@cesnet.cz \
Michal Vasko60dc2582021-06-04 11:12:01 +020097 --form file=@libyang.tgz \
Michal Vasko7f55a302021-06-03 10:17:37 +020098 --form version="`./yanglint -v | cut -d\" \" -f2`" \
99 --form description="libyang YANG library" \
100 https://scan.coverity.com/builds?project=$COVERITY_PROJECT
101 env:
102 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
103 if: ${{ matrix.config.name == 'Coverity' }}
104
105 - name: Upload to Codecov.io
106 shell: bash
107 working-directory: ${{ github.workspace }}/build
108 run: bash <(curl -s https://codecov.io/bash)
109 if: ${{ matrix.config.name == 'Codecov' }}