Skip to content
.gitlab-ci.yml 918 B
Newer Older
nimrod's avatar
nimrod committed
---
image: adarnimrod/ci-images:docker

stages:
nimrod's avatar
nimrod committed
  - test
nimrod's avatar
nimrod committed
  - build
  - run

nimrod's avatar
nimrod committed
pre-commit:
  stage: test
  tags: ["ns4.shore.co.il"]
  image: adarnimrod/ci-images:pre-commit
  variables:
    XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
  script:
    - pre-commit run --all-files
  cache:
    paths:
      - .cache/

nimrod's avatar
nimrod committed
build:
  stage: build
  tags: ["ns4.shore.co.il"]
  script:
nimrod's avatar
nimrod committed
    - docker-compose build --no-cache --pull
nimrod's avatar
nimrod committed

run:
  stage: run
  tags: ["ns4.shore.co.il"]
  when: manual
  script:
    - docker-compose up --detach --quiet-pull --remove-orphans
nimrod's avatar
nimrod committed
    # yamllint disable rule:line-length
nimrod's avatar
nimrod committed
    - |
        for i in $(seq 12)
        do
            docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$' || break
            sleep 10
        done
        ! docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$'