-
Notifications
You must be signed in to change notification settings - Fork 20
/
.gitlab-ci.yml
113 lines (101 loc) · 4.94 KB
/
.gitlab-ci.yml
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
# This file configures the GitLab Continuous Integration system,
# and as such has little to do with core git, the version control system.
# See also here: https://docs.gitlab.com/ee/ci/quick_start/#create-a-gitlab-ciyml-file
# It relies heavily on the Makefile, also part of this repository.
# ======================================================================================
# ======================================================================================
# Global defaults, overwritable in each job
# ======================================================================================
# ======================================================================================
default:
image:
# Image from dockerhub per default. Specify full path to use a different image.
name: alexpovel/latex
# Override any entrypoint back to a naked shell so that job `script`s can be
# executed normally.
# See also: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image
# Cannot use `make` as ENTRYPOINT even if all scripts used it: runner expects an
# entrypoint that accepts shell scripts ("the runner expects that the image has
# no entrypoint or that the entrypoint is prepared to start a shell command. ")
# See also:
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image
entrypoint: [""]
# ======================================================================================
# ======================================================================================
# Job templates (start with period).
# Not actually run by the runner, but can be used to extend other jobs, keeping the
# config dry.
# The main logic happens here, the actual jobs only combine these as needed.
# ======================================================================================
# ======================================================================================
.make: # Core job template
# Use make as the basis for all jobs. This allows to also easily run the steps
# offline/locally, as well as transition to other CI engines. All job names have to
# correspond to targets make knows about (see Makefile).
# Note we cannot have `default: script:`, so this approach works better.
script: make ${CI_JOB_NAME}
.pdf: # Job template for PDF-producing jobs
extends: .make
stage: build
before_script:
# Make sure to clean any PDFs that might have crept in via the cache, forcing a
# remake at least once (otherwise, no remake might occur).
# It would be better to exclude the PDFs from the cache in the first place. This is
# not available yet, see: https://gitlab.com/gitlab-org/gitlab/-/issues/220017#note_440142507
- make clean-pdf
# LaTeX and pandoc stages both provide PDFs:
artifacts:
# artifacts.zip is renamed to current tag/branch:
name: "$CI_COMMIT_REF_NAME"
paths:
# Return all found *.pdf-files using wildcard.
# For example, a thesis and the accompanying presentation.
- "*.pdf"
.test:
extends: .make
stage: test
# Would be ideal to read the image tag from `pyproject.toml`, i.e. the poetry project
# file. See also: https://gitlab.com/gitlab-org/gitlab/-/issues/34202#note_444271649.
image: python:3.7.9
variables:
PIP_DOWNLOAD_DIR: ".pip"
before_script:
- cd tests
# Allow caching by only downloading first:
- pip download --dest=${PIP_DOWNLOAD_DIR} poetry
- pip install --find-links=${PIP_DOWNLOAD_DIR} poetry
# Make available for caching by installing to current directory:
- poetry config virtualenvs.in-project true
- poetry install -vv
cache:
untracked: true
key:
files:
# Cache is invalidated if any of these files changes, but also shared if
# these two files are equal.
- poetry.lock
- pyproject.toml
# ======================================================================================
# ======================================================================================
# Actual job definitions.
# All job names have to correspond to make targets, see .make above.
# ======================================================================================
# ======================================================================================
preflight:
extends: .make
stage: .pre
# Preflight checks are relevant, but we are interested in how exactly later jobs
# error out if preflight fails. Therefore, allow failure.
allow_failure: true
tex:
extends: .pdf
cache:
untracked: true
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
README.pdf:
extends: .pdf
test-self:
extends: .test
needs: [] # Allows job to start immediately
test-pdfs:
extends: .test