Merge branch 'fix_session' into 'master'
[why3.git] / .gitlab-ci.yml
blob99830b56e02782ddbd8c035adaae7381cf3cb87c
1 stages:
2   - docker
3   - build
4   - test
5   - nightly
6   - deploy
8 variables:
9   BUILD_IMAGE: "$CI_REGISTRY_IMAGE:ci-master-2023-11-13"
10   SPHINX_IMAGE: "$CI_REGISTRY_IMAGE:ci-sphinx"
11   GIT_CLEAN_FLAGS: "-ffdxq"
13 build-image:
14   stage: docker
15   image: docker
16   script:
17     - docker login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
18     - if docker pull "$BUILD_IMAGE"; then echo "Image already exists!"; exit 1; fi
19     - docker build --force-rm -t "$BUILD_IMAGE" - < misc/Dockerfile.build
20     - docker push "$BUILD_IMAGE"
21     - docker rmi "$BUILD_IMAGE"
22   only:
23     variables:
24       - $NEW_BUILD_IMAGE
25   tags:
26     - large
28 sphinx-image:
29   stage: docker
30   image: docker
31   script:
32     - docker login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
33     - docker build --force-rm -t "$SPHINX_IMAGE" - < misc/Dockerfile.sphinx
34     - docker push "$SPHINX_IMAGE"
35     - docker rmi "$SPHINX_IMAGE"
36   only:
37     variables:
38       - $NEW_SPHINX_IMAGE
39   tags:
40     - medium
42 .docker_template:
43   image: "$BUILD_IMAGE"
44   dependencies: []
45   tags:
46     - medium
48 build-system:
49   stage: build
50   variables:
51     COMPILER: system
52   script:
53     - misc/ci-local.sh
54   extends: .docker_template
56 build-latest:
57   stage: build
58   variables:
59     COMPILER: latest
60   script:
61     - misc/ci-local.sh doc
62   artifacts:
63     paths:
64       - doc/generated
65       - doc/stdlibdoc
66       - doc/apidoc
67     expire_in: 1 day
68   extends: .docker_template
70 bench-system:
71   variables:
72     COMPILER: system
73   stage: test
74   script:
75     - misc/ci-local.sh bench doc
76   extends: .docker_template
78 bench-latest:
79   variables:
80     COMPILER: latest
81   stage: test
82   script:
83     - misc/ci-local.sh ide bench
84   extends: .docker_template
86 full:
87   stage: test
88   variables:
89     COMPILER: full
90   script:
91     - misc/ci-local.sh ide doc trywhy3 bench
92     - tar xzf trywhy3.tar.gz
93   artifacts:
94     paths:
95       - trywhy3
96     expire_in: 1 day
97   extends: .docker_template
99 nightly-bench:
100   stage: nightly
101   variables:
102     COMPILER: bench
103   script:
104     - misc/ci-local.sh nightly-bench-reduced
105   extends: .docker_template
107 ce-bench:
108   stage: nightly
109   variables:
110     COMPILER: bench
111   script:
112     - misc/ci-local.sh ce-bench
113   extends: .docker_template
115 opam:
116   stage: build
117   script:
118     - opam switch bench
119     - misc/ci-opam.sh why3 why3-ide
120   extends: .docker_template
122 opam-latest:
123   stage: test
124   script:
125     - opam switch latest
126     - misc/ci-opam.sh why3 why3-ide
127   extends: .docker_template
129 opam-full:
130   stage: test
131   script:
132     - opam switch full
133     - misc/ci-opam.sh why3 why3-ide why3-coq
134   extends: .docker_template
136 trywhy3-extra:
137   stage: build
138   image: "debian:bullseye-slim"
139   script:
140     - misc/ci-trywhy3.sh
141   only:
142     variables:
143       - $NEW_TRYWHY3_EXTRA
144   artifacts:
145     paths:
146       - trywhy3
147     expire_in: never
148   tags:
149     - large
151 deploy:
152   stage: deploy
153   image: docker
154   script:
155     - BRANCH=$(echo $CI_COMMIT_REF_NAME | tr -cs "[:alnum:].\n" "-")
156     - CACHE=$CI_REGISTRY_IMAGE:cache-$BRANCH
157     - IMAGE=$CI_REGISTRY_IMAGE:$BRANCH
158     - docker login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
159     - docker pull "$CACHE" || true
160     - docker pull "$IMAGE" || true
161     - docker build --force-rm --cache-from="$CACHE" --target=builder -t "$CACHE" -f misc/Dockerfile.deploy .
162     - docker build --force-rm --cache-from="$CACHE" --cache-from="$IMAGE" -t "$IMAGE" -f misc/Dockerfile.deploy .
163     - test -n "$CI_COMMIT_TAG" || docker push "$CACHE"
164     - docker push "$IMAGE"
165     - docker rmi "$CACHE"
166     - docker rmi "$IMAGE"
167     - docker image prune -f
168   only:
169     - master
170     - /^bugfix[/]v[0-9.]*$/
171     - tags
172   tags:
173     - medium
175 doc:
176   stage: test
177   image: "$SPHINX_IMAGE"
178   dependencies:
179     - build-latest
180   script:
181     - sphinx-build -W --keep-going -b html -d doctrees doc public
182     - cp -r doc/apidoc public/api
183     - cp -r doc/stdlibdoc public/stdlib
184   artifacts:
185     paths:
186       - public
187     expire_in: 1 day
188   tags:
189     - medium
191 pages:
192   stage: deploy
193   image: busybox:uclibc
194   dependencies:
195     - doc
196   script:
197     - echo "Already in public/"
198   artifacts:
199     paths:
200       - public
201     expire_in: 1 day
202   only:
203     - master
204   tags:
205     - small