1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

travis: use Travis CI only for running scheduled Coverity scans

Building and testing of systemd on Fedora Rawhide is now handled by
dedicated Fedora CI. We don't need to duplicate this in Travis CI.
This commit is contained in:
Michal Sekletar 2018-06-01 09:56:13 +02:00 committed by Evgeny Vereshchagin
parent c0d72c4313
commit 3f4b547a55
3 changed files with 9 additions and 133 deletions

View File

@ -2,75 +2,24 @@ sudo: required
services:
- docker
cache: ccache
language: c
jobs:
include:
- stage: build docker image
env:
# The machine id will be passed to Dockerfile for later checks
- MACHINE_ID=$(cat /var/lib/dbus/machine-id)
before_script: &update
# Ensure the latest version of docker is installed
- stage: coverity scan
before_script:
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- docker --version
- env > .env
script:
# Copy content of CI_DIR into WORKDIR
- find $CI_DIR -maxdepth 1 -type f -exec cp -t . {} +
- echo "ENV GIT_SHA ${TRAVIS_COMMIT}" >> Dockerfile
- echo "ENV MACHINE_ID ${MACHINE_ID}" >> Dockerfile
- echo "$(git log -1 ${TRAVIS_COMMIT})" >> COMMITINFO
# Build docker container
- $CI_SCRIPT_DIR/build-docker-image.sh
- docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
- docker push ${DOCKER_REPOSITORY}
- stage: build
language: c
compiler: gcc
env:
# The machine id will be passed to container
- MACHINE_ID=$(cat /var/lib/dbus/machine-id)
before_script: *update
script:
- docker run -v $HOME/.ccache:$HOME/.ccache -dit --name travis_build ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} bash
- docker exec -u 0 -ti travis_build bash -c "echo ${MACHINE_ID} > /etc/machine-id"
- docker exec -ti travis_build meson build
- docker exec -ti travis_build ninja -C build
# Commit it to the new image that will be used for testing
- docker commit -m "systemd build state" -a "${AUTHOR_NAME}" travis_build ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
- docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
- docker push ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
- stage: test
language: c
compiler: gcc
before_script: *update
script:
- docker run -v $HOME/.ccache:$HOME/.ccache --privileged --net=host -dit --name travis_test ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} bash
- docker exec -ti travis_test ninja -C build test
- docker commit -m "systemd test state" -a "${AUTHOR_NAME}" travis_test ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
- docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
- docker push ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
- stage: coverity scan
language: c
compiler: gcc
before_script: *update
env:
- COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG"
- COVERITY_SCAN_NOTIFICATION_EMAIL="${AUTHOR_EMAIL}"
- COVERITY_SCAN_BRANCH_PATTERN="$TRAVIS_BRANCH"
# Disable CCACHE for cov-build to compilation units correctly
- CCACHE_DISABLE=1
# Token for systemd/systemd Coverity Scan Analysis
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "UNQLspT89GYWuVKFqW5W5RyqqnYg5RvX20IrNraOddhpdV9nhKBtozrfmhGXDGZwfHGWHt6g7YROlD/NIMvDvThVJIEYvSQiXCoo2zRrwkl2siET5MjPfRG8numiLq0KX47KGmyBJISJZCgDUdNGqqGwgf7AhDN78I3XtgqjFT1z0mGl8n0wiFpKPi7i3nECvF4Mk7xCCHqwByaq0z5G9NkVlOvP1EyCxwv3B6I5Umfch7ibp7iH44YnVXILK+yEry5dMuctYwYkDouR80ChEPQQ5fhhpO4++HJmFuSpfMTeCHpucAd2xwSUijejYeN/GNQ177GxSSk/8hRBGcuSK8T/WJ+KiuJPhZObV8mw+a6+qdQssWY4F9jya5ZKbZ/yTbxjtQ0m4AgtL28P9bEze8pLh16zFMX+hIEuoFSNmJqmtNttfbD5TKyYVZml59s9wvhlvMnlNpRSQva88OAOjXtiA41g+XtTxxpfW9mgd7HYhzSBs1efNiK7PfkANgve7KIYMAmCAqasgb1IIAyX7stOlJH06QOFXNH55PmJLkkKyL3SMQzgryMDWegU+XbS8t43r0x14WLuE7sc9JtnOr/G8hthFaMRp8xLy9aCBwyEIkEsyWa50VMoZDa3Spdb4r1CKBwcGdCbyE4rCehwEIznbfrsSovhwiUds7bbhBU="
# Encrypted token for systemd/systemd Coverity Scan Analysis,
# generated by "travis encrypt -r systemd/systemd COVERITY_SCAN_TOKEN=<TOKEN>"
- secure: "lM0IVP2zOG5Ywk3YCbDCQL4WioyzzwtdtpZ+hKDy4BWCZDBJ/FVwIeBsXdMDvlTa3xi+GQ1b7kS2OmTfmG4aSlhU7isuH8SMq1Y4GR5AxfhkR+irUA1A1fntlvhbjIumDGW5wjs0Dt8KogMWS+ZD4eGE59lrVO/TrhMzIe1eHENVLFQJdNq+ZJXU8wxMfHf8lXk0xA8SJTid0XvZBNc4JN6pjJRA8LaOrMNhQYfygFmVQ598kwlu7gf5vbCKFPnIgJAxdIhz12XS9utGohV28IYj9d1DdUGUT+ar3OfADj3X8KFBP4Ymc02pcln3wVgdPtrDbFZh1R9jbmfdXGAH/6tTOJVn8aFySS2Vq9QiBiprWdPsAOLcWMNhnp0lMkASxs9/W26nU7Czo8VbAVWXM1w35plDpnDGR6lk/06dmOZpqu5p3AYr5xIKACIAdPDn0rNpnSWqC750WZ8ZWbHnKuZC5TWML7scVaPiEi7D7rbwqML2rdwx4ZoTZmCHiGByXCIWTfhf0JNQAix5WW3znl+BmDesumPgPj2mX+y6J1WYJrIz12m7qh7KhV/a1ODKM+I91A9rkOA/bPnmhmSSUR7CwgvZt1fC/VwBnaFFtAz9/70kN9Q8tDBXtXidExZwh1e3t5vDG72k3lXwNqpKRvdW3LOxK6lFvqEdMWVUJls="
script:
# Copy content of CI_DIR into WORKDIR
- find $CI_DIR -maxdepth 1 -type f -exec cp -t . {} +
@ -96,7 +45,7 @@ jobs:
- |
docker run -dit --env-file .cov-env \
-v ${TOOL_BASE}:${TOOL_BASE}:ro \
--name travis_coverity_scan ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} bash
--name travis_coverity_scan coverity-${TRAVIS_COMMIT}:latest bash
# Make sure Coverity script is executable
- docker cp tools/coverity.sh travis_coverity_scan:/usr/local/bin
# Preconfigure with meson to prevent Coverity from capturing meson metadata
@ -106,61 +55,13 @@ jobs:
- docker exec -it travis_coverity_scan coverity.sh build
- docker exec -it travis_coverity_scan coverity.sh upload
- stage: clean docker
language: python
# python:
# - "3.6" Probably broken ATM
env:
- SIZE_LIMIT="3000" # Limit in MBs
- TAG_LIMIT="3" # Number of tags to be kept at the time
before-script:
- sudo apt-get -y install python3
script:
# Get docker-remote tool and setup venv
- sudo $CI_TOOL_DIR/get-docker-remote.sh
# Activate virtual environment to be able to use docker-remote safely
- source venv/bin/activate
# Check the size and tag limit of the repo
- REPO_SIZE=$(docker-remote repository --size $DOCKER_REPOSITORY)
- TAG_COUNT=$(docker-remote tags --count $DOCKER_REPOSITORY)
- 'echo -e "\033[33;1mCurrent repository size: $REPO_SIZE in $TAG_COUNT tags \033[0m"'
- |
if [[ ${REPO_SIZE%.*} -gt $SIZE_LIMIT ]] || [[ $TAG_COUNT -gt $TAG_LIMIT ]]
then
docker-remote --login $DOCKER_USERNAME:$DOCKER_PASSWORD \
tags --assumeyes --pop-back --keep $TAG_LIMIT $DOCKER_REPOSITORY
fi
# Specify the order of stages and conditions
stages:
# Helper stage to determine whether coverity stage should be allowed
- name: initialization
- name: build docker image
if: type != cron
- name: build
if: type != cron
- name: test
if: type != cron
# These stages run separately, the resulting container will not be pushed to Docker Hub
# This stage will only run on special conditions
- name: coverity scan
if: type = cron
# Check for repository size and clean Docker repo if necessary
- name: clean Docker
if: type = cron
env:
global:
# Secure Docker Hub credentials
- secure: "TY61ufmEJyxCer8vuAlQ3mYwGRynFZXPCFTxKgIzobAHHyE1Zwx0bZDDwDd88Gdgz7EGnOJtMABfa0axfPOK9il5u7lYmmZ8Usa0H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EOdWohT2+qm97j9IOZeQtPtdqZP9F8HJXgw6WjiGJIXMF3Ov9GkQh4uJyMYJ6hN7T3iRoenV86Dzgg6u5Ku131Ziwvlm+n94qlXF8Jl47wCcAS7VmyYxMft1gH+Zs+4Wq7KO0vysmnEk6rCqb87ZQSDOdTzBfK9HTyyAqmBCgS4Dp5x7/xOBMVXfq/SOb9c3Sh/JItA="
- DOCKER_REPOSITORY=$DOCKER_USERNAME/systemd
- ADMIN_EMAIL=macermak@redhat.com
- AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty=\"%aN\")"
@ -175,8 +76,3 @@ notifications:
recipients:
- ${ADMIN_EMAIL}
- ${AUTHOR_EMAIL}
irc:
channels:
- "irc.freenode.org#systemd"
on_success: change
on_failure: always

View File

@ -11,4 +11,4 @@ docker build \
--build-arg DOCKER_USER=$USER \
--build-arg DOCKER_USER_UID=`id -u` \
--build-arg DOCKER_USER_GID=`id -g` \
--force-rm -t ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} --pull=true .
--force-rm -t coverity-${TRAVIS_COMMIT} --pull=true .

View File

@ -1,20 +0,0 @@
#!/bin/bash
# Download and install docker-remote
# Sets up venv folder
# Notes: run with sudo command
# Make sure python3 is installed and install git and virtual environment
sudo apt-get update && sudo apt-get -y install python3 python3-pip git
sudo apt-get install -y $(apt-cache search venv | cut -d' ' -f 1)
# Get the tool from github and install it
git clone https://github.com/CermakM/docker-remote.git
# We need to setup virtual environment here to solve disable_warning issue
python3 -m venv venv
source venv/bin/activate
pushd docker-remote
pip install .
popd