blob: 0665a9e0bf11c81322d7e619d30419f30636facd [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:
5 - libyang2
6 pull_request:
7 branches:
8 - libyang2
9
10jobs:
11 build:
12 name: ${{ matrix.config.name }}
13 runs-on: ${{ matrix.config.os }}
14 strategy:
15 fail-fast: false
16 matrix:
17 config:
18 - {
19 name: "Release, Ubuntu 18.04, gcc",
20 os: "ubuntu-18.04",
21 build-type: "Release",
22 cc: "gcc",
23 options: "-DENABLE_BUILD_TESTS=ON",
24 packager: "sudo apt-get",
25 packages: "libcmocka-dev shunit2"
26 }
27 - {
28 name: "Release, Ubuntu 18.04, clang",
29 os: "ubuntu-18.04",
30 build-type: "Release",
31 cc: "clang",
32 options: "-DENABLE_BUILD_TESTS=ON",
33 packager: "sudo apt-get",
34 packages: "libcmocka-dev shunit2"
35 }
36 - {
37 name: "Debug, Ubuntu 18.04, gcc",
38 os: "ubuntu-18.04",
39 build-type: "Debug",
40 cc: "gcc",
41 options: "",
42 packager: "sudo apt-get",
43 packages: "libcmocka-dev valgrind shunit2"
44 }
45 - {
46 name: "Debug, Ubuntu 18.04, clang",
47 os: "ubuntu-18.04",
48 build-type: "Debug",
49 cc: "clang",
50 options: "",
51 packager: "sudo apt-get",
52 packages: "libcmocka-dev valgrind shunit2"
53 }
54 - {
55 name: "Release, macOS 10.15, clang",
56 os: "macos-10.15",
57 build-type: "Release",
58 cc: "clang",
59 options: "-DENABLE_BUILD_TESTS=ON",
60 packager: "brew",
61 packages: "cmocka shunit2"
62 }
63 - {
64 name: "ASAN and UBSAN",
65 os: "ubuntu-18.04",
66 build-type: "Debug",
67 cc: "clang",
68 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_BUILD_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF",
69 packager: "sudo apt-get",
70 packages: "libcmocka-dev"
71 }
72
73 steps:
74 - uses: actions/checkout@v2
75
Michal Vasko8bdbf852021-04-14 16:19:17 +020076 - name: Uncrustify
77 shell: bash
78 working-directory: ${{ github.workspace }}
79 run: |
80 git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
81 cd uncrustify
82 mkdir build
83 cd build
84 CC=${{ matrix.config.cc }} cmake ..
85 make
86 sudo make install
87 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
88
Radek Krejcif4d97292020-11-30 16:38:32 +010089 - name: Dependencies
90 shell: bash
91 run: |
Radek Krejcicc590d12021-01-03 13:20:32 +010092 ${{ matrix.config.packager }} update
Radek Krejcif4d97292020-11-30 16:38:32 +010093 ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
94
95 - name: Configure
96 shell: bash
97 working-directory: ${{ github.workspace }}
98 run: |
99 mkdir build
100 cd build
101 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
102
103 - name: Build
104 shell: bash
105 working-directory: ${{ github.workspace }}/build
106 run: make
107
108 - name: Test
109 shell: bash
110 working-directory: ${{ github.workspace }}/build
111 run: ctest --output-on-failure
112
113 abi:
114 runs-on: ubuntu-latest
115 steps:
116 - uses: actions/checkout@v2
117
118 - name: Dependencies
119 shell: bash
120 run: |
121 sudo apt-get install abi-dumper abi-compliance-checker
122 sudo snap install core universal-ctags
123
124 - name: Configure
125 shell: bash
126 working-directory: ${{ github.workspace }}
127 run: |
128 mkdir build
129 cd build
130 CC=gcc cmake -DCMAKE_BUILD_TYPE=ABICheck ..
131
132 - name: Build
133 shell: bash
134 working-directory: ${{ github.workspace }}/build
135 run: LC_ALL=C.UTF-8 PATH=/snap/bin:$PATH make abi-check
136
137 coverage:
138 runs-on: ubuntu-latest
139 steps:
140 - uses: actions/checkout@v2
141
142 - name: Dependencies
143 shell: bash
144 run: |
Radek Krejci7903f9a2020-12-01 13:53:26 +0100145 sudo apt-get install libcmocka-dev lcov
Radek Krejcif4d97292020-11-30 16:38:32 +0100146
147 - name: Configure
148 shell: bash
149 working-directory: ${{ github.workspace }}
150 run: |
151 mkdir build
152 cd build
153 CC=gcc cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
154
155 - name: Build
156 shell: bash
157 working-directory: ${{ github.workspace }}/build
158 run: make
159
160 - name: Test
161 shell: bash
162 working-directory: ${{ github.workspace }}/build
163 run: ctest --output-on-failure
164
165 - name: Uploade to Codecov.io
166 shell: bash
167 working-directory: ${{ github.workspace }}/build
168 run: bash <(curl -s https://codecov.io/bash)