cmake: fix unusually formated statement
[piglit.git] / .gitlab-ci.yml
blob58672fa681b1f8ea7285ef6339f2ce8478db6111
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: "2024-03-25-codespell-ignorelist"
13   FDO_DISTRIBUTION_VERSION: bullseye-slim
14   WINDOWS_TAG: "2022-07-27-win2022"
15   WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/windows/x64_build:$WINDOWS_TAG"
16   WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/windows/x64_build:$WINDOWS_TAG"
17   GIT_DEPTH: 100
19 workflow:
20   rules:
21     - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
22     - if: $CI_PIPELINE_SOURCE == 'push'
24 include:
25   - project: 'freedesktop/ci-templates'
26     ref: ffe4d1b10aab7534489f0c4bbc4c5899df17d3f2
27     file: '/templates/debian.yml'
29 stages:
30   - container
31   - check
32   - build
33   - deploy
36 # When & how to run the CI
37 .ci-run-policy:
38   retry:
39     max: 2
40     when:
41       - runner_system_failure
42   # Cancel CI run if a newer commit is pushed to the same branch
43   interruptible: true
45 # CONTAINERS
47 debian:
48   stage: container
49   extends:
50     - .ci-run-policy
51     - .fdo.container-build@debian
52   variables:
53     GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
54     FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh'
56 .use-debian:
57   extends:
58     - .ci-run-policy
59     - .fdo.distribution-image@debian
60   needs: [debian]
62 windows:
63   stage: container
64   extends:
65     - .ci-run-policy
66   variables:
67     GIT_STRATEGY: fetch # we do actually need the full repository though
68   timeout: 3h
69   tags:
70     - windows
71     - shell
72     - "2022"
73   script:
74     - .\.gitlab-ci\windows\container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE
76 .use-windows:
77   extends:
78     - .ci-run-policy
79   tags:
80     - windows
81     - docker
82     - "2022"
83   needs: [windows]
84   image: $WINDOWS_IMAGE
86 # CHECK
87 linting:
88   stage: check
89   extends:
90     - .use-debian
91   script:
92     - codespell -f -S ".mypy_cache,drm_fourcc.h" -L "lod,inout,nd,valu,tese,ba,te,nin,marge,stach"
93     - export CHECKPATH=framework/replay # restrict Python checks only on framework/replay for now
94     - isort --check-only $CHECKPATH
95     - flake8 --max-line-length=120 --show-source $CHECKPATH
96     - mypy --ignore-missing-imports --disallow-incomplete-defs $CHECKPATH
97     - pylint --fail-under=8.5 $CHECKPATH
100 # BUILD
102 # Use ccache transparently, and print stats before/after
103 .use-ccache:
104   variables:
105     CC: /usr/lib/ccache/gcc
106     CXX: /usr/lib/ccache/g++
107     CCACHE_COMPILERCHECK: content
108     CCACHE_DIR: /cache/piglit/ccache
109   before_script:
110     - export CCACHE_BASEDIR="$PWD"
111     - ccache --show-stats
112   after_script:
113     - ccache --show-stats
115 build-debian:
116   stage: build
117   extends:
118     - .use-debian
119     - .use-ccache
120   script:
121     - .gitlab-ci/build-debian.sh
122   artifacts:
123     when: on_failure
124     paths:
125       - CMakeCache.txt
126       - CMakeFiles/*.log
128 build-debian-mingw:
129   stage: build
130   extends:
131     - .use-debian
132     - .use-ccache
133   parallel:
134     matrix:
135       - TARGET: [mingw32, mingw64]
136   script:
137     - .gitlab-ci/build-mingw.sh ${TARGET}
138   artifacts:
139     paths:
140       - build/*/piglit-*.7z
142 build-windows:
143   stage: build
144   extends:
145     - .use-windows
146   script:
147     - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
148       cmake . -D CMAKE_BUILD_TYPE=Debug
149       -D PIGLIT_BUILD_CL_TESTS=off
150       -D GLUT_INCLUDE_DIR=C:\freeglut\include
151       -D GLUT_glut_LIBRARY_RELEASE=C:\freeglut\lib\x64\freeglut.lib
152       -D GLEXT_INCLUDE_DIR=C:\glext\
153       -D PIGLIT_BUILD_DMA_BUF_TESTS=off
154       -D PIGLIT_BUILD_GLES1_TESTS=off
155       -D PIGLIT_BUILD_GLES2_TESTS=off
156       -D PIGLIT_BUILD_GLX_TESTS=off
157       -D PIGLIT_BUILD_GL_TESTS=on
158       -D PIGLIT_BUILD_WGL_TESTS=on
159       -GNinja &&
160       ninja -j4"
162 py.test:
163   stage: build
164   extends:
165     - .use-debian
166   script:
167     - pytest-3 unittests/framework
169 tox:
170   image: python:${PY_MAJVER}.${PY_MINVER}
171   stage: build
172   extends:
173     - .ci-run-policy
174   before_script:
175     - pip install tox==4.4.6
176   script:
177     - tox run -e "py${PY_MAJVER}${PY_MINVER}-generator, py${PY_MAJVER}${PY_MINVER}-noaccel, py${PY_MAJVER}${PY_MINVER}-accel-nix, py${PY_MAJVER}${PY_MINVER}-streams, py${PY_MAJVER}${PY_MINVER}-functional"
178   parallel:
179     matrix:
180       - PY_MAJVER: 3
181         PY_MINVER: [7, 8, 9, 10, 11]
182   needs: []
184 pages:
185   stage: deploy
186   image: alpine
187   script:
188   - apk --no-cache add py3-pip python3
189   - pip install sphinx
190   - pip install Flask-Sphinx-Themes
191   - cd docs
192   - ./build-html.sh
193   - mv _build/html/ ../public/
194   artifacts:
195     paths:
196     - public
197   only:
198     refs:
199       - main
200     changes:
201       - docs/**