image: gitlab.liu.se:5000/starcraft-ai-course/pycommandcenter  

stages:
    - compile
    - deploy

compile:
  variables:
    GIT_SUBMODULE_STRATEGY: recursive
  stage: compile
  script:
    - mkdir build
    - cd build
    - cmake ..
    - make commandcenter
  artifacts:
    paths:
      - docs
      - build
      - scripts/generate_pydocs.py
    expire_in: 10 minutes
  only:
    - master

pages:
  variables:
    GIT_STRATEGY: none
    GIT_CHECKOUT: false
  stage: deploy
  script:
    - cd docs
    - python3 -c "import sys, os, conf, commandcenter"
    - make html
    - cd ..
    - mkdir public
    - cp -r docs/_build/html/* public
  artifacts:
    paths:
      - public
  only:
    - master

pack-linux:
  variables:
    GIT_STRATEGY: none
    GIT_CHECKOUT: false
  stage: deploy
  script:
    - cd build/python-api-src
    - stubgen -m commandcenter -o .
    - cd ../..
    - python3 scripts/generate_pydocs.py
  artifacts:
    paths:
      - build/python-api-src/commandcenter.cpython-312-x86_64-linux-gnu.so
      - build/python-api-src/commandcenter.pyi
  only:
    - master