Michal Vasko | 7f55a30 | 2021-06-03 10:17:37 +0200 | [diff] [blame] | 1 | name: libyang devel push |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - devel |
| 6 | |
| 7 | env: |
| 8 | COVERITY_PROJECT: CESNET%2Flibyang |
| 9 | |
| 10 | jobs: |
Michal Vasko | 7f55a30 | 2021-06-03 10:17:37 +0200 | [diff] [blame] | 11 | build: |
| 12 | name: ${{ matrix.config.name }} |
| 13 | runs-on: ${{ matrix.config.os }} |
Michal Vasko | 7f55a30 | 2021-06-03 10:17:37 +0200 | [diff] [blame] | 14 | strategy: |
| 15 | fail-fast: false |
| 16 | matrix: |
| 17 | config: |
| 18 | - { |
| 19 | name: "Coverity", |
| 20 | os: "ubuntu-latest", |
| 21 | build-type: "Debug", |
| 22 | cc: "clang", |
| 23 | options: "", |
| 24 | packager: "sudo apt-get", |
| 25 | packages: "", |
| 26 | snaps: "", |
| 27 | make-prepend: "cov-build --dir cov-int", |
| 28 | make-target: "" |
| 29 | } |
| 30 | - { |
| 31 | name: "Codecov", |
| 32 | os: "ubuntu-latest", |
| 33 | build-type: "Debug", |
| 34 | cc: "gcc", |
| 35 | options: "-DENABLE_COVERAGE=ON", |
| 36 | packager: "sudo apt-get", |
| 37 | packages: "libcmocka-dev lcov", |
| 38 | snaps: "", |
| 39 | make-prepend: "", |
| 40 | make-target: "" |
| 41 | } |
| 42 | |
| 43 | steps: |
Michal Vasko | 09bddf9 | 2022-11-09 12:04:11 +0100 | [diff] [blame] | 44 | - uses: actions/checkout@v3 |
Michal Vasko | 7f55a30 | 2021-06-03 10:17:37 +0200 | [diff] [blame] | 45 | |
| 46 | - name: Deps-packages |
| 47 | shell: bash |
| 48 | run: | |
| 49 | ${{ matrix.config.packager }} update |
| 50 | if ${{ matrix.config.packages != '' }} |
| 51 | then ${{ matrix.config.packager }} install ${{ matrix.config.packages }} |
| 52 | fi |
| 53 | if ${{ matrix.config.snaps != '' }} |
| 54 | then sudo snap install ${{ matrix.config.snaps }} |
| 55 | fi |
| 56 | |
| 57 | - name: Deps-coverity |
| 58 | shell: bash |
| 59 | working-directory: ${{ github.workspace }} |
| 60 | run: | |
| 61 | wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz |
| 62 | mkdir coverity-tools |
| 63 | tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools |
| 64 | env: |
| 65 | TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
| 66 | if: ${{ matrix.config.name == 'Coverity' }} |
| 67 | |
Michal Vasko | 7f55a30 | 2021-06-03 10:17:37 +0200 | [diff] [blame] | 68 | - name: Configure |
| 69 | shell: bash |
| 70 | working-directory: ${{ github.workspace }} |
| 71 | run: | |
| 72 | mkdir build |
| 73 | cd build |
| 74 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} .. |
| 75 | |
| 76 | - name: Build |
| 77 | shell: bash |
| 78 | working-directory: ${{ github.workspace }}/build |
| 79 | run: | |
| 80 | export LC_ALL=C.UTF-8 |
| 81 | export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH |
| 82 | ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }} |
| 83 | |
| 84 | - name: Test |
| 85 | shell: bash |
| 86 | working-directory: ${{ github.workspace }}/build |
| 87 | run: ctest --output-on-failure |
| 88 | |
| 89 | - name: Upload to Coverity.com |
| 90 | shell: bash |
| 91 | working-directory: ${{ github.workspace }}/build |
| 92 | run: | |
| 93 | tar czvf libyang.tgz cov-int |
| 94 | curl \ |
| 95 | --form token=$TOKEN \ |
| 96 | --form email=mvasko@cesnet.cz \ |
Michal Vasko | 60dc258 | 2021-06-04 11:12:01 +0200 | [diff] [blame] | 97 | --form file=@libyang.tgz \ |
Michal Vasko | 7f55a30 | 2021-06-03 10:17:37 +0200 | [diff] [blame] | 98 | --form version="`./yanglint -v | cut -d\" \" -f2`" \ |
| 99 | --form description="libyang YANG library" \ |
| 100 | https://scan.coverity.com/builds?project=$COVERITY_PROJECT |
| 101 | env: |
| 102 | TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
| 103 | if: ${{ matrix.config.name == 'Coverity' }} |
| 104 | |
| 105 | - name: Upload to Codecov.io |
| 106 | shell: bash |
| 107 | working-directory: ${{ github.workspace }}/build |
| 108 | run: bash <(curl -s https://codecov.io/bash) |
| 109 | if: ${{ matrix.config.name == 'Codecov' }} |