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