Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 1 | name: libnetconf2 devel push |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - devel |
| 6 | |
| 7 | env: |
roman | 41a11e4 | 2022-06-22 09:27:08 +0200 | [diff] [blame] | 8 | DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev |
Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 9 | COVERITY_PROJECT: CESNET%2Flibnetconf2 |
| 10 | |
| 11 | jobs: |
| 12 | git-branch: |
| 13 | name: Get git branch |
Michal Vasko | 8031316 | 2022-11-09 11:00:06 +0100 | [diff] [blame] | 14 | runs-on: ubuntu-latest |
Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 15 | outputs: |
| 16 | branch-name: ${{ steps.get-git-branch.outputs.branch-name }} |
| 17 | steps: |
| 18 | - id: get-git-branch |
| 19 | run: | |
| 20 | if ${{ github.event_name == 'push' }} |
| 21 | then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3` |
| 22 | else |
| 23 | export GIT_BRANCH=${{ github.base_ref }} |
| 24 | fi |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 25 | echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT |
Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 26 | |
| 27 | build: |
| 28 | name: ${{ matrix.config.name }} |
| 29 | runs-on: ${{ matrix.config.os }} |
| 30 | needs: git-branch |
| 31 | strategy: |
| 32 | fail-fast: false |
| 33 | matrix: |
| 34 | config: |
| 35 | - { |
| 36 | name: "Coverity", |
| 37 | os: "ubuntu-latest", |
| 38 | build-type: "Debug", |
| 39 | dep-build-type: "Debug", |
| 40 | cc: "clang", |
| 41 | options: "-DENABLE_DNSSEC=ON", |
| 42 | packages: "", |
| 43 | snaps: "", |
| 44 | make-prepend: "cov-build --dir cov-int", |
| 45 | make-target: "" |
| 46 | } |
| 47 | - { |
| 48 | name: "Codecov", |
| 49 | os: "ubuntu-latest", |
| 50 | build-type: "Debug", |
| 51 | dep-build-type: "Debug", |
| 52 | cc: "gcc", |
| 53 | options: "-DENABLE_COVERAGE=ON -DENABLE_DNSSEC=ON", |
| 54 | packages: "lcov", |
| 55 | snaps: "", |
| 56 | make-prepend: "", |
| 57 | make-target: "" |
| 58 | } |
| 59 | |
| 60 | steps: |
Michal Vasko | 8031316 | 2022-11-09 11:00:06 +0100 | [diff] [blame] | 61 | - uses: actions/checkout@v3 |
Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 62 | |
| 63 | - name: Deps-packages |
| 64 | shell: bash |
| 65 | run: | |
| 66 | sudo add-apt-repository ppa:kedazo/libssh-0.7.x -y |
| 67 | sudo apt-get update |
| 68 | sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }} |
| 69 | if ${{ matrix.config.snaps != '' }} |
| 70 | then sudo snap install ${{ matrix.config.snaps }} |
| 71 | fi |
| 72 | |
| 73 | - name: Deps-coverity |
| 74 | shell: bash |
| 75 | working-directory: ${{ github.workspace }} |
| 76 | run: | |
| 77 | wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz |
| 78 | mkdir coverity-tools |
| 79 | tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools |
| 80 | env: |
| 81 | TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
| 82 | if: ${{ matrix.config.name == 'Coverity' }} |
| 83 | |
| 84 | - name: Deps-libyang |
| 85 | shell: bash |
| 86 | run: | |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 87 | git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git |
Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 88 | cd libyang |
| 89 | mkdir build |
| 90 | cd build |
Michal Vasko | e229828 | 2021-11-12 15:36:24 +0100 | [diff] [blame] | 91 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF .. |
Michal Vasko | 4eed83e | 2021-06-03 14:59:30 +0200 | [diff] [blame] | 92 | make -j2 |
| 93 | sudo make install |
| 94 | |
| 95 | - name: Deps-libval |
| 96 | shell: bash |
| 97 | run: | |
| 98 | git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools |
| 99 | cd dnssec-tools/dnssec-tools/validator |
| 100 | ./configure |
| 101 | make -j2 |
| 102 | sudo make install |
| 103 | |
| 104 | - name: Configure |
| 105 | shell: bash |
| 106 | working-directory: ${{ github.workspace }} |
| 107 | run: | |
| 108 | mkdir build |
| 109 | cd build |
| 110 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} .. |
| 111 | |
| 112 | - name: Build |
| 113 | shell: bash |
| 114 | working-directory: ${{ github.workspace }}/build |
| 115 | run: | |
| 116 | export LC_ALL=C.UTF-8 |
| 117 | export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH |
| 118 | ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }} |
| 119 | |
| 120 | - name: Test |
| 121 | shell: bash |
| 122 | working-directory: ${{ github.workspace }}/build |
| 123 | run: ctest --output-on-failure |
| 124 | |
| 125 | - name: Upload to Coverity.com |
| 126 | shell: bash |
| 127 | working-directory: ${{ github.workspace }}/build |
| 128 | run: | |
| 129 | tar czvf libnetconf2.tgz cov-int |
| 130 | curl \ |
| 131 | --form token=$TOKEN \ |
| 132 | --form email=mvasko@cesnet.cz \ |
| 133 | --form file=@libnetconf2.tgz \ |
| 134 | --form version="`grep Version ./libnetconf2.pc | cut -d' ' -f 2`" \ |
| 135 | --form description="libnetconf2 NETCONF library" \ |
| 136 | https://scan.coverity.com/builds?project=$COVERITY_PROJECT |
| 137 | env: |
| 138 | TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
| 139 | if: ${{ matrix.config.name == 'Coverity' }} |
| 140 | |
| 141 | - name: Upload to Codecov.io |
| 142 | shell: bash |
| 143 | working-directory: ${{ github.workspace }}/build |
| 144 | run: bash <(curl -s https://codecov.io/bash) |
| 145 | if: ${{ matrix.config.name == 'Codecov' }} |