blob: 6c59a23ff67c5574a9411bebfadfaec3336910a1 [file] [log] [blame]
name: libyang CI
on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel
jobs:
build-unix:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Release, Ubuntu 18.04, gcc",
os: "ubuntu-18.04",
build-type: "Release",
cc: "gcc",
options: "-DENABLE_TESTS=ON",
packager: "sudo apt-get",
packages: "libcmocka-dev shunit2",
snaps: "",
make-prepend: "",
make-target: ""
}
- {
name: "Release, Ubuntu 18.04, clang",
os: "ubuntu-18.04",
build-type: "Release",
cc: "clang",
options: "-DENABLE_TESTS=ON",
packager: "sudo apt-get",
packages: "libcmocka-dev shunit2",
snaps: "",
make-prepend: "",
make-target: ""
}
- {
name: "Debug, Ubuntu 18.04, gcc",
os: "ubuntu-18.04",
build-type: "Debug",
cc: "gcc",
options: "",
packager: "sudo apt-get",
packages: "libcmocka-dev valgrind shunit2",
snaps: "",
make-prepend: "",
make-target: ""
}
- {
name: "Debug, Ubuntu 18.04, clang",
os: "ubuntu-18.04",
build-type: "Debug",
cc: "clang",
options: "",
packager: "sudo apt-get",
packages: "libcmocka-dev valgrind shunit2",
snaps: "",
make-prepend: "",
make-target: ""
}
- {
name: "Release, macOS 10.15, clang",
os: "macos-10.15",
build-type: "Release",
cc: "clang",
options: "-DENABLE_TESTS=ON",
packager: "brew",
packages: "cmocka shunit2",
snaps: "",
make-prepend: "",
make-target: ""
}
- {
name: "ASAN and UBSAN",
os: "ubuntu-18.04",
build-type: "Debug",
cc: "clang",
options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF",
packager: "sudo apt-get",
packages: "libcmocka-dev",
snaps: "",
make-prepend: "",
make-target: ""
}
- {
name: "ABI Check",
os: "ubuntu-latest",
build-type: "ABICheck",
cc: "gcc",
options: "",
packager: "sudo apt-get",
packages: "libcmocka-dev abi-dumper abi-compliance-checker",
snaps: "core universal-ctags",
make-prepend: "",
make-target: "abi-check"
}
steps:
- uses: actions/checkout@v2
- name: Deps-packages
shell: bash
run: |
${{ matrix.config.packager }} update
if ${{ matrix.config.packages != '' }}
then ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
fi
if ${{ matrix.config.snaps != '' }}
then sudo snap install ${{ matrix.config.snaps }}
fi
- name: Deps-uncrustify
shell: bash
working-directory: ${{ github.workspace }}
run: |
git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
cd uncrustify
mkdir build
cd build
CC=${{ matrix.config.cc }} cmake ..
make
sudo make install
if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
- 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
build-windows:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: "Windows 2022 MSVC 16 LF"
os: windows-2022
triplet: x64-windows
build_type: Release
generators: "Visual Studio 17 2022"
autocrlf: input
eol: lf
- name: "Windows 2022 MSVC 16 no autoCRLF"
os: windows-2022
triplet: x64-windows
build_type: Release
generators: "Visual Studio 17 2022"
steps:
- name: Unix line endings in git
if: matrix.autocrlf
run: |
git config --global core.autocrlf ${{ matrix.autocrlf }}
- name: Unix line endings in git
if: matrix.eol
run: |
git config --global core.eol ${{ matrix.eol }}
- uses: actions/checkout@v2
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@5e7112c2e8c5b63b649a678bc2fb5920d0c8202e
- name: Install Windows dependencies
run: vcpkg install --triplet=${{ matrix.triplet }} pcre2 pthreads dirent dlfcn-win32 cmocka getopt
- name: Configure
shell: bash
run: |
cmake \
-S '${{ github.workspace }}/' \
-B '${{ github.workspace }}/'../build \
-G '${{ matrix.generators }}' \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT//\\//}/scripts/buildsystems/vcpkg.cmake \
-DENABLE_TESTS=ON \
'-DCMAKE_INSTALL_PREFIX:PATH=${{ github.workspace }}'/../target
- name: Build
working-directory: '${{ github.workspace }}/../build'
run: cmake --build . -j${{ steps.cpu-cores.outputs.count }} --config ${{ matrix.build_type }}
- name: Test
working-directory: '${{ github.workspace }}/../build'
run: ctest --output-on-failure -j${{ steps.cpu-cores.outputs.count }} --build-config ${{ matrix.build_type }}
- name: Install
working-directory: '${{ github.workspace }}/../build'
run: cmake --install . --strip