commit 57e1bfcabcea4ef467d5322b13741e69304efc20 Author: kez kez@torproject.org Date: Mon Nov 1 12:26:05 2021 -0700
Add CI file --- .gitlab-ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6b4be34 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,83 @@ +image: python:bullseye + +include: + project: tpo/tpa/ci-templates + file: static-shim-deploy.yml + +# This template should be usable on any system that's based on apt. +# taken from tor gitlabci + +.apt-template: &apt-template | + export LC_ALL=C.UTF-8 + echo Etc/UTC > /etc/timezone + mkdir -p apt-cache + export APT_CACHE_DIR="$(pwd)/apt-cache" + echo 'quiet "1";' \ + 'APT::Install-Recommends "0";' \ + 'APT::Install-Suggests "0";' \ + 'APT::Acquire::Retries "20";' \ + 'APT::Get::Assume-Yes "true";' \ + 'Dpkg::Use-Pty "0";' \ + "Dir::Cache::Archives "${APT_CACHE_DIR}"; " \ + >> /etc/apt/apt.conf.d/99gitlab + apt-get update -qq + apt-get upgrade -qy + +variables: + GIT_SUBMODULE_STRATEGY: recursive + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + SITE_URL: styleguide.torproject.org + SUBDIR: public/ + +stages: + - build + - pages + +build: + cache: + key: $CI_PROJECT_PATH_SLUG.${CI_COMMIT_REF_SLUG} + paths: + - packages + - lego + - apt-cache + - venv + - .cache/pip + - .cache/lektor/builds/ + stage: build + script: + - *apt-template + - DEBIAN_FRONTEND=noninteractive apt-get install gettext python3-babel i18nspector apt-utils ca-certificates -y + - pip3 install virtualenv + - virtualenv venv + - source venv/bin/activate + - pip3 install lektor + - echo 'reinstall lektor plugins' + - lektor plugins reinstall + - echo 'building lektor 3 more times to get translations in place' + - for i in {1..3}; do lektor build --output-path public; done + artifacts: + paths: + - public + rules: + - when: always + +pages: + cache: + key: $CI_PROJECT_PATH_SLUG.${CI_COMMIT_REF_SLUG} + paths: + - packages + - lego + - apt-cache + - venv + - .cache/pip + - .cache/lektor/builds/ + stage: pages + dependencies: + - build + script: + - rm -r public/.lektor + artifacts: + paths: + - public + rules: + - when: always