Commit c2256afd authored by GELGON's avatar GELGON
Browse files

.gitlab-ci

parent 0cb808de
Pipeline #6129 passed with stage
# ---------------------------------------------------------------
# Global
# ---------------------------------------------------------------
# to build docker in docker
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
PACKAGE_NAME: opensearx_ws
# default image
image: python:latest
# stages (main steps of pipeline)
stages:
- Quality
- Sonarqube
- Documentation
- Deploy
# ---------------------------------------------------------------
# Jobs templates
# ---------------------------------------------------------------
.code-changes-template: &code-changes
only:
changes:
- ${PACKAGE_NAME}/**/*.py
- tests/**/*.py
- .gitlab-ci.yml
- pyproject.toml
.install-deps-template: &install-deps
before_script:
- pip install poetry poetry-dynamic-versioning poetry2conda
- poetry config virtualenvs.in-project false
- poetry install -vv
tags: [opensearx-runner]
.quality-template: &quality
<<: *install-deps
<<: *code-changes
image: python:3.8
stage: Quality
allow_failure: true
except:
- tags
# ---------------------------------------------------------------
# Quality jobs
# ---------------------------------------------------------------
flake8:
<<: *quality
script:
- poetry run flake8 --max-line-length=120 --docstring-convention google ${PACKAGE_NAME}
pylint:
<<: *quality
script:
- "poetry run pylint --exit-zero ${PACKAGE_NAME} tests -r n --max-line-length=120 --msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' | tee pylint.txt"
artifacts:
expire_in: 1 week
paths:
- pylint.txt
# ---------------------------------------------------------------
# SonarQube
# ---------------------------------------------------------------
#sonarqube:
# stage: Sonarqube
# tags: [opensearx-runner]
# image:
# name: sonarsource/sonar-scanner-cli:latest
# entrypoint: [""]
# allow_failure: true
# script:
# - sonar-scanner
# -Dsonar.projectKey=${CI_PROJECT_NAME}
# -Dsonar.language=py
# -Dsonar.host.url=http://visi-common-sonar:9000
# -Dsonar.login=e6f816eee72d3d5c03319ec74b468157b9164d12
# -Dsonar.sourceEncoding=UTF-8
# -Dsonar.python.coverage.reportPaths=coverage.xml
# -Dsonar.coverage.exclusions=**__init__**,tests/**
# -Dsonar.python.pylint.reportPath=pylint.txt
# <<: *code-changes
# except:
# - tags
# ---------------------------------------------------------------
# Produce docker image
# ---------------------------------------------------------------
build_and_push_docker:
# pipeline stage
stage: Deploy
# gitlab runner
tags: [opensearx-runner]
# docker image used to run build_and_push_docker
image: docker:latest
# commands to execute
script:
- test -n "${CI_BUILD_TOKEN}" && docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY} || true
- docker build -t ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:${CI_COMMIT_TAG} .
- docker push ${REGISTRY_PATH} ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}:${CI_COMMIT_TAG}
# trigger : only on tag creation
only:
- tags
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment