image: registry.gitlab.com/my-privacy-dns/ci-runner

variables:
  GIT_DEPTH: 5

#stages:
#  - test
#  - build
#  #- deploy
#  #- pages

before_script:
  - printf "Running before script...\n"
  - git config --global user.email "4593890-MypDNS@users.noreply.gitlab.com"
  - git config --global user.name "MypDNS"
  - git remote set-url origin https://mypdns:$MypDNS_CI@gitlab.com/$CI_PROJECT_PATH.git

after_script:
  - echo -e "After script section...\n"
  - git add .
  - git status
  - git commit -m 'Auto committed from the CI runner [skip ci]'
  - git push -u origin ${CI_COMMIT_REF_NAME}

build:
  stage: build
  only:
  - master
  script:
    - echo "Building"
    - git checkout -b ${CI_COMMIT_REF_NAME}
    - bash $CI_PROJECT_DIR/scripts/build.sh && bash $CI_PROJECT_DIR/scripts/update_active_lists.sh

test1:
  stage: test
  #only:
  #- merge_requests
  except:
    - master
  script:
    - echo "Building"
    - git checkout -b ${CI_COMMIT_REF_NAME}
    - bash $CI_PROJECT_DIR/scripts/test1.sh && bash $CI_PROJECT_DIR/scripts/update_active_lists.sh

#test2:
#  stage: test
#  script:
#    - printf "Running test 2...\n"
#    #- reuse cache
#    - bash $CI_PROJECT_DIR/scripts/test2.sh

pages:
  stage: deploy
  script:
  - echo 'Nothing to do...'
  artifacts:
    paths:
    - public
  only:
  - master
