ci: Update to current ci-templates
[piglit.git] / .gitlab-ci.yml
blobd688d396ccb2b744200410c9b9f9050982808569
1 # This is the tag of the docker image used for the build jobs. If the
2 # image doesn't exist yet, the containers stage generates it.
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
7 # an image after a significant amount of time might pull in newer
8 # versions of gcc/clang or other packages, which might break the build
9 # with older commits using the same tag.
10 variables:
11   FDO_UPSTREAM_REPO: mesa/piglit
12   FDO_DISTRIBUTION_TAG: "2021-04-06-templates"
13   FDO_DISTRIBUTION_VERSION: buster-slim
14   WINDOWS_TAG: "2020-08-18"
15   WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/windows/x64_build:$WINDOWS_TAG"
16   WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$UPSTREAM_REPO/windows/x64_build:$WINDOWS_TAG"
17   GIT_DEPTH: 100
19 include:
20   - project: 'freedesktop/ci-templates'
21     ref: 290b79e0e78eab67a83766f4e9691be554fc4afd
22     file: '/templates/debian.yml'
24 stages:
25   - container
26   - build
27   - deploy
30 # When & how to run the CI
31 .ci-run-policy:
32   retry:
33     max: 2
34     when:
35       - runner_system_failure
36   # Cancel CI run if a newer commit is pushed to the same branch
37   interruptible: true
39 # CONTAINERS
41 debian:
42   stage: container
43   extends:
44     - .ci-run-policy
45     - .fdo.container-build@debian
46   variables:
47     GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
48     FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh'
50 .use-debian:
51   extends:
52     - .ci-run-policy
53     - .fdo.distribution-image@debian
54   needs: [debian]
56 windows:
57   stage: container
58   extends:
59     - .ci-run-policy
60   variables:
61     GIT_STRATEGY: fetch # we do actually need the full repository though
62   timeout: 3h
63   tags:
64     - windows
65     - shell
66     - "1809"
67   script:
68     - .\.gitlab-ci\windows\container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE
70 .use-windows:
71   extends:
72     - .ci-run-policy
73   tags:
74     - windows
75     - docker
76     - "1809"
77   needs: [windows]
78   image: $WINDOWS_IMAGE
80 # BUILD
82 # Use ccache transparently, and print stats before/after
83 .use-ccache:
84   variables:
85     CC: /usr/lib/ccache/gcc
86     CXX: /usr/lib/ccache/g++
87     CCACHE_COMPILERCHECK: content
88     CCACHE_DIR: /cache/piglit/ccache
89   before_script:
90     - export CCACHE_BASEDIR="$PWD"
91     - ccache --show-stats
92   after_script:
93     - ccache --show-stats
95 build-debian:
96   stage: build
97   extends:
98     - .use-debian
99     - .use-ccache
100   script:
101     - .gitlab-ci/build-debian.sh
103 build-debian-mingw:
104   stage: build
105   extends:
106     - .use-debian
107     - .use-ccache
108   parallel:
109     matrix:
110       - TARGET: [mingw32, mingw64]
111   script:
112     - .gitlab-ci/build-mingw.sh ${TARGET}
113   artifacts:
114     paths:
115       - build/*/piglit-*.7z
117 build-windows:
118   stage: build
119   extends:
120     - .use-windows
121   script:
122     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
123       cmake . -D CMAKE_BUILD_TYPE=Debug
124       -D PIGLIT_BUILD_CL_TESTS=off
125       -D GLUT_INCLUDE_DIR=C:\freeglut\include
126       -D GLUT_glut_LIBRARY_RELEASE=C:\freeglut\lib\x64\freeglut.lib
127       -D GLEXT_INCLUDE_DIR=C:\glext\
128       -D PIGLIT_BUILD_DMA_BUF_TESTS=off
129       -D PIGLIT_BUILD_GLES1_TESTS=off
130       -D PIGLIT_BUILD_GLES2_TESTS=off
131       -D PIGLIT_BUILD_GLX_TESTS=off
132       -D PIGLIT_BUILD_GL_TESTS=on
133       -D PIGLIT_BUILD_WGL_TESTS=on
134       -GNinja &&
135       ninja -j4"
137 py.test:
138   stage: build
139   extends:
140     - .use-debian
141   script:
142     - pytest-3 unittests/framework
144 tox:
145   image: python:${PY_MAJVER}.${PY_MINVER}
146   stage: build
147   extends:
148     - .ci-run-policy
149   before_script:
150     - pip install tox
151   script:
152     - tox -e "py${PY_MAJVER}${PY_MINVER}-{generator,noaccel,accel-nix,streams,functional}"
153   parallel:
154     matrix:
155       - PY_MAJVER: 3
156         PY_MINVER: [6, 7, 8]
157   needs: []
159 pages:
160   stage: deploy
161   image: alpine
162   script:
163   - apk --no-cache add py3-pip python3
164   - pip install sphinx
165   - pip install Flask-Sphinx-Themes
166   - cd docs
167   - ./build-html.sh
168   - mv _build/html/ ../public/
169   artifacts:
170     paths:
171     - public
172   only:
173     refs:
174       - main
175     changes:
176       - docs/**