# ====================================================================================== # ====================================================================================== # 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