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