blob: bdfec885b11531bacf8ae51db6db84221bf35c16 [file] [log] [blame]
Radek Krejcif4d97292020-11-30 16:38:32 +01001name: libyang CI
Michal Vasko8bdbf852021-04-14 16:19:17 +02002on:
Radek Krejcif4d97292020-11-30 16:38:32 +01003 push:
4 branches:
Michal Vasko0791e802021-05-27 10:29:14 +02005 - master
6 - devel
Radek Krejcif4d97292020-11-30 16:38:32 +01007 pull_request:
8 branches:
Michal Vasko0791e802021-05-27 10:29:14 +02009 - master
10 - devel
Radek Krejcif4d97292020-11-30 16:38:32 +010011
12jobs:
Michal Vaskoa2177482021-05-28 10:29:41 +020013 git-branch:
14 name: Get git branch
15 runs-on: ubuntu-18.04
16 outputs:
17 branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
18 steps:
19 - id: get-git-branch
20 run: |
21 if ${{ github.event_name == 'push' }}
22 then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
23 else
24 export GIT_BRANCH=${{ github.base_ref }}
25 fi
26 echo "::set-output name=branch-name::$GIT_BRANCH"
Radek Krejcif4d97292020-11-30 16:38:32 +010027 build:
28 name: ${{ matrix.config.name }}
29 runs-on: ${{ matrix.config.os }}
Michal Vaskoa2177482021-05-28 10:29:41 +020030 needs: git-branch
Radek Krejcif4d97292020-11-30 16:38:32 +010031 strategy:
32 fail-fast: false
33 matrix:
34 config:
35 - {
36 name: "Release, Ubuntu 18.04, gcc",
37 os: "ubuntu-18.04",
38 build-type: "Release",
39 cc: "gcc",
40 options: "-DENABLE_BUILD_TESTS=ON",
41 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020042 packages: "libcmocka-dev shunit2",
43 snaps: "",
44 make-prepend: "",
45 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010046 }
47 - {
48 name: "Release, Ubuntu 18.04, clang",
49 os: "ubuntu-18.04",
50 build-type: "Release",
51 cc: "clang",
52 options: "-DENABLE_BUILD_TESTS=ON",
53 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020054 packages: "libcmocka-dev shunit2",
55 snaps: "",
56 make-prepend: "",
57 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010058 }
59 - {
60 name: "Debug, Ubuntu 18.04, gcc",
61 os: "ubuntu-18.04",
62 build-type: "Debug",
63 cc: "gcc",
64 options: "",
65 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020066 packages: "libcmocka-dev valgrind shunit2",
67 snaps: "",
68 make-prepend: "",
69 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010070 }
71 - {
72 name: "Debug, Ubuntu 18.04, clang",
73 os: "ubuntu-18.04",
74 build-type: "Debug",
75 cc: "clang",
76 options: "",
77 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020078 packages: "libcmocka-dev valgrind shunit2",
79 snaps: "",
80 make-prepend: "",
81 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010082 }
83 - {
84 name: "Release, macOS 10.15, clang",
85 os: "macos-10.15",
86 build-type: "Release",
87 cc: "clang",
88 options: "-DENABLE_BUILD_TESTS=ON",
89 packager: "brew",
Michal Vaskoa2177482021-05-28 10:29:41 +020090 packages: "cmocka shunit2",
91 snaps: "",
92 make-prepend: "",
93 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010094 }
95 - {
96 name: "ASAN and UBSAN",
97 os: "ubuntu-18.04",
98 build-type: "Debug",
99 cc: "clang",
100 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_BUILD_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF",
101 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +0200102 packages: "libcmocka-dev",
103 snaps: "",
104 make-prepend: "",
105 make-target: ""
106 }
107 - {
108 name: "ABI Check",
109 os: "ubuntu-latest",
110 build-type: "ABICheck",
111 cc: "gcc",
112 options: "",
Michal Vaskob5043682021-05-28 10:33:24 +0200113 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +0200114 packages: "libcmocka-dev abi-dumper abi-compliance-checker",
115 snaps: "core universal-ctags",
116 make-prepend: "",
117 make-target: "abi-check"
118 }
Radek Krejcif4d97292020-11-30 16:38:32 +0100119
120 steps:
121 - uses: actions/checkout@v2
122
Michal Vaskoa2177482021-05-28 10:29:41 +0200123 - name: Deps-packages
124 shell: bash
125 run: |
126 ${{ matrix.config.packager }} update
127 if ${{ matrix.config.packages != '' }}
128 then ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
129 fi
130 if ${{ matrix.config.snaps != '' }}
131 then sudo snap install ${{ matrix.config.snaps }}
132 fi
133
134 - name: Deps-uncrustify
Michal Vasko8bdbf852021-04-14 16:19:17 +0200135 shell: bash
136 working-directory: ${{ github.workspace }}
137 run: |
138 git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
139 cd uncrustify
140 mkdir build
141 cd build
142 CC=${{ matrix.config.cc }} cmake ..
143 make
144 sudo make install
145 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
146
Radek Krejcif4d97292020-11-30 16:38:32 +0100147 - name: Configure
148 shell: bash
149 working-directory: ${{ github.workspace }}
150 run: |
151 mkdir build
152 cd build
153 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
154
155 - name: Build
156 shell: bash
157 working-directory: ${{ github.workspace }}/build
Michal Vaskoa2177482021-05-28 10:29:41 +0200158 run: |
159 export LC_ALL=C.UTF-8
160 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
161 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
Radek Krejcif4d97292020-11-30 16:38:32 +0100162
163 - name: Test
164 shell: bash
165 working-directory: ${{ github.workspace }}/build
166 run: ctest --output-on-failure