blob: 7d9aa06981d7f63849f8ad60ae8bbc171b93080b [file] [log] [blame]
Radek Krejcif4d97292020-11-30 16:38:32 +01001name: libyang CI
2on:
3 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
76 - name: Dependencies
77 shell: bash
78 run: |
Radek Krejcicc590d12021-01-03 13:20:32 +010079 ${{ matrix.config.packager }} update
Radek Krejcif4d97292020-11-30 16:38:32 +010080 ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
81
82 - name: Configure
83 shell: bash
84 working-directory: ${{ github.workspace }}
85 run: |
86 mkdir build
87 cd build
88 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
89
90 - name: Build
91 shell: bash
92 working-directory: ${{ github.workspace }}/build
93 run: make
94
95 - name: Test
96 shell: bash
97 working-directory: ${{ github.workspace }}/build
98 run: ctest --output-on-failure
99
100 abi:
101 runs-on: ubuntu-latest
102 steps:
103 - uses: actions/checkout@v2
104
105 - name: Dependencies
106 shell: bash
107 run: |
108 sudo apt-get install abi-dumper abi-compliance-checker
109 sudo snap install core universal-ctags
110
111 - name: Configure
112 shell: bash
113 working-directory: ${{ github.workspace }}
114 run: |
115 mkdir build
116 cd build
117 CC=gcc cmake -DCMAKE_BUILD_TYPE=ABICheck ..
118
119 - name: Build
120 shell: bash
121 working-directory: ${{ github.workspace }}/build
122 run: LC_ALL=C.UTF-8 PATH=/snap/bin:$PATH make abi-check
123
124 coverage:
125 runs-on: ubuntu-latest
126 steps:
127 - uses: actions/checkout@v2
128
129 - name: Dependencies
130 shell: bash
131 run: |
Radek Krejci7903f9a2020-12-01 13:53:26 +0100132 sudo apt-get install libcmocka-dev lcov
Radek Krejcif4d97292020-11-30 16:38:32 +0100133
134 - name: Configure
135 shell: bash
136 working-directory: ${{ github.workspace }}
137 run: |
138 mkdir build
139 cd build
140 CC=gcc cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
141
142 - name: Build
143 shell: bash
144 working-directory: ${{ github.workspace }}/build
145 run: make
146
147 - name: Test
148 shell: bash
149 working-directory: ${{ github.workspace }}/build
150 run: ctest --output-on-failure
151
152 - name: Uploade to Codecov.io
153 shell: bash
154 working-directory: ${{ github.workspace }}/build
155 run: bash <(curl -s https://codecov.io/bash)