image: $CI_REGISTRY/chrissi/container-flamingo:latest

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
  paths:
    - .cache/pip

before_script:
  - python -V  # Print out python version for debugging

pages:
    stage: deploy
    rules:
      # This ensures that only pushes to the default branch will trigger
      # a pages deploy
      - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
    script:
      - echo $CI_COMMIT_REF_SLUG > REF_SLUG
      - make env
      - source env/bin/activate && pip list
      - make html
      - mv output/ public/
    artifacts:
      paths:
      - public

test:
    stage: test
    rules:
      # This ensures that only pushes to the default branch will trigger
      # a pages deploy
      - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
    script:
      - echo $CI_COMMIT_REF_SLUG > REF_SLUG
      - make env
      - source env/bin/activate && pip list
      - make html
      - mv output/ public/
    artifacts:
      paths:
      - public