blob: c30d6c32800d724dfbb2373d59e591fb4f56f586 [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:
13 build:
14 name: ${{ matrix.config.name }}
15 runs-on: ${{ matrix.config.os }}
16 strategy:
17 fail-fast: false
18 matrix:
19 config:
20 - {
21 name: "Release, Ubuntu 18.04, gcc",
22 os: "ubuntu-18.04",
23 build-type: "Release",
24 cc: "gcc",
Michal Vaskocdffdab2021-06-23 14:00:10 +020025 options: "-DENABLE_TESTS=ON",
Radek Krejcif4d97292020-11-30 16:38:32 +010026 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020027 packages: "libcmocka-dev shunit2",
28 snaps: "",
29 make-prepend: "",
30 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010031 }
32 - {
33 name: "Release, Ubuntu 18.04, clang",
34 os: "ubuntu-18.04",
35 build-type: "Release",
36 cc: "clang",
Michal Vaskocdffdab2021-06-23 14:00:10 +020037 options: "-DENABLE_TESTS=ON",
Radek Krejcif4d97292020-11-30 16:38:32 +010038 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020039 packages: "libcmocka-dev shunit2",
40 snaps: "",
41 make-prepend: "",
42 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010043 }
44 - {
45 name: "Debug, Ubuntu 18.04, gcc",
46 os: "ubuntu-18.04",
47 build-type: "Debug",
48 cc: "gcc",
49 options: "",
50 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020051 packages: "libcmocka-dev valgrind shunit2",
52 snaps: "",
53 make-prepend: "",
54 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010055 }
56 - {
57 name: "Debug, Ubuntu 18.04, clang",
58 os: "ubuntu-18.04",
59 build-type: "Debug",
60 cc: "clang",
61 options: "",
62 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020063 packages: "libcmocka-dev valgrind shunit2",
64 snaps: "",
65 make-prepend: "",
66 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010067 }
68 - {
69 name: "Release, macOS 10.15, clang",
70 os: "macos-10.15",
71 build-type: "Release",
72 cc: "clang",
Michal Vaskocdffdab2021-06-23 14:00:10 +020073 options: "-DENABLE_TESTS=ON",
Radek Krejcif4d97292020-11-30 16:38:32 +010074 packager: "brew",
Michal Vaskoa2177482021-05-28 10:29:41 +020075 packages: "cmocka shunit2",
76 snaps: "",
77 make-prepend: "",
78 make-target: ""
Radek Krejcif4d97292020-11-30 16:38:32 +010079 }
80 - {
81 name: "ASAN and UBSAN",
82 os: "ubuntu-18.04",
83 build-type: "Debug",
84 cc: "clang",
Michal Vaskocdffdab2021-06-23 14:00:10 +020085 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF",
Radek Krejcif4d97292020-11-30 16:38:32 +010086 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020087 packages: "libcmocka-dev",
88 snaps: "",
89 make-prepend: "",
90 make-target: ""
91 }
92 - {
93 name: "ABI Check",
94 os: "ubuntu-latest",
95 build-type: "ABICheck",
96 cc: "gcc",
97 options: "",
Michal Vaskob5043682021-05-28 10:33:24 +020098 packager: "sudo apt-get",
Michal Vaskoa2177482021-05-28 10:29:41 +020099 packages: "libcmocka-dev abi-dumper abi-compliance-checker",
100 snaps: "core universal-ctags",
101 make-prepend: "",
102 make-target: "abi-check"
103 }
Radek Krejcif4d97292020-11-30 16:38:32 +0100104
105 steps:
106 - uses: actions/checkout@v2
107
Michal Vaskoa2177482021-05-28 10:29:41 +0200108 - name: Deps-packages
109 shell: bash
110 run: |
111 ${{ matrix.config.packager }} update
112 if ${{ matrix.config.packages != '' }}
113 then ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
114 fi
115 if ${{ matrix.config.snaps != '' }}
116 then sudo snap install ${{ matrix.config.snaps }}
117 fi
118
119 - name: Deps-uncrustify
Michal Vasko8bdbf852021-04-14 16:19:17 +0200120 shell: bash
121 working-directory: ${{ github.workspace }}
122 run: |
123 git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
124 cd uncrustify
125 mkdir build
126 cd build
127 CC=${{ matrix.config.cc }} cmake ..
128 make
129 sudo make install
130 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
131
Radek Krejcif4d97292020-11-30 16:38:32 +0100132 - name: Configure
133 shell: bash
134 working-directory: ${{ github.workspace }}
135 run: |
136 mkdir build
137 cd build
138 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
139
140 - name: Build
141 shell: bash
142 working-directory: ${{ github.workspace }}/build
Michal Vaskoa2177482021-05-28 10:29:41 +0200143 run: |
144 export LC_ALL=C.UTF-8
145 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
146 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
Radek Krejcif4d97292020-11-30 16:38:32 +0100147
148 - name: Test
149 shell: bash
150 working-directory: ${{ github.workspace }}/build
151 run: ctest --output-on-failure