actions UPDATE set pkg-config path #258
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: netopeer2 devel push | |
on: | |
push: | |
branches: | |
- devel | |
env: | |
DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev libcurl4-openssl-dev | |
COVERITY_PROJECT: CESNET%2FNetopeer2 | |
jobs: | |
git-branch: | |
name: Get git branch | |
runs-on: ubuntu-latest | |
outputs: | |
branch-name: ${{ steps.get-git-branch.outputs.branch-name }} | |
steps: | |
- id: get-git-branch | |
run: | | |
if ${{ github.event_name == 'push' }} | |
then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3` | |
else | |
export GIT_BRANCH=${{ github.base_ref }} | |
fi | |
echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
needs: git-branch | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Coverity", | |
os: "ubuntu-latest", | |
build-type: "Debug", | |
dep-build-type: "Debug", | |
cc: "clang", | |
options: "", | |
packages: "", | |
snaps: "", | |
make-prepend: "cov-build --dir cov-int", | |
make-target: "" | |
} | |
- { | |
name: "Codecov", | |
os: "ubuntu-latest", | |
build-type: "Debug", | |
dep-build-type: "Debug", | |
cc: "gcc", | |
options: "-DENABLE_COVERAGE=ON", | |
packages: "libcmocka-dev lcov", | |
snaps: "", | |
make-prepend: "", | |
make-target: "" | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Deps-packages | |
shell: bash | |
run: | | |
sudo add-apt-repository ppa:kedazo/libssh-0.7.x -y | |
sudo apt-get update | |
sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }} | |
if ${{ matrix.config.snaps != '' }} | |
then sudo snap install ${{ matrix.config.snaps }} | |
fi | |
- name: Deps-coverity | |
shell: bash | |
working-directory: ${{ github.workspace }} | |
run: | | |
wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz | |
mkdir coverity-tools | |
tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools | |
env: | |
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} | |
if: ${{ matrix.config.name == 'Coverity' }} | |
- name: Deps-libyang | |
shell: bash | |
run: | | |
git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git | |
cd libyang | |
mkdir build | |
cd build | |
CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF .. | |
make -j2 | |
sudo make install | |
- name: Deps-sysrepo | |
shell: bash | |
run: | | |
git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/sysrepo/sysrepo.git | |
cd sysrepo | |
mkdir build | |
cd build | |
CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -DENABLE_TESTS=OFF .. | |
make -j2 | |
sudo make install | |
- name: Deps-libnetconf2 | |
shell: bash | |
run: | | |
git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libnetconf2.git | |
cd libnetconf2 | |
mkdir build | |
cd build | |
CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -DENABLE_TESTS=OFF .. | |
make -j2 | |
sudo make install | |
- name: Deps-update-ld-cache | |
shell: bash | |
run: sudo ldconfig | |
- name: Configure | |
shell: bash | |
working-directory: ${{ github.workspace }} | |
run: | | |
mkdir build | |
cd build | |
CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} .. | |
- name: Build | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: | | |
export LC_ALL=C.UTF-8 | |
export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH | |
${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }} | |
- name: Test | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: ctest --output-on-failure -j4 | |
- name: Upload to Coverity.com | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: | | |
tar czvf netopeer2.tgz cov-int | |
curl \ | |
--form token=$TOKEN \ | |
--form email=mvasko@cesnet.cz \ | |
--form file=@netopeer2.tgz \ | |
--form version="`./netopeer2-server -V | head -n1 | cut -d' ' -f 2`" \ | |
--form description="netopeer2 NETCONF suite" \ | |
https://scan.coverity.com/builds?project=$COVERITY_PROJECT | |
env: | |
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} | |
if: ${{ matrix.config.name == 'Coverity' }} | |
- name: Upload to Codecov.io | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: bash <(curl -s https://codecov.io/bash) | |
if: ${{ matrix.config.name == 'Codecov' }} |