before_script:
  - sudo apt-get build-dep -y -qq gajim-default-nightly

stages:
  - test
  - build

run-tests:
  stage: test
  script:
    - rm -rf civenv-master
    - virtualenv -p python3 --system-site-packages civenv
    - . ./civenv/bin/activate
    - pip3 install -I mypy
    - pip3 install -I git+https://dev.gajim.org/gajim/python-nbxmpp.git@master
    - pip3 install -I pylint==2.4.4
    - pip3 install -I codespell
    - pip3 install -I css-parser
    - pip3 install -I keyring
    - pip3 install -I packaging
    - pip3 install -I precis-i18n
    - pip3 install -I pyOpenSSL
    - pip3 install -I pycairo
    - mypy -V
    - mypy gajim
    - scripts/dev/pylint-ci.sh --jobs=2 gajim
    - python3 -m unittest discover -s test/no_gui -v
    - codespell -I codespell.conf --skip="*__pycache__*,gajim/data/icons,gajim/data/sounds,gajim/data/emoticons" gajim
    - deactivate
    - rm -rf civenv-master

run-appdata:
  stage: test
  script:
    - appstream-util validate data/org.gajim.Gajim.appdata.xml.in

run-build:
  stage: build
  script:
    - python3 setup.py sdist
    - cd dist
    - GF=$(basename gajim-* .tar.gz)
    - gzip -d $GF.tar.gz
    - mkdir -p $GF/gajim/data/plugins/
    - curl -O https://ftp.gajim.org/plugins_1/plugin_installer.zip
    - unzip plugin_installer.zip -d $GF/gajim/data/plugins/
    - rm plugin_installer.zip
    - tar -uf $GF.tar $GF
    - gzip $GF.tar

  artifacts:
    name: "gajim-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA"
    expire_in: 1 week
    paths:
      - dist/gajim-*.tar.gz
