blob: cb69472100f5f4ed2d5c72d473541007f9a0f808 [file] [log] [blame]
Michal Vasko4eed83e2021-06-03 14:59:30 +02001name: libnetconf2 devel push
2on:
3 push:
4 branches:
5 - devel
6
7env:
romand72bc322023-10-26 15:46:01 +02008 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev libcurl4-openssl-dev
Michal Vasko4eed83e2021-06-03 14:59:30 +02009 COVERITY_PROJECT: CESNET%2Flibnetconf2
10
11jobs:
12 git-branch:
13 name: Get git branch
Michal Vasko80313162022-11-09 11:00:06 +010014 runs-on: ubuntu-latest
Michal Vasko4eed83e2021-06-03 14:59:30 +020015 outputs:
16 branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
17 steps:
18 - id: get-git-branch
19 run: |
20 if ${{ github.event_name == 'push' }}
21 then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
22 else
23 export GIT_BRANCH=${{ github.base_ref }}
24 fi
Michal Vasko1d69b0d2022-11-09 11:06:12 +010025 echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT
Michal Vasko4eed83e2021-06-03 14:59:30 +020026
27 build:
28 name: ${{ matrix.config.name }}
29 runs-on: ${{ matrix.config.os }}
30 needs: git-branch
31 strategy:
32 fail-fast: false
33 matrix:
34 config:
35 - {
36 name: "Coverity",
37 os: "ubuntu-latest",
38 build-type: "Debug",
39 dep-build-type: "Debug",
40 cc: "clang",
41 options: "-DENABLE_DNSSEC=ON",
42 packages: "",
43 snaps: "",
44 make-prepend: "cov-build --dir cov-int",
45 make-target: ""
46 }
47 - {
48 name: "Codecov",
49 os: "ubuntu-latest",
50 build-type: "Debug",
51 dep-build-type: "Debug",
52 cc: "gcc",
53 options: "-DENABLE_COVERAGE=ON -DENABLE_DNSSEC=ON",
54 packages: "lcov",
55 snaps: "",
56 make-prepend: "",
57 make-target: ""
58 }
59
60 steps:
Michal Vasko80313162022-11-09 11:00:06 +010061 - uses: actions/checkout@v3
Michal Vasko4eed83e2021-06-03 14:59:30 +020062
63 - name: Deps-packages
64 shell: bash
65 run: |
66 sudo add-apt-repository ppa:kedazo/libssh-0.7.x -y
67 sudo apt-get update
68 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
69 if ${{ matrix.config.snaps != '' }}
70 then sudo snap install ${{ matrix.config.snaps }}
71 fi
72
73 - name: Deps-coverity
74 shell: bash
75 working-directory: ${{ github.workspace }}
76 run: |
77 wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz
78 mkdir coverity-tools
79 tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools
80 env:
81 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
82 if: ${{ matrix.config.name == 'Coverity' }}
83
84 - name: Deps-libyang
85 shell: bash
86 run: |
Michal Vasko1d69b0d2022-11-09 11:06:12 +010087 git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git
Michal Vasko4eed83e2021-06-03 14:59:30 +020088 cd libyang
89 mkdir build
90 cd build
Michal Vaskoe2298282021-11-12 15:36:24 +010091 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF ..
Michal Vasko4eed83e2021-06-03 14:59:30 +020092 make -j2
93 sudo make install
94
95 - name: Deps-libval
96 shell: bash
97 run: |
98 git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools
99 cd dnssec-tools/dnssec-tools/validator
100 ./configure
101 make -j2
102 sudo make install
103
104 - name: Configure
105 shell: bash
106 working-directory: ${{ github.workspace }}
107 run: |
108 mkdir build
109 cd build
110 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
111
112 - name: Build
113 shell: bash
114 working-directory: ${{ github.workspace }}/build
115 run: |
116 export LC_ALL=C.UTF-8
117 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
118 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
119
120 - name: Test
121 shell: bash
122 working-directory: ${{ github.workspace }}/build
123 run: ctest --output-on-failure
124
125 - name: Upload to Coverity.com
126 shell: bash
127 working-directory: ${{ github.workspace }}/build
128 run: |
129 tar czvf libnetconf2.tgz cov-int
130 curl \
131 --form token=$TOKEN \
132 --form email=mvasko@cesnet.cz \
133 --form file=@libnetconf2.tgz \
134 --form version="`grep Version ./libnetconf2.pc | cut -d' ' -f 2`" \
135 --form description="libnetconf2 NETCONF library" \
136 https://scan.coverity.com/builds?project=$COVERITY_PROJECT
137 env:
138 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
139 if: ${{ matrix.config.name == 'Coverity' }}
140
141 - name: Upload to Codecov.io
142 shell: bash
143 working-directory: ${{ github.workspace }}/build
144 run: bash <(curl -s https://codecov.io/bash)
145 if: ${{ matrix.config.name == 'Codecov' }}