Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.05 KiB
stages:
  - test
  - build
  - release

lint:
  image: python:3

  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

  script:
    - pre-commit run -a

test-cookiecutter:
  image: python:3

  stage: test
  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"
    ARKINDEX_API_SCHEMA_URL: schema.yml

  before_script:
    - pip install cookiecutter tox pre-commit

    # Configure git to be able to commit in the hook
    - git config --global user.email "crasher@teklia.com"
    - git config --global user.name "Crash Test"

  script:
    - cookiecutter --no-input .
    - cd worker-demo
    - find
    - tox
    - pre-commit run -a

  # Store demo build for later docker build
  artifacts:
    paths:
      - worker-demo/

build-cookiecutter:
  image: docker:19.03.1
  stage: build
  services:
    - docker:dind

  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://docker:2375/

  # Ensure artifacts are available
  dependencies:
    - test-cookiecutter