wireshark/.gitlab-ci.yml

340 lines
10 KiB
YAML

# In the interest of reliability and performance, please avoid installing
# external dependencies here, e.g. via tools/*-setup.sh, apt, dnf, or yum.
# Do so in the appropriate Dockerfile at
# https://gitlab.com/wireshark/wireshark-containers/ instead.
# The resulting images can be found at
# https://hub.docker.com/r/wireshark/wireshark-centos-7-dev
# https://hub.docker.com/r/wireshark/wireshark-centos-8-dev
# https://hub.docker.com/r/wireshark/wireshark-debian-stable-dev
# https://hub.docker.com/r/wireshark/wireshark-fedora-dev
# https://hub.docker.com/r/wireshark/wireshark-opensuse-15.1-dev
# https://hub.docker.com/r/wireshark/wireshark-opensuse-15.2-dev
# https://hub.docker.com/r/wireshark/wireshark-ubuntu-dev
.build: &build
stage: build
after_script:
- for builddir in build/packaging/rpm/BUILD/wireshark-*/build build/packaging/rpm/BUILD/wireshark-* build obj-*; do [ ! -d "$builddir/run" ] || break; done
- if [[ "$CI_JOB_NAME" == "build:rpm-opensuse-"* ]]; then export LD_LIBRARY_PATH=$builddir/run; fi
- if [ -f $builddir/run/tshark ]; then $builddir/run/tshark --version; fi
.build-ubuntu: &build-ubuntu
<<: *build
image: wireshark/wireshark-ubuntu-dev
retry: 1
# https://gould.cx/ted/blog/2017/06/10/ccache-for-Gitlab-CI/
cache:
# XXX Use ${CI_JOB_NAME}-${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} instead?
key: ${CI_JOB_NAME}-master
paths:
- ccache/
before_script:
- useradd user
- locale-gen en_US.UTF-8
- export LANG=en_US.UTF-8
- export PYTEST_ADDOPTS=--skip-missing-programs=dumpcap,rawshark
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
- ccache --show-stats
- export DEB_BUILD_OPTIONS=nocheck
- export DH_QUIET=1
- export MAKEFLAGS=--silent
- mkdir build
- cd build
script:
# setcap restricts our library paths
- CFLAGS=-Wl,-rpath=$(pwd)/run CXXFLAGS=-Wl,-rpath=$(pwd)/run cmake -GNinja $CMAKE_ARGS ..
- ninja
- ninja test-programs
- chown -R user .
- if [ -f run/dumpcap ]; then setcap cap_net_raw,cap_net_admin+eip run/dumpcap; fi
- if [ -f run/dumpcap ]; then su user -c "run/dumpcap -D" ; fi
- su user -c pytest-3
.build-rpm: &build-rpm
<<: *build
artifacts:
paths:
- build/packaging/rpm/RPMS
expire_in: 3 days
# Rely on fedora:latest and debian-stable jobs for testing a recent GCC version.
clang-10: &clang-10
<<: *build-ubuntu
variables:
CC: clang-10
CXX: clang++-10
build:rpm-centos-7:
<<: *build-rpm
image: wireshark/wireshark-centos-7-dev
script:
- mkdir build
- cd build
- cmake3 -GNinja ..
- ninja-build rpm-package
test:rpm-centos-7:
stage: test
image: wireshark/wireshark-centos-7-dev
script:
- yum --nogpgcheck localinstall -y build/packaging/rpm/RPMS/x86_64/*.rpm
- tshark --version
dependencies:
- build:rpm-centos-7
variables:
GIT_STRATEGY: none
build:rpm-centos-8:
<<: *build-rpm
image: wireshark/wireshark-centos-8-dev
script:
- mkdir build
- cd build
- cmake -GNinja ..
- ninja-build rpm-package
test:rpm-centos-8:
stage: test
image: wireshark/wireshark-centos-8-dev
script:
- dnf --nogpgcheck localinstall -y build/packaging/rpm/RPMS/x86_64/*.rpm
- tshark --version
dependencies:
- build:rpm-centos-8
variables:
GIT_STRATEGY: none
build:rpm-opensuse-15.1:
image: wireshark/wireshark-opensuse-15.1-dev
<<: *build-rpm
script:
- mkdir build
- cd build
- cmake -GNinja ..
- ninja rpm-package
test:rpm-opensuse-15.1:
image: wireshark/wireshark-opensuse-15.1-dev
stage: test
script:
- zypper --no-gpg-checks install -y build/packaging/rpm/RPMS/x86_64/*.rpm
- tshark --version
variables:
GIT_STRATEGY: none
dependencies:
- build:rpm-opensuse-15.1
build:rpm-opensuse-15.2:
image: wireshark/wireshark-opensuse-15.2-dev
<<: *build-rpm
script:
- mkdir build
- cd build
- cmake -GNinja ..
- ninja rpm-package
test:rpm-opensuse-15.2:
image: wireshark/wireshark-opensuse-15.2-dev
stage: test
script:
- zypper --no-gpg-checks install -y build/packaging/rpm/RPMS/x86_64/*.rpm
- tshark --version
variables:
GIT_STRATEGY: none
dependencies:
- build:rpm-opensuse-15.2
build:rpm-fedora:
<<: *build-rpm
image: wireshark/wireshark-fedora-dev
script:
- mkdir build
- cd build
- cmake3 -GNinja ..
- ninja rpm-package
test:rpm-fedora:
image: fedora
stage: test
script:
- dnf install -y build/packaging/rpm/RPMS/x86_64/*.rpm
- tshark --version
variables:
GIT_STRATEGY: none
dependencies:
- build:rpm-fedora
# Job to generate packages for Debian stable
build:debian-stable:
<<: *build
image: wireshark/wireshark-debian-stable-dev
script:
# Shared GitLab runners limit the log size to 4M, so reduce verbosity. See
# https://gitlab.com/gitlab-com/support-forum/issues/2790
- dpkg-buildpackage -b --no-sign -jauto
- mkdir debian-packages
- mv ../*.deb debian-packages/
artifacts:
paths:
- debian-packages/*.deb
expire_in: 3 days
test:debian-stable:
image: wireshark/wireshark-debian-stable-dev
stage: test
script:
- DEBIAN_FRONTEND=noninteractive apt-get install ./debian-packages/*.deb -y
- tshark --version
variables:
GIT_STRATEGY: none
dependencies:
- build:debian-stable
# Build Wireshark manuals
# Note: Need ubuntu:focal with `ruby-coderay` and `ruby-asciidoctor-pdf` packages to build PDF docs
docbook:
stage: build
image: wireshark/wireshark-ubuntu-dev
rules:
- changes:
- "docbook/**"
- "epan/wslua/**"
script:
- mkdir build
- cd build
- cmake -GNinja ..
- ninja all_guides
after_script:
- mv build/docbook/wsug_html/ .
- mv build/docbook/wsug_html_chunked/ .
- mv build/docbook/wsdg_html/ .
- mv build/docbook/wsdg_html_chunked/ .
artifacts:
paths:
- wsug_html/
- wsug_html_chunked/
- wsdg_html/
- wsdg_html_chunked/
# Build all doxygen docs
doxygen_all:
stage: build
image: wireshark/wireshark-ubuntu-dev
script:
- mkdir build
- cd build
- cmake -GNinja ..
- ninja wsar_html 2>&1 > doxygen_output.txt | tee doxygen_errors.txt
after_script:
- mv build/wsar_html .
- mv build/doxygen_output.txt .
- mv build/doxygen_errors.txt .
artifacts:
when: always
paths:
- doxygen_errors.txt
- doxygen_output.txt
- wsar_html
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#linux-shared-runners
merge-req:commit-checks:
<<: *build-ubuntu
tags:
- docker
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
# build-ubuntu puts us in `build`.
- cd ..
- bash ./tools/pre-commit 'HEAD^1'
- tools/validate-commit.py
merge-req:ubuntu-dpkg:
<<: *build-ubuntu
tags:
- docker
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
# build-ubuntu puts us in `build`.
- cd ..
- CC=/usr/lib/ccache/gcc CXX=/usr/lib/ccache/g++ dpkg-buildpackage -us -uc -rfakeroot -jauto -Zgzip -zfast
- lintian --suppress-tags library-not-linked-against-libc,copyright-excludes-files-in-native-package --display-experimental --display-info --pedantic --profile debian
merge-req:ubuntu-gcc-ctest:
<<: *build-ubuntu
tags:
- docker
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
# build-ubuntu puts us in `build`.
- perl ../tools/make-version.pl --set-release || ../perl make-version.pl --set-release
- CC=gcc CXX=g++ cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -G Ninja ..
- ninja
- ninja test-programs
- chown -R user .
- su user -c "ctest --parallel 3 --force-new-ctest-process --verbose"
merge-req:ubuntu-clang-other-tests:
extends: clang-10
tags:
- docker
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
# build-ubuntu puts us in `build`.
- cd ..
- python3 tools/checklicenses.py
- ./tools/cppcheck/cppcheck.sh -l 1 -x | tee cppcheck_report.xml
- if [[ -s "cppcheck_report.xml" ]]; then cppcheck-htmlreport --file cppcheck_report.xml --report-dir . ; fi
- cd build
- cmake -DENABLE_EXTRA_COMPILER_WARNINGS=on -DENABLE_CHECKHF_CONFLICT=on -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DENABLE_CCACHE=ON -G Ninja ..
- ninja
- ./run/tshark -v
- sh -c '[ ! -e ../tools/validate-clang-check.sh ] || ../tools/validate-clang-check.sh'
- ninja checkAPI
artifacts:
paths:
- cppcheck_report.xml
- cppcheck_report.html
# XXX This is still beta:
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#windows-shared-runners-beta
# Dockerfile at https://github.com/wireshark/wireshark-windows-dev-docker.
# XXX We currently depend on Qt being installed in C:\Qt on the host. We should
# find a more independent way of installing Qt, e.g. via a download+cache.
merge-req:windows:
tags:
- wireshark-windows-dev
stage: build
rules:
# The wireshark-windows-dev image is only available via a dedicated runner.
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_PROJECT_URL =~ /.*gitlab.com\/wireshark\/wireshark/'
when: always
before_script:
# XXX Find a better location.
- cmd.exe /c "set CI_PIPELINE_SOURCE"
- cmd.exe /c "set CI_PROJECT_URL"
- mkdir c:\Development
- $env:WIRESHARK_BASE_DIR = "C:\Development"
- $env:Configuration = "RelWithDebInfo"
- $env:Path += ";C:\Program Files\CMake\bin"
- $env:Path += ";C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin"
- $env:Path += ";C:\qt\5.15.1\msvc2019_64\bin"
# https://help.appveyor.com/discussions/questions/18777-how-to-use-vcvars64bat-from-powershell
- cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt"
- Get-Content "$env:temp\vcvars.txt" | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } }
# Testing / debugging only.
#- dir c:\
#- dir c:\qt
#- $env:path.split(";")
#- cmd.exe /c "set"
#- Get-Location
script:
- perl tools/make-version.pl --set-release
- mkdir build
- cd build
- cmake -G "Visual Studio 16 2019" -A x64 ..
- msbuild "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln
- msbuild "/consoleloggerparameters:PerformanceSummary;NoSummary" test-programs.vcxproj
- ctest -C RelWithDebInfo --parallel 3 --force-new-ctest-process --verbose