summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: a68baf4d533fbfc47262b270fe2d20eefd3e2486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# This is the tag of the docker image used for the build jobs. If the
# image doesn't exist yet, the containers stage generates it.
#
# In order to generate a new image, one should generally change the tag.
# While removing the image from the registry would also work, that's not
# recommended except for ephemeral images during development: Replacing
# an image after a significant amount of time might pull in newer
# versions of gcc/clang or other packages, which might break the build
# with older commits using the same tag.
variables:
  FDO_UPSTREAM_REPO: mesa/piglit
  FDO_DISTRIBUTION_TAG: "2022-09-11-add-isort"
  FDO_DISTRIBUTION_VERSION: bullseye-slim
  WINDOWS_TAG: "2022-07-27-win2022"
  WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/windows/x64_build:$WINDOWS_TAG"
  WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$UPSTREAM_REPO/windows/x64_build:$WINDOWS_TAG"
  GIT_DEPTH: 100

include:
  - project: 'freedesktop/ci-templates'
    ref: 34f4ade99434043f88e164933f570301fd18b125
    file: '/templates/debian.yml'

stages:
  - container
  - check
  - build
  - deploy


# When & how to run the CI
.ci-run-policy:
  retry:
    max: 2
    when:
      - runner_system_failure
  # Cancel CI run if a newer commit is pushed to the same branch
  interruptible: true

# CONTAINERS

debian:
  stage: container
  extends:
    - .ci-run-policy
    - .fdo.container-build@debian
  variables:
    GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
    FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh'

.use-debian:
  extends:
    - .ci-run-policy
    - .fdo.distribution-image@debian
  needs: [debian]

windows:
  stage: container
  extends:
    - .ci-run-policy
  variables:
    GIT_STRATEGY: fetch # we do actually need the full repository though
  timeout: 3h
  tags:
    - windows
    - shell
    - "2022"
  script:
    - .\.gitlab-ci\windows\container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE

.use-windows:
  extends:
    - .ci-run-policy
  tags:
    - windows
    - docker
    - "2022"
  needs: [windows]
  image: $WINDOWS_IMAGE

# CHECK
linting:
  stage: check
  extends:
    - .use-debian
  script:
    - codespell -f -S ".mypy_cache" -L "lod,LOD,inout,nd,ND,valu,VALU,tese,ba,te,nin"
    - export CHECKPATH=framework/replay # restrict Python checks only on framework/replay for now
    - isort --check-only $CHECKPATH
    - flake8 --max-line-length=120 --show-source $CHECKPATH
    - mypy --ignore-missing-imports --disallow-incomplete-defs $CHECKPATH
    - pylint --fail-under=8.5 $CHECKPATH


# BUILD

# Use ccache transparently, and print stats before/after
.use-ccache:
  variables:
    CC: /usr/lib/ccache/gcc
    CXX: /usr/lib/ccache/g++
    CCACHE_COMPILERCHECK: content
    CCACHE_DIR: /cache/piglit/ccache
  before_script:
    - export CCACHE_BASEDIR="$PWD"
    - ccache --show-stats
  after_script:
    - ccache --show-stats

build-debian:
  stage: build
  extends:
    - .use-debian
    - .use-ccache
  script:
    - .gitlab-ci/build-debian.sh
  artifacts:
    when: on_failure
    paths:
      - CMakeCache.txt
      - CMakeFiles/*.log

build-debian-mingw:
  stage: build
  extends:
    - .use-debian
    - .use-ccache
  parallel:
    matrix:
      - TARGET: [mingw32, mingw64]
  script:
    - .gitlab-ci/build-mingw.sh ${TARGET}
  artifacts:
    paths:
      - build/*/piglit-*.7z

build-windows:
  stage: build
  extends:
    - .use-windows
  script:
    - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
      cmake . -D CMAKE_BUILD_TYPE=Debug
      -D PIGLIT_BUILD_CL_TESTS=off
      -D GLUT_INCLUDE_DIR=C:\freeglut\include
      -D GLUT_glut_LIBRARY_RELEASE=C:\freeglut\lib\x64\freeglut.lib
      -D GLEXT_INCLUDE_DIR=C:\glext\
      -D PIGLIT_BUILD_DMA_BUF_TESTS=off
      -D PIGLIT_BUILD_GLES1_TESTS=off
      -D PIGLIT_BUILD_GLES2_TESTS=off
      -D PIGLIT_BUILD_GLX_TESTS=off
      -D PIGLIT_BUILD_GL_TESTS=on
      -D PIGLIT_BUILD_WGL_TESTS=on
      -GNinja &&
      ninja -j4"

py.test:
  stage: build
  extends:
    - .use-debian
  script:
    - pytest-3 unittests/framework

tox:
  image: python:${PY_MAJVER}.${PY_MINVER}
  stage: build
  extends:
    - .ci-run-policy
  before_script:
    - pip install tox
  script:
    - tox -e "py${PY_MAJVER}${PY_MINVER}-{generator,noaccel,accel-nix,streams,functional}"
  parallel:
    matrix:
      - PY_MAJVER: 3
        PY_MINVER: [7, 8, 9, 10]
  needs: []

pages:
  stage: deploy
  image: alpine
  script:
  - apk --no-cache add py3-pip python3
  - pip install sphinx
  - pip install Flask-Sphinx-Themes
  - cd docs
  - ./build-html.sh
  - mv _build/html/ ../public/
  artifacts:
    paths:
    - public
  only:
    refs:
      - main
    changes:
      - docs/**