2017-02-05 11:40:01 +00:00
|
|
|
# Define the building environment
|
|
|
|
language: c
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
fast_finish: true
|
|
|
|
|
|
|
|
compiler:
|
|
|
|
- clang
|
|
|
|
- gcc
|
|
|
|
|
|
|
|
env:
|
|
|
|
matrix:
|
|
|
|
# Test the last version of Python and Ruby together, with some linkers
|
2020-05-04 19:11:22 +00:00
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.7
|
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.7 TEST_FLAGS_OVERRIDE=1
|
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.7 TEST_DEBUG=1
|
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.7 LINKER=gold
|
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.7 LINKER=bfd
|
2017-02-05 11:40:01 +00:00
|
|
|
|
2020-05-04 19:11:22 +00:00
|
|
|
# Test several Python versions (https://docs.travis-ci.com/user/languages/python/#python-versions)
|
|
|
|
- PYVER=python3.5 RUBYLIBVER=2.7
|
|
|
|
- PYVER=python3.6 RUBYLIBVER=2.7
|
|
|
|
- PYVER=python3.7 RUBYLIBVER=2.7
|
|
|
|
- PYVER=pypy3.6-7.2.0 RUBYLIBVER=2.7
|
2017-02-05 11:40:01 +00:00
|
|
|
|
2019-01-20 19:19:32 +00:00
|
|
|
# Test several Ruby versions (http://rubies.travis-ci.org/)
|
2020-05-04 19:11:22 +00:00
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.6
|
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.5.1
|
|
|
|
- PYVER=python3.8 RUBYLIBVER=2.4
|
2017-02-05 11:40:01 +00:00
|
|
|
|
2017-08-05 10:16:49 +00:00
|
|
|
matrix:
|
|
|
|
exclude:
|
|
|
|
- compiler: clang
|
2020-05-04 19:11:22 +00:00
|
|
|
env: PYVER=python3.8 RUBYLIBVER=2.7 LINKER=gold
|
2017-08-05 10:16:49 +00:00
|
|
|
- compiler: clang
|
2020-05-04 19:11:22 +00:00
|
|
|
env: PYVER=python3.8 RUBYLIBVER=2.7 LINKER=bfd
|
2020-06-02 19:18:56 +00:00
|
|
|
include:
|
|
|
|
- compiler: gcc
|
2020-11-02 09:43:10 +00:00
|
|
|
env: TRAVIS_RUN_KVM=true FEDORA_MAJOR=33 FEDORA_MINOR=1.2
|
2020-06-02 19:18:56 +00:00
|
|
|
install:
|
|
|
|
- skip
|
|
|
|
before_script:
|
|
|
|
- skip
|
|
|
|
script: scripts/ci/travis-kvm-setup.sh
|
2017-08-05 10:16:49 +00:00
|
|
|
|
2020-05-04 19:11:22 +00:00
|
|
|
# Use Travis-CI Ubuntu 18.04 Bionic Beaver, "full image" variant
|
2017-02-05 11:40:01 +00:00
|
|
|
sudo: required
|
2020-05-04 19:11:22 +00:00
|
|
|
dist: bionic
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Install SELinux userspace utilities dependencies
|
|
|
|
addons:
|
|
|
|
apt:
|
|
|
|
packages:
|
|
|
|
- bison
|
|
|
|
- flex
|
|
|
|
- gawk
|
|
|
|
- gettext
|
|
|
|
- libaudit-dev
|
|
|
|
- libbz2-dev
|
|
|
|
- libcap-dev
|
|
|
|
- libcap-ng-dev # This package is not whitelisted for the container infrastructure (https://github.com/travis-ci/apt-package-whitelist/issues/1096)
|
|
|
|
- libcunit1-dev
|
2020-05-04 19:11:22 +00:00
|
|
|
- libglib2.0-dev
|
2017-02-05 11:40:01 +00:00
|
|
|
- libpcre3-dev
|
|
|
|
- patch
|
|
|
|
- python3-dev
|
|
|
|
- python-dev
|
|
|
|
- swig
|
|
|
|
- xmlto
|
|
|
|
|
|
|
|
install:
|
2019-01-05 19:37:55 +00:00
|
|
|
# Download and install refpolicy headers for sepolgen tests
|
|
|
|
- curl --location --retry 10 -o "$TRAVIS_BUILD_DIR/refpolicy.tar.bz2" https://github.com/SELinuxProject/refpolicy/releases/download/RELEASE_2_20180701/refpolicy-2.20180701.tar.bz2
|
|
|
|
- tar -C "$TRAVIS_BUILD_DIR" -xvjf "$TRAVIS_BUILD_DIR/refpolicy.tar.bz2"
|
|
|
|
# Make refpolicy Makefile use the new toolchain when building modules
|
|
|
|
- sed -e "s,^PREFIX :=.*,PREFIX := \$(DESTDIR)/usr," -i "$TRAVIS_BUILD_DIR/refpolicy/support/Makefile.devel"
|
2020-10-30 19:56:54 +00:00
|
|
|
- sudo make -j$(nproc) -C "$TRAVIS_BUILD_DIR/refpolicy" install-headers
|
2019-01-05 19:37:55 +00:00
|
|
|
- sudo rm -rf "$TRAVIS_BUILD_DIR/refpolicy.tar.bz2" "$TRAVIS_BUILD_DIR/refpolicy"
|
2017-02-05 11:40:01 +00:00
|
|
|
- sudo mkdir -p /etc/selinux
|
|
|
|
- echo 'SELINUXTYPE=refpolicy' | sudo tee /etc/selinux/config
|
2019-01-05 19:37:55 +00:00
|
|
|
- echo 'SELINUX_DEVEL_PATH = /usr/share/selinux/refpolicy' | sudo tee /etc/selinux/sepolgen.conf
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Make sepolgen tests work without really installing anything in the real root (doing this would conflict with Ubuntu packages)
|
|
|
|
- sed -e "s,\"\(/usr/bin/[cs]\),\"$TRAVIS_BUILD_DIR/installdir\1," -i python/sepolgen/src/sepolgen/module.py
|
|
|
|
|
2017-09-23 13:45:53 +00:00
|
|
|
# Download the required python version if it is not installed
|
|
|
|
- VIRTUAL_ENV="$HOME/virtualenv/$PYVER"
|
|
|
|
- if ! [ -d "$VIRTUAL_ENV" ] ; then
|
2020-05-04 19:11:22 +00:00
|
|
|
curl --retry 10 -o python.tar.bz2 "https://s3.amazonaws.com/travis-python-archives/binaries/ubuntu/18.04/x86_64/${PYVER/python/python-}.tar.bz2" &&
|
2017-09-23 13:45:53 +00:00
|
|
|
sudo tar xjf python.tar.bz2 --directory / &&
|
|
|
|
rm python.tar.bz2 ;
|
|
|
|
fi
|
|
|
|
|
2018-08-04 12:57:39 +00:00
|
|
|
# Install flake8 for the given python version
|
|
|
|
- $VIRTUAL_ENV/bin/pip install flake8
|
|
|
|
|
2017-02-05 11:40:01 +00:00
|
|
|
before_script:
|
|
|
|
# Build and install in a temporary directory to run tests
|
|
|
|
- export DESTDIR="$TRAVIS_BUILD_DIR/installdir"
|
|
|
|
|
|
|
|
# Configure the variables for Python parts
|
|
|
|
- export VIRTUAL_ENV="$HOME/virtualenv/$PYVER"
|
|
|
|
- export PYTHON="$VIRTUAL_ENV/bin/python"
|
2017-02-19 21:53:29 +00:00
|
|
|
# Use the header files in /opt/python/... for Python because the virtualenvs do not provide Python.h
|
|
|
|
- export PKG_CONFIG_PATH="/opt/python/$($PYTHON -c 'import sys;print("%d.%d.%d" % sys.version_info[:3])')/lib/pkgconfig"
|
2019-01-20 19:19:31 +00:00
|
|
|
# PyPy does not provide a config file for pkg-config
|
|
|
|
# libpypy-c.so is provided in bin/libpypy-c.so for PyPy and bin/libpypy3-c.so for PyPy3
|
|
|
|
- if echo "$PYVER" | grep -q pypy ; then
|
|
|
|
export PYINC=-I$($PYTHON -c 'import sys;print(sys.prefix)')/include ;
|
|
|
|
export PYLIBS="$($PYTHON -c 'import sys;print("-L%s/bin -l%s" % (sys.prefix, "pypy-c" if sys.version_info < (3,) else "pypy3-c"))')" ;
|
|
|
|
fi
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Find the Ruby executable with version $RUBYLIBVER
|
2018-05-21 07:44:08 +00:00
|
|
|
- rvm reinstall ruby-$RUBYLIBVER --binary
|
2017-02-05 11:40:01 +00:00
|
|
|
- export RUBY="$(ls -d -1 "$HOME/.rvm/rubies/ruby-$RUBYLIBVER"*/bin/ruby | head -n 1)"
|
|
|
|
|
|
|
|
# Set the linker in $CC so that it gets used everywhere
|
|
|
|
- if [ -n "$LINKER" ]; then CC="$CC -fuse-ld=$LINKER" ; fi
|
|
|
|
|
|
|
|
# Show variables and versions (to help debugging)
|
|
|
|
- echo "$CC" ; $CC --version
|
|
|
|
- echo "$PYTHON" ; $PYTHON --version
|
|
|
|
- echo "$RUBY" ; $RUBY --version
|
|
|
|
|
2017-06-28 21:42:21 +00:00
|
|
|
# If TEST_FLAGS_OVERRIDE is defined, test that overriding CFLAGS, LDFLAGS and other variables works fine
|
|
|
|
- if [ -n "$TEST_FLAGS_OVERRIDE" ]; then EXPLICIT_MAKE_VARS="CFLAGS=-I$DESTDIR/usr/include LDFLAGS=-L$DESTDIR/usr/lib LDLIBS= CPPFLAGS=" ; fi
|
2020-02-06 13:19:01 +00:00
|
|
|
# If TEST_DEBUG is defined, test that debug build works fine
|
|
|
|
- if [ -n "$TEST_DEBUG" ]; then EXPLICIT_MAKE_VARS="$EXPLICIT_MAKE_VARS DEBUG=1" ; fi
|
2017-06-28 21:42:21 +00:00
|
|
|
|
2017-02-05 11:40:01 +00:00
|
|
|
script:
|
|
|
|
# Start by installing everything into $DESTDIR
|
2020-10-30 19:56:54 +00:00
|
|
|
- make -j$(nproc) install $EXPLICIT_MAKE_VARS -k
|
|
|
|
- make -j$(nproc) install-pywrap $EXPLICIT_MAKE_VARS -k
|
|
|
|
- make -j$(nproc) install-rubywrap $EXPLICIT_MAKE_VARS -k
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Now that everything is installed, run "make all" to build everything which may have not been built
|
2020-10-30 19:56:54 +00:00
|
|
|
- make -j$(nproc) all $EXPLICIT_MAKE_VARS -k
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Set up environment variables for the tests
|
2019-01-20 19:19:33 +00:00
|
|
|
- . ./scripts/env_use_destdir
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Show variables (to help debugging issues)
|
|
|
|
- echo "$LD_LIBRARY_PATH"
|
|
|
|
- echo "$PATH"
|
|
|
|
- echo "$PYTHONPATH"
|
|
|
|
- echo "$RUBYLIB"
|
|
|
|
|
|
|
|
# Run tests
|
2017-06-28 21:42:21 +00:00
|
|
|
- make test $EXPLICIT_MAKE_VARS
|
2017-02-05 11:40:01 +00:00
|
|
|
|
|
|
|
# Test Python and Ruby wrappers
|
|
|
|
- $PYTHON -c 'import selinux;import selinux.audit2why;import semanage;print(selinux.is_selinux_enabled())'
|
|
|
|
- $RUBY -e 'require "selinux";require "semanage";puts Selinux::is_selinux_enabled()'
|
|
|
|
|
2018-08-04 12:57:39 +00:00
|
|
|
# Run Python linter
|
|
|
|
- PATH="$VIRTUAL_ENV/bin:$PATH" ./scripts/run-flake8
|
|
|
|
|
2017-02-05 11:40:01 +00:00
|
|
|
# Remove every installed files
|
|
|
|
- rm -rf "$DESTDIR"
|
|
|
|
|
|
|
|
# Test that "git status" looks clean, or print a clear error message
|
|
|
|
- |-
|
|
|
|
git status --short | sed -n 's/^??/error: missing .gitignore entry for/p' | (! grep '^')
|
|
|
|
|
|
|
|
# Clean up everything and show which file would be added to "make clean"
|
2017-06-28 21:42:21 +00:00
|
|
|
- make clean distclean $EXPLICIT_MAKE_VARS
|
2017-02-05 11:40:01 +00:00
|
|
|
- |-
|
|
|
|
git ls-files --ignored --others --exclude-standard | sed 's/^/error: "make clean distclean" did not remove /' | (! grep '^')
|
|
|
|
|
|
|
|
# Do not spam by email so long as the build succeeds
|
|
|
|
notifications:
|
|
|
|
email:
|
|
|
|
on_success: never
|