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: |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 13 | 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 Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 27 | build: |
| 28 | name: ${{ matrix.config.name }} |
| 29 | runs-on: ${{ matrix.config.os }} |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 30 | needs: git-branch |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 31 | 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", |
Michal Vasko | cdffdab | 2021-06-23 14:00:10 +0200 | [diff] [blame] | 40 | options: "-DENABLE_TESTS=ON", |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 41 | packager: "sudo apt-get", |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 42 | packages: "libcmocka-dev shunit2", |
| 43 | snaps: "", |
| 44 | make-prepend: "", |
| 45 | make-target: "" |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 46 | } |
| 47 | - { |
| 48 | name: "Release, Ubuntu 18.04, clang", |
| 49 | os: "ubuntu-18.04", |
| 50 | build-type: "Release", |
| 51 | cc: "clang", |
Michal Vasko | cdffdab | 2021-06-23 14:00:10 +0200 | [diff] [blame] | 52 | options: "-DENABLE_TESTS=ON", |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 53 | packager: "sudo apt-get", |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 54 | packages: "libcmocka-dev shunit2", |
| 55 | snaps: "", |
| 56 | make-prepend: "", |
| 57 | make-target: "" |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 58 | } |
| 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 Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 66 | packages: "libcmocka-dev valgrind shunit2", |
| 67 | snaps: "", |
| 68 | make-prepend: "", |
| 69 | make-target: "" |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 70 | } |
| 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 Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 78 | packages: "libcmocka-dev valgrind shunit2", |
| 79 | snaps: "", |
| 80 | make-prepend: "", |
| 81 | make-target: "" |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 82 | } |
| 83 | - { |
| 84 | name: "Release, macOS 10.15, clang", |
| 85 | os: "macos-10.15", |
| 86 | build-type: "Release", |
| 87 | cc: "clang", |
Michal Vasko | cdffdab | 2021-06-23 14:00:10 +0200 | [diff] [blame] | 88 | options: "-DENABLE_TESTS=ON", |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 89 | packager: "brew", |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 90 | packages: "cmocka shunit2", |
| 91 | snaps: "", |
| 92 | make-prepend: "", |
| 93 | make-target: "" |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 94 | } |
| 95 | - { |
| 96 | name: "ASAN and UBSAN", |
| 97 | os: "ubuntu-18.04", |
| 98 | build-type: "Debug", |
| 99 | cc: "clang", |
Michal Vasko | cdffdab | 2021-06-23 14:00:10 +0200 | [diff] [blame] | 100 | options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF", |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 101 | packager: "sudo apt-get", |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 102 | 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 Vasko | b504368 | 2021-05-28 10:33:24 +0200 | [diff] [blame] | 113 | packager: "sudo apt-get", |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 114 | packages: "libcmocka-dev abi-dumper abi-compliance-checker", |
| 115 | snaps: "core universal-ctags", |
| 116 | make-prepend: "", |
| 117 | make-target: "abi-check" |
| 118 | } |
Radek Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 119 | |
| 120 | steps: |
| 121 | - uses: actions/checkout@v2 |
| 122 | |
Michal Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 123 | - 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 Vasko | 8bdbf85 | 2021-04-14 16:19:17 +0200 | [diff] [blame] | 135 | 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 Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 147 | - 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 Vasko | a217748 | 2021-05-28 10:29:41 +0200 | [diff] [blame] | 158 | 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 Krejci | f4d9729 | 2020-11-30 16:38:32 +0100 | [diff] [blame] | 162 | |
| 163 | - name: Test |
| 164 | shell: bash |
| 165 | working-directory: ${{ github.workspace }}/build |
| 166 | run: ctest --output-on-failure |