xref: /OK3568_Linux_fs/external/xserver/.gitlab-ci.yml (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1# IMAGE_TAG is the tag of the docker image used for the build jobs. If the
2# image doesn't exist yet, the docker-image stage generates it.
3#
4# In order to generate a new image, one should generally change the tag.
5# While removing the image from the registry would also work, that's not
6# recommended except for ephemeral images during development: Replacing an
7# image after a significant amount of time might pull in newer versions of
8# gcc/clang or other packages, which might break the build with older commits
9# using the same tag.
10#
11# After merging a change resulting in generating a new image to the main
12# repository, it's recommended to remove the image from the source repository's
13# container registry, so that the image from the main repository's registry
14# will be used there as well.
15variables:
16    IMAGE_TAG: "debian-testing-20190219"
17    IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
18    IMAGE_MAIN: "registry.freedesktop.org/xorg/xserver:$IMAGE_TAG"
19
20stages:
21    - docker-image
22    - build-and-test
23
24debian-testing:
25    stage: docker-image
26    image:
27        name: gcr.io/kaniko-project/executor:debug
28        entrypoint: [""]
29    script:
30        - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
31        - mkdir kaniko-context
32        - |
33          echo "FROM $IMAGE_LOCAL" > kaniko-context/Dockerfile
34          # If the image exists in the local registry, skip to the build-and-test job
35          set +e
36          set -x
37          /kaniko/executor --context kaniko-context --no-push && exit 0
38          set +x
39          set -e
40        - |
41          echo "FROM $IMAGE_MAIN" > kaniko-context/Dockerfile
42          # Try to re-use the image from the main repository's registry, and if
43          # that fails, generate a local image from scratch
44          set +e
45          set -x
46          /kaniko/executor --context kaniko-context --destination $IMAGE_LOCAL && exit 0
47          set +x
48          set -e
49        - /kaniko/executor --context $CI_PROJECT_DIR/.gitlab-ci --destination $IMAGE_LOCAL
50
51.common-build-and-test:
52    stage: build-and-test
53    image: $IMAGE_LOCAL
54    artifacts:
55        when: on_failure
56        paths:
57            - build/test/piglit-results/
58    cache:
59        paths:
60            - ccache/
61    variables:
62        LC_ALL: C.UTF-8
63    before_script:
64        - export CCACHE_BASEDIR="$PWD"
65        - export CCACHE_DIR="$PWD/ccache"
66        - export CCACHE_COMPILERCHECK=content
67        - export PATH="/usr/lib/ccache:$PATH"
68        - ccache --zero-stats
69        - ccache --show-stats
70    after_script:
71        - CCACHE_DIR="$PWD/ccache" ccache --show-stats
72
73autotools-build-and-test:
74    extends: .common-build-and-test
75    script:
76        - mkdir build/
77        - cd build/
78        - ../autogen.sh --prefix=/usr
79        - make -j$(nproc) distcheck
80        - |
81          export PIGLIT_DIR=/root/piglit XTEST_DIR=/root/xts
82          set +e
83          set -x
84          make -j$(nproc) check
85          status=$?
86          cat test/piglit-results/xvfb/long-summary || :
87          exit $status
88
89meson-build-and-test:
90    extends: .common-build-and-test
91    variables:
92        PIGLIT_DIR: /root/piglit
93        XTEST_DIR: /root/xts
94    script:
95        - meson -Dprefix=/usr build/
96        - |
97          ninja -C build/ install
98          set +e
99          set -x
100          ninja -C build/ test
101          status=$?
102          cat build/meson-logs/testlog.txt
103          cat build/test/piglit-results/xvfb/long-summary || :
104          exit $status
105