NetworkManager/.gitlab-ci/run-test.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
2.1 KiB
Bash
Raw Normal View History

gitlab CI: switch to using ci-templates ci-templates encourages building specific containers that can be re-used: - containers are re-used across pipelines, producing consistent results - containers are re-used by contributors since they will use the upstream containers for their MR, thus guaranteeing the same results. Containers are automatically rebuild whenever the respective FDO_DISTRIBUTION_TAG changes. This is particularly interesting now that Docker Hub will introduce pull limits. This CI script consists of a config file and a jinja2 template, simply running 'ci-fairy generate-template' produces the .gitlab-ci.yml. ci-fairy is part of the freedesktop.org ci-templates and can be pip installed, see the check-ci-script job. Functional changes to the previous script: - new job: check-ci-script, verifies that our gitlab-ci.yml is the one generated by the sources - Added distributions: - Fedora 33 - The actual work is now down by a set of scripts in .gitlab-ci/, specifically: - .gitlab-ci/build.sh is the previous do_build job - .gitlab-ci/{fedora|debian}-install.sh are the previous {fedora|debian}_install jobs symlinks are in place for centos and ubuntu Why the scripts instead of steps in the CI? Easer to reading and reproduce. With the containers being static, it's easy to pull one locally and re-run the CI job to reproduce an issue. Having everything in a single script makes that trivial. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/664
2020-10-29 23:19:11 +00:00
#!/bin/bash
set -ex
IS_FEDORA=0
IS_CENTOS=0
IS_ALPINE=0
grep -q '^NAME=.*\(CentOS\)' /etc/os-release && IS_CENTOS=1
grep -q '^NAME=.*\(Fedora\)' /etc/os-release && IS_FEDORA=1
grep -q '^NAME=.*\(Alpine\)' /etc/os-release && IS_ALPINE=1
do_clean() {
git clean -fdx
}
uname -a
! command -v locale &>/dev/null || locale -a
meson --version
! command -v dpkg &>/dev/null || dpkg -l
! command -v yum &>/dev/null || yum list installed
! command -v apk &>/dev/null || apk -v info
# The formatting depends on the version of python black.
# We have a dedicated test that checks our formatting, which
# uses the right version. We should disable the check during
# `make check`.
export NMTST_SKIP_PYTHON_BLACK=1
# We have a unit test that check that `ci-fairy generate-template`
# is equal to our .gitlab-ci.yml file. However, on gitlab-ci we
# also have a dedicate test for the same thing. We don't need
# to run that test as part of the build. Disable it.
export NMTST_SKIP_CHECK_GITLAB_CI=1
do_clean; BUILD_TYPE=autotools CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh
rm -rf /tmp/nm-docs-html;
mv build/INST/share/gtk-doc/html /tmp/nm-docs-html
do_clean; BUILD_TYPE=meson CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh
do_clean; BUILD_TYPE=autotools CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh
do_clean; BUILD_TYPE=meson CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh
do_clean; test $IS_FEDORA = 1 -o $IS_CENTOS = 1 && ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -W meson
do_clean; test $IS_FEDORA = 1 && ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson
do_clean
if [ "$NM_BUILD_TARBALL" = 1 ]; then
SIGN_SOURCE=0 ./contrib/fedora/rpm/build_clean.sh -r
mv ./NetworkManager-1*.tar.xz /tmp/
mv ./contrib/fedora/rpm/latest/SRPMS/NetworkManager-1*.src.rpm /tmp/
do_clean
mv /tmp/nm-docs-html ./docs-html
mv /tmp/NetworkManager-1*.tar.xz /tmp/NetworkManager-1*.src.rpm ./
fi
echo "BUILD SUCCESSFUL!!"