.gitlab-ci.yml
stages:
- testing
- styling
- build
- deploy
variables:
LATEST_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest
LATEST_DEV_IMAGE_NAME: $CI_REGISTRY_IMAGE:latest-dev
RELEASE_IMAGE_REGISTRY: $CI_REGISTRY_IMAGE/releases
docker master image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- TAG=$(git describe --tags --always --abbrev=0)
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $LATEST_IMAGE_NAME || true
- docker build --cache-from $LATEST_IMAGE_NAME -t $LATEST_IMAGE_NAME .
- docker tag $LATEST_IMAGE_NAME $RELEASE_IMAGE_REGISTRY:$TAG
- docker push $LATEST_IMAGE_NAME
- docker push $RELEASE_IMAGE_REGISTRY:$TAG
only:
- master
docker dev image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $LATEST_DEV_IMAGE_NAME || true
- docker build --cache-from $LATEST_DEV_IMAGE_NAME -t $LATEST_DEV_IMAGE_NAME .
- docker push $LATEST_DEV_IMAGE_NAME
only:
- develop
docker image:
stage: build
image: docker:git
tags:
- docker
services:
- docker:dind
script:
- docker build .
except:
- develop
- master
python-testing:
services:
- postgres:9.6
variables:
PSQL_USER: eventol
PSQL_DBNAME: eventol
PSQL_HOST: postgres
POSTGRES_DB: eventol
POSTGRES_USER: eventol
POSTGRES_PASSWORD: secret
image: python:3.9.6
stage: testing
script:
- make gitlab-python-testing
artifacts:
paths:
- eventol/htmlcov
react-testing:
image: node:16
stage: testing
script:
- make gitlab-react-testing
artifacts:
paths:
- eventol/front/coverage
python-lint:
image: python:3.9.6
stage: styling
allow_failure: true
script:
- make gitlab-python-lint
react-lint-report:
image: node:16
stage: styling
allow_failure: true
script:
- make gitlab-react-lint-with-report
artifacts:
paths:
- eventol/front/report.html
react-lint:
image: node:16
stage: styling
allow_failure: true
script:
- make gitlab-react-lint
sass-lint-report:
image: node:16
stage: styling
allow_failure: true
script:
- make gitlab-react-sasslint-with-report
artifacts:
paths:
- eventol/front/scss-lint-report.html
sass-lint:
image: node:16
stage: styling
allow_failure: true
script:
- make gitlab-react-sasslint
deploy:
stage: deploy
when: manual
only:
- master
image: docker:git
script:
- apk update && apk add sshpass
- export SSHPASS=$SSH_PASS
- sshpass -e ssh -p$SSH_PORT -o stricthostkeychecking=no -x $SSH_USER@$SSH_HOST $SSH_SCRIPT
deploy-sandbox:
stage: deploy
only:
- develop
image: docker:git
script:
- apk update && apk add sshpass
- export SSHPASS=$SANDBOX_PASS
- sshpass -e ssh -p$SANDBOX_PORT -o stricthostkeychecking=no -x $SANDBOX_USER@$SANDBOX_HOST $SANDBOX_SCRIPT