Philipp Hörist pushed to branch master at gajim / gajim

Commits:

3 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -30,7 +30,7 @@ Code Quality:
    30 30
         - pip3 install -I pyOpenSSL
    
    31 31
         - mypy -V
    
    32 32
         - mypy gajim
    
    33
    -    - scripts/dev/pylint-ci.sh --jobs=2 gajim
    
    33
    +    - scripts/ci/pylint.sh --jobs=2 gajim
    
    34 34
         - coverage run --source=gajim -m unittest discover -s test/no_gui -v
    
    35 35
         - coverage report -mi
    
    36 36
         - coverage xml -i
    
    ... ... @@ -58,19 +58,8 @@ Linux:
    58 58
         - if: '$CI_PIPELINE_SOURCE == "schedule"'
    
    59 59
           when: never
    
    60 60
         - when: always
    
    61
    -  before_script:
    
    62
    -    - sudo apt-get build-dep -y -qq gajim-default-nightly
    
    63 61
       script:
    
    64
    -    - python3 setup.py sdist
    
    65
    -    - cd dist
    
    66
    -    - GF=$(basename gajim-* .tar.gz)
    
    67
    -    - gzip -d $GF.tar.gz
    
    68
    -    - mkdir -p $GF/gajim/data/plugins/
    
    69
    -    - curl -O https://ftp.gajim.org/plugins_master_zip/plugin_installer.zip
    
    70
    -    - unzip plugin_installer.zip -d $GF/gajim/data/plugins/
    
    71
    -    - rm plugin_installer.zip
    
    72
    -    - tar -uf $GF.tar $GF
    
    73
    -    - gzip $GF.tar
    
    62
    +    - ./scripts/ci/sdist.py
    
    74 63
     
    
    75 64
       artifacts:
    
    76 65
         name: "gajim-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA"
    

  • scripts/dev/pylint-ci.sh → scripts/ci/pylint.sh

  • scripts/ci/sdist.py
    1
    +#!/usr/bin/env python3
    
    2
    +
    
    3
    +import os
    
    4
    +import io
    
    5
    +import zipfile
    
    6
    +import subprocess
    
    7
    +import shutil
    
    8
    +from pathlib import Path
    
    9
    +import requests
    
    10
    +
    
    11
    +PLUGINS = [
    
    12
    +    'plugin_installer',
    
    13
    +]
    
    14
    +
    
    15
    +PLUGINS_BASE_URL = 'https://ftp.gajim.org'
    
    16
    +PLUGINS_FOLDER = Path('./gajim/data/plugins')
    
    17
    +
    
    18
    +COMMIT_BRANCH = os.environ['CI_COMMIT_BRANCH']
    
    19
    +
    
    20
    +
    
    21
    +def get_plugins_folder():
    
    22
    +    if COMMIT_BRANCH == 'master':
    
    23
    +        return 'plugins_master_zip'
    
    24
    +
    
    25
    +    version = COMMIT_BRANCH.split('_')[1]
    
    26
    +    return f'plugins_{version}_zip'
    
    27
    +
    
    28
    +
    
    29
    +def get_plugins_url(plugin):
    
    30
    +    folder = get_plugins_folder()
    
    31
    +    return f'{PLUGINS_BASE_URL}/{folder}/{plugin}.zip'
    
    32
    +
    
    33
    +
    
    34
    +def extraxt_zip(zip_bytes, path):
    
    35
    +    print('Extract to', path)
    
    36
    +    with zipfile.ZipFile(io.BytesIO(zip_bytes)) as zip_file:
    
    37
    +        zip_file.extractall(path)
    
    38
    +
    
    39
    +
    
    40
    +def download_plugins():
    
    41
    +    PLUGINS_FOLDER.mkdir(parents=True)
    
    42
    +    for plugin in PLUGINS:
    
    43
    +        url = get_plugins_url(plugin)
    
    44
    +        print('Download', url)
    
    45
    +        req = requests.get(url)
    
    46
    +        req.raise_for_status()
    
    47
    +        extraxt_zip(req.content, PLUGINS_FOLDER)
    
    48
    +
    
    49
    +
    
    50
    +def setup():
    
    51
    +    print('Setup')
    
    52
    +    subprocess.call(['python3', 'setup.py', 'sdist'])
    
    53
    +
    
    54
    +
    
    55
    +def cleanup():
    
    56
    +    print('Cleanup')
    
    57
    +    shutil.rmtree(PLUGINS_FOLDER)
    
    58
    +
    
    59
    +
    
    60
    +download_plugins()
    
    61
    +setup()
    
    62
    +cleanup()