2018-12-29 16:07:15 -06:00
|
|
|
# This CI configuration file is used to build all available versions of MusicDL. It's intended to launch a new version when a tag is pushed to master.
|
|
|
|
# In order to work, A Gitlab Runner with Windows Server 2016 Standard with the following packages is used:
|
|
|
|
# * Latest python for both 2.7 and 3.x branches.
|
|
|
|
# * Py2exe for Python 2.7
|
|
|
|
# * Microsoft Visual C++ 2015 redistributable files
|
|
|
|
# * Nsis
|
|
|
|
|
2018-12-29 09:09:25 -06:00
|
|
|
# Declare some variables dependent on the operating system where the runner is installed.
|
2018-12-29 15:04:24 -06:00
|
|
|
# This CI file assumes we install everything in C:\ (Python 2.7, 3.7 and Nsis).
|
2018-12-28 20:07:56 -06:00
|
|
|
variables:
|
2018-12-28 20:14:09 -06:00
|
|
|
PYTHON3: "C:\\python37\\python.exe"
|
2018-12-28 20:59:44 -06:00
|
|
|
PYINSTALLER: "C:\\python37\\scripts\\pyinstaller.exe"
|
2018-12-29 11:36:57 -06:00
|
|
|
NSIS: "C:\\nsis\\makensis.exe"
|
2018-12-29 09:09:25 -06:00
|
|
|
PYTHON2: "C:\\python27\\python.exe"
|
2018-12-29 13:38:25 -06:00
|
|
|
|
2018-12-29 15:04:24 -06:00
|
|
|
### Stage list
|
|
|
|
# Build: This will be the main stage generating stuff in the dist folder. Jobs present in this stage will run py2exe or pyinstaller files accordingly.
|
|
|
|
# pack: Jobs in this stage will take the dist folder and zip it or generate an exe file.
|
2018-12-29 09:09:25 -06:00
|
|
|
stages:
|
2018-12-29 20:18:37 -06:00
|
|
|
- test
|
2018-12-29 13:49:44 -06:00
|
|
|
- build
|
2018-12-29 13:38:25 -06:00
|
|
|
- pack
|
2018-12-29 09:20:22 -06:00
|
|
|
|
2018-12-29 20:18:37 -06:00
|
|
|
# Python 3 tests
|
|
|
|
test_py3:
|
|
|
|
stage: test
|
|
|
|
tags:
|
|
|
|
- windows10
|
|
|
|
before_script:
|
|
|
|
- '%PYTHON3% -v'
|
|
|
|
- '%PYTHON3% -m pip install --upgrade pip'
|
|
|
|
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
|
|
|
|
script:
|
|
|
|
- cd src
|
2018-12-29 23:54:44 -06:00
|
|
|
- '%PYTHON3% -m coverage run run_tests.py'
|
2018-12-29 23:52:24 -06:00
|
|
|
- '%PYTHON3% -m coverage report'
|
|
|
|
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
|
|
|
|
|
2018-12-29 20:18:37 -06:00
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
|
|
|
|
2018-12-29 16:07:15 -06:00
|
|
|
# Python 3 version. During this job, the dist folder, containing all files to distribute, will be generated
|
|
|
|
# and passed to build_zip and build_setup jobs.
|
2018-12-29 13:38:25 -06:00
|
|
|
build_py3:
|
2018-12-29 11:31:13 -06:00
|
|
|
stage: build
|
2018-12-28 20:07:56 -06:00
|
|
|
tags:
|
2018-12-29 09:09:25 -06:00
|
|
|
- windows10
|
2018-12-29 16:07:15 -06:00
|
|
|
# Update stuff before building versions
|
2018-12-29 09:09:25 -06:00
|
|
|
before_script:
|
2018-12-29 16:09:27 -06:00
|
|
|
- '%PYTHON3% -v'
|
2018-12-28 20:48:39 -06:00
|
|
|
- '%PYTHON3% -m pip install --upgrade pip'
|
|
|
|
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
|
2018-12-29 09:09:25 -06:00
|
|
|
script:
|
2018-12-28 20:07:56 -06:00
|
|
|
- cd src
|
2018-12-28 20:59:44 -06:00
|
|
|
- '%PYINSTALLER% main.spec'
|
2018-12-29 16:07:15 -06:00
|
|
|
# Build this automatically only when tags are pushed to master or when a pipeline has been scheduled by Gitlab.
|
2018-12-28 20:07:56 -06:00
|
|
|
only:
|
2018-12-29 15:04:24 -06:00
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
|
|
|
# Make the dist folder available to other jobs.
|
2018-12-29 16:07:15 -06:00
|
|
|
# It will expire in 30 mins as we won't need the dist folder after the pipeline is completed.
|
2018-12-29 13:38:25 -06:00
|
|
|
artifacts:
|
2018-12-29 11:52:09 -06:00
|
|
|
paths:
|
2018-12-29 11:56:12 -06:00
|
|
|
- src\\dist
|
2018-12-29 16:07:15 -06:00
|
|
|
expire_in: 30 mins
|
2018-12-29 13:38:25 -06:00
|
|
|
|
2018-12-29 16:07:15 -06:00
|
|
|
# This job takes the src\\dist folder generated in build_py3 and creates a zip file, which will be uploaded to the repository's artifacts.
|
2018-12-29 13:38:25 -06:00
|
|
|
zip_py3:
|
|
|
|
stage: pack
|
|
|
|
tags:
|
|
|
|
- windows10
|
|
|
|
only:
|
2018-12-29 15:04:24 -06:00
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
2018-12-29 13:38:25 -06:00
|
|
|
dependencies:
|
|
|
|
- build_py3
|
|
|
|
script:
|
|
|
|
- cd scripts
|
|
|
|
- '%PYTHON3% prepare_zipversion.py'
|
|
|
|
- cd ..
|
|
|
|
- move src\music_dl.zip music_dl.zip
|
2018-12-29 16:07:15 -06:00
|
|
|
# No expiry date as there will be only releases in the artifacts.
|
2018-12-29 13:41:46 -06:00
|
|
|
artifacts:
|
2018-12-28 20:07:56 -06:00
|
|
|
paths:
|
|
|
|
- music_dl.zip
|
2018-12-29 09:09:25 -06:00
|
|
|
|
2018-12-29 16:07:15 -06:00
|
|
|
# This job takes the src\\dist generated in build_py3 and creates a setup installer file.
|
2018-12-29 11:31:13 -06:00
|
|
|
build_setup:
|
2018-12-29 13:38:25 -06:00
|
|
|
stage: pack
|
2018-12-29 11:31:13 -06:00
|
|
|
tags:
|
|
|
|
- windows10
|
|
|
|
only:
|
2018-12-29 15:04:24 -06:00
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
2018-12-29 13:38:25 -06:00
|
|
|
dependencies:
|
|
|
|
- build_py3
|
2018-12-29 11:31:13 -06:00
|
|
|
script:
|
|
|
|
- cd src
|
|
|
|
- '%NSIS% installer.nsi'
|
|
|
|
- cd ..
|
2018-12-29 13:56:47 -06:00
|
|
|
- move src\music_dl* .
|
2018-12-29 11:31:13 -06:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2018-12-29 14:40:34 -06:00
|
|
|
- "music_dl_*"
|
2018-12-29 11:31:13 -06:00
|
|
|
name: music_dl
|
2018-12-29 16:07:15 -06:00
|
|
|
|
|
|
|
### Python 2 version
|
|
|
|
# this version exists for compatibility reasons with Windows XP and old operating systems and may be deleted any time soon.
|
|
|
|
# Automatic updates and generation of a windows installer file are not supported for this version.
|
|
|
|
# The following jobs are not documented as they are basically the same than those used for python 3.
|
2018-12-29 11:31:13 -06:00
|
|
|
|
2018-12-29 23:54:44 -06:00
|
|
|
# Python 2 tests
|
2018-12-29 20:18:37 -06:00
|
|
|
test_py2:
|
|
|
|
stage: test
|
|
|
|
tags:
|
|
|
|
- windows7
|
|
|
|
before_script:
|
|
|
|
- '%PYTHON2% -v'
|
|
|
|
- '%PYTHON2% -m pip install --upgrade pip'
|
|
|
|
- '%PYTHON2% -m pip install --upgrade -r requirements.txt'
|
|
|
|
script:
|
|
|
|
- cd src
|
2018-12-29 23:54:44 -06:00
|
|
|
- '%PYTHON2% -m coverage run run_tests.py'
|
2018-12-29 23:52:24 -06:00
|
|
|
- '%PYTHON2% -m coverage report'
|
|
|
|
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
|
2018-12-29 20:18:37 -06:00
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
|
|
|
|
2018-12-29 15:04:24 -06:00
|
|
|
build_py2:
|
2018-12-29 11:31:13 -06:00
|
|
|
stage: build
|
2018-12-29 09:09:25 -06:00
|
|
|
tags:
|
|
|
|
- windows7
|
|
|
|
before_script:
|
2018-12-29 16:09:27 -06:00
|
|
|
- '%PYTHON2% -v'
|
2018-12-29 09:09:25 -06:00
|
|
|
- '%PYTHON2% -m pip install --upgrade pip'
|
|
|
|
- '%PYTHON2% -m pip install --upgrade -r requirements.txt'
|
2018-12-29 11:01:01 -06:00
|
|
|
- '%PYTHON2% -m pip install --upgrade pypubsub==3.3.0 PySocks win_inet_pton'
|
2018-12-29 09:09:25 -06:00
|
|
|
script:
|
|
|
|
- cd src
|
|
|
|
- '%PYTHON2% setup.py py2exe'
|
2018-12-29 15:04:24 -06:00
|
|
|
# Make the dist folder available to other jobs.
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- src\\dist
|
2018-12-29 16:07:15 -06:00
|
|
|
expire_in: 30 mins
|
2018-12-29 15:04:24 -06:00
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
|
|
|
|
|
|
|
zip_py2:
|
|
|
|
stage: pack
|
|
|
|
tags:
|
|
|
|
- windows7
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
- schedule_pipelines
|
|
|
|
dependencies:
|
|
|
|
- build_py2
|
|
|
|
script:
|
2018-12-29 09:09:25 -06:00
|
|
|
- cd scripts
|
|
|
|
- '%PYTHON2% prepare_zipversion.py'
|
|
|
|
- cd ..
|
|
|
|
- move src\music_dl.zip music_dl_py2.zip
|
2018-12-29 09:13:19 -06:00
|
|
|
artifacts:
|
2018-12-29 09:09:25 -06:00
|
|
|
paths:
|
2018-12-29 16:07:15 -06:00
|
|
|
- music_dl_py2.zip
|