]> git.ipfire.org Git - thirdparty/systemd.git/blob - .travis.yml
Merge pull request #7540 from fbuihuu/systemd-delta-tweaks
[thirdparty/systemd.git] / .travis.yml
1 sudo: required
2
3 services:
4 - docker
5
6 jobs:
7 include:
8 - stage: build docker image
9 env:
10 # The machine id will be passed to Dockerfile for later checks
11 - MACHINE_ID=$(cat /var/lib/dbus/machine-id)
12 before_script: &update
13 # Ensure the latest version of docker is installed
14 - sudo apt-get update
15 - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
16 - docker --version
17 - env > .env
18 script:
19 # Copy content of CI_DIR into WORKDIR
20 - find $CI_DIR -maxdepth 1 -type f -exec cp -t . {} +
21 - echo "ENV GIT_SHA ${TRAVIS_COMMIT}" >> Dockerfile
22 - echo "ENV MACHINE_ID ${MACHINE_ID}" >> Dockerfile
23 - echo "$(git log -1 ${TRAVIS_COMMIT})" >> COMMITINFO
24 # Build docker container
25 - $CI_SCRIPT_DIR/build-docker-image.sh
26
27 - docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
28 - docker push ${DOCKER_REPOSITORY}
29
30 - stage: build
31 language: c
32 compiler: gcc
33 env:
34 # The machine id will be passed to container
35 - MACHINE_ID=$(cat /var/lib/dbus/machine-id)
36 before_script: *update
37 script:
38 - docker run -dit --name travis_build ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} bash
39 - docker exec -u 0 -ti travis_build bash -c "echo ${MACHINE_ID} > /etc/machine-id"
40 - docker exec -ti travis_build meson build
41 - docker exec -ti travis_build ninja -C build
42 # Commit it to the new image that will be used for testing
43 - docker commit -m "systemd build state" -a "${AUTHOR_NAME}" travis_build ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
44 - docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
45 - docker push ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
46
47 - stage: test
48 language: c
49 compiler: gcc
50 before_script: *update
51 script:
52 - docker run --privileged --net=host -dit --name travis_test ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} bash
53 - docker exec -ti travis_test ninja -C build test
54 - docker commit -m "systemd test state" -a "${AUTHOR_NAME}" travis_test ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
55 - docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
56 - docker push ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT}
57
58 - stage: coverity scan
59 language: c
60 compiler: gcc
61 before_script: *update
62 env:
63 - COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG"
64 - COVERITY_SCAN_NOTIFICATION_EMAIL="${AUTHOR_EMAIL}"
65 - COVERITY_SCAN_BRANCH_PATTERN="$TRAVIS_BRANCH"
66 # Disable CCACHE for cov-build to compilation units correctly
67 - CCACHE_DISABLE=1
68 # Token for systemd/systemd Coverity Scan Analysis
69 # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
70 # via the "travis encrypt" command using the project repo's public key
71 - secure: "UNQLspT89GYWuVKFqW5W5RyqqnYg5RvX20IrNraOddhpdV9nhKBtozrfmhGXDGZwfHGWHt6g7YROlD/NIMvDvThVJIEYvSQiXCoo2zRrwkl2siET5MjPfRG8numiLq0KX47KGmyBJISJZCgDUdNGqqGwgf7AhDN78I3XtgqjFT1z0mGl8n0wiFpKPi7i3nECvF4Mk7xCCHqwByaq0z5G9NkVlOvP1EyCxwv3B6I5Umfch7ibp7iH44YnVXILK+yEry5dMuctYwYkDouR80ChEPQQ5fhhpO4++HJmFuSpfMTeCHpucAd2xwSUijejYeN/GNQ177GxSSk/8hRBGcuSK8T/WJ+KiuJPhZObV8mw+a6+qdQssWY4F9jya5ZKbZ/yTbxjtQ0m4AgtL28P9bEze8pLh16zFMX+hIEuoFSNmJqmtNttfbD5TKyYVZml59s9wvhlvMnlNpRSQva88OAOjXtiA41g+XtTxxpfW9mgd7HYhzSBs1efNiK7PfkANgve7KIYMAmCAqasgb1IIAyX7stOlJH06QOFXNH55PmJLkkKyL3SMQzgryMDWegU+XbS8t43r0x14WLuE7sc9JtnOr/G8hthFaMRp8xLy9aCBwyEIkEsyWa50VMoZDa3Spdb4r1CKBwcGdCbyE4rCehwEIznbfrsSovhwiUds7bbhBU="
72 script:
73 # Copy content of CI_DIR into WORKDIR
74 - find $CI_DIR -maxdepth 1 -type f -exec cp -t . {} +
75 # Build container for current user
76 - $CI_SCRIPT_DIR/build-docker-image.sh
77
78 # For kernel version 4.8+
79 - sudo sysctl vsyscall=emulate || true
80 # Prepare environment for Coverity tool
81 - |
82 PLATFORM=`uname`
83 export TOOL_BASE="/tmp/coverity-scan-analysis"
84 export SCAN_URL="https://scan.coverity.com"
85 export UPLOAD_URL="https://scan.coverity.com/builds"
86 export TOOL_ARCHIVE="/tmp/cov-analysis-${PLATFORM}.tgz"
87
88 # Get Coverity tool
89 - $CI_TOOL_DIR/get-coverity.sh
90 - TOOL_DIR="$(find $TOOL_BASE -type d -name 'cov-analysis*')"
91
92 # Export env variables for Coverity scan
93 - env | grep -E "TRAVIS|COV|TOOL|URL" > .cov-env
94 - |
95 docker run -dit --env-file .cov-env \
96 -v ${TOOL_BASE}:${TOOL_BASE}:ro \
97 --name travis_coverity_scan ${DOCKER_REPOSITORY}:${TRAVIS_COMMIT} bash
98 # Make sure Coverity script is executable
99 - docker cp scripts/coverity.sh travis_coverity_scan:/usr/local/bin
100 # Preconfigure with meson to prevent Coverity from capturing meson metadata
101 # Set compiler flag to prevent emit failure
102 - docker exec -it travis_coverity_scan sh -c "CFLAGS='-D_Float128=long\ double' meson cov-build -Dman=false"
103 # Run Coverity Analysis
104 - docker exec -it travis_coverity_scan coverity.sh build
105 - docker exec -it travis_coverity_scan coverity.sh upload
106
107 - stage: clean docker
108 language: python
109 # python:
110 # - "3.6" Probably broken ATM
111 env:
112 - SIZE_LIMIT="3000" # Limit in MBs
113 - TAG_LIMIT="3" # Number of tags to be kept at the time
114 before-script:
115 - sudo apt-get -y install python3
116 script:
117 # Get docker-remote tool and setup venv
118 - sudo $CI_TOOL_DIR/get-docker-remote.sh
119 # Activate virtual environment to be able to use docker-remote safely
120 - source venv/bin/activate
121 # Check the size and tag limit of the repo
122 - REPO_SIZE=$(docker-remote repository --size $DOCKER_REPOSITORY)
123 - TAG_COUNT=$(docker-remote tags --count $DOCKER_REPOSITORY)
124 - 'echo -e "\033[33;1mCurrent repository size: $REPO_SIZE in $TAG_COUNT tags \033[0m"'
125 - |
126 if [[ ${REPO_SIZE%.*} -gt $SIZE_LIMIT ]] || [[ $TAG_COUNT -gt $TAG_LIMIT ]]
127 then
128 docker-remote --login $DOCKER_USERNAME:$DOCKER_PASSWORD \
129 tags --assumeyes --pop-back --keep $TAG_LIMIT $DOCKER_REPOSITORY
130 fi
131
132
133
134 # Specify the order of stages and conditions
135 stages:
136 # Helper stage to determine whether coverity stage should be allowed
137 - name: initialization
138
139 - name: build docker image
140 if: type != cron
141 - name: build
142 if: type != cron
143 - name: test
144 if: type != cron
145
146 # These stages run separately, the resulting container will not be pushed to Docker Hub
147 # This stage will only run on special conditions
148 - name: coverity scan
149 if: type = cron
150
151 # Check for repository size and clean Docker repo if necessary
152 - name: clean Docker
153 if: type = cron
154
155 env:
156 global:
157 # Secure Docker Hub credentials
158 - secure: "TY61ufmEJyxCer8vuAlQ3mYwGRynFZXPCFTxKgIzobAHHyE1Zwx0bZDDwDd88Gdgz7EGnOJtMABfa0axfPOK9il5u7lYmmZ8Usa0HAvKavkpSRnw2b16zz88N98x3DyaIquvg2J8iQpHHoM32+BGiAS7P8BiYTO6r+E0CMPYC0Ylh7eHVSBGfWbR9m+yCo/mDIEAWyop6Jv4rTMN4qP9U7e6Kou7m/AJeiCWMaR7rlanpLFNQi3+qF/Mt5dbE7LVLNSOkmpg/FPw34g4RC5mfLAh+c8YBadqo6kFA6qV1b931or0aZUYVtobI6UwC9U1GGqzfCTjXuVMNgPBBQ6n3JMt91mFFkP0lXdGMxpBNbwFL/btBrt2a359L/wNtqv6PuSJwJ3oTe/FP++X6xjbM7LcA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COMMIT --pretty=\"%aN\")"
165 - AUTHOR_EMAIL="$(git log -1 $TRAVIS_COMMIT --pretty=\"%aE\")"
166
167 - CI_DIR="$TRAVIS_BUILD_DIR/travis-ci"
168 - CI_TOOL_DIR="$CI_DIR/tools"
169 - CI_SCRIPT_DIR="$CI_DIR/scripts"
170
171 notifications:
172 email:
173 recipients:
174 - ${ADMIN_EMAIL}
175 - ${AUTHOR_EMAIL}
176 irc:
177 channels:
178 - "irc.freenode.org#systemd"
179 on_success: change
180 on_failure: always