
variables:
  NIXOS_VERSION: "23.11"
  NIXPKGS_ALLOW_UNFREE: "1"
  NIXPKGS_ALLOW_INSECURE: "1"
  GIT_DEPTH: 10

stages:
  - test
  - deploy 

#before_script:
#  - git config --global user.email "${GITLAB_USER_EMAIL}"
#  - git config --global user.name "${GITLAB_USER_NAME}"
#  - git config --global credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=${CI_JOB_TOKEN}"; }; f'
#  - git config --global pull.rebase true
#  - git config --global http.sslVerify "false"

after_script:
  - if [ -f .env-gitlab-ci ]; then rm .env-gitlab-ci; fi

tests:
  stage: test
  tags:
    - nixos-gen3
  script:
    -  nix develop .#gitlab --command run-ci-tests
  cache:
    untracked: true
    key:
      files:
        - pnpm-lock.yaml
    paths:
      - node_modules/

web-tests:
  stage: test
  tags:
    - nixos-gen3
  script:
    -  nix develop .#gitlab --command run-web-tests
  cache:
    untracked: true
    key:
      files:
        - pnpm-lock.yaml
    paths:
      - node_modules/
  artifacts:
    paths:
      - screenshot.png
  
  
  
  
  #deploy:
#  stage: deploy
#  tags:
#    - nixos-gen3
#  script:
#    - nix develop --command deploy
#  after_script:
#    - nix develop --command clean-up 
#
#  when: on_success
  