Newer
Older
# GitLab provides a template to ensure pipelines run only for branches and tags, not for merge requests
# This prevents duplicate pipelines in merge requests.
# See https://docs.gitlab.com/ee/ci/troubleshooting.html#job-may-allow-multiple-pipelines-to-run-for-a-single-action
include:
- template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
# For jobs that run backend scripts directly
.backend-setup:
image: registry.gitlab.teklia.com/arkindex/backend/base:gitlab-teklia
- "echo database: {host: postgres, port: 5432} > $CONFIG_PATH"
- pip install -e .[test]
# Those jobs require the base image; they might fail if the image is not up to date.
# Allow them to fail when building a new base image, to prevent them from blocking a new base image build
# Never run those jobs on scheduled pipelines
rules:
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^base-.*/'
allow_failure: true
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- when: on_success
variables:
# For the postgres image
POSTGRES_DB: arkindex_dev
POSTGRES_USER: devuser
POSTGRES_PASSWORD: devdata
- name: postgis/postgis:14-3.2
artifacts:
when: always
reports:
junit:
cache:
paths:
- .cache/pip
- .cache/pre-commit
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
before_script:
- pip install pre-commit
- name: postgis/postgis:12-3.1
- arkindex makemigrations --check --noinput --dry-run -v 3
backend-openapi:
extends: .backend-setup
stage: build
script:
- ci/openapi.sh
artifacts:
paths:
- output/
artifacts:
paths:
- static
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
backend-build-base:
stage: build
image: docker:19.03.1
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
# Run this only on base tags
rules:
- if: '$CI_COMMIT_TAG =~ /^base-.*/'
when: on_success
- when: never
script:
- ci/build-base.sh
backend-build:
stage: build
image: docker:19.03.1
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
# Run this on master and tags except base tags and schedules
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
when: on_success
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^base-.*/'
when: on_success
- when: never
script:
# Make sure arkindex is always compatible with Nuitka
backend-build-binary:
stage: build
image: python:3.10
before_script:
- pip install nuitka
script:
- python -m nuitka --nofollow-imports --include-package=arkindex --nofollow-import-to=*.tests arkindex/manage.py
except:
- schedules
image: python:3-slim
# Run this on any version tag except base images
rules:
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^base-.*/'
when: on_success
- when: never
# Run immediately once backend-static ends without waiting for others
needs:
- backend-static
# Ensure artifacts are available
dependencies:
- backend-static
script:
- ci/static-deploy.sh
backend-openapi-deploy:
stage: deploy
image: python:3-slim
# Run on master updates only
only:
- master
except:
- schedules
# Ensure artifacts are available
dependencies:
- backend-openapi
before_script:
- pip install awscli
script:
- aws s3 cp output/schema.yml s3://teklia-assets-release/arkindex/openapi.yml
image: getsentry/sentry-cli
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^base-.*/'
when: on_success
- when: never
variables:
RELEASE: "arkindex-backend@$CI_COMMIT_TAG"
SENTRY_ORG: teklia
SENTRY_PROJECT: arkindex-backend
dependencies:
- backend-build
script:
- sentry-cli releases new --finalize $RELEASE
rules:
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^base-.*/'
when: on_success
- when: never
only:
- schedules
script:
- devops python-deps requirements.txt base/requirements.txt tests-requirements.txt