music-dl/.gitlab-ci.yml

132 lines
3.8 KiB
YAML
Raw Normal View History

# 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 16:09:25 +01:00
# Declare some variables dependent on the operating system where the runner is installed.
2018-12-29 22:04:24 +01:00
# This CI file assumes we install everything in C:\ (Python 2.7, 3.7 and Nsis).
2018-12-29 03:07:56 +01:00
variables:
2018-12-29 03:14:09 +01:00
PYTHON3: "C:\\python37\\python.exe"
2018-12-29 03:59:44 +01:00
PYINSTALLER: "C:\\python37\\scripts\\pyinstaller.exe"
2018-12-29 18:36:57 +01:00
NSIS: "C:\\nsis\\makensis.exe"
2018-12-29 16:09:25 +01:00
PYTHON2: "C:\\python27\\python.exe"
2018-12-29 20:38:25 +01:00
2018-12-29 22:04:24 +01: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 16:09:25 +01:00
stages:
2018-12-29 20:49:44 +01:00
- build
2018-12-29 20:38:25 +01:00
- pack
2018-12-29 16:20:22 +01: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 20:38:25 +01:00
build_py3:
stage: build
2018-12-29 03:07:56 +01:00
tags:
2018-12-29 16:09:25 +01:00
- windows10
# Update stuff before building versions
2018-12-29 16:09:25 +01:00
before_script:
- '%PYTHON3% -v
2018-12-29 03:48:39 +01:00
- '%PYTHON3% -m pip install --upgrade pip'
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
2018-12-29 16:09:25 +01:00
script:
2018-12-29 03:07:56 +01:00
- cd src
2018-12-29 03:59:44 +01:00
- '%PYINSTALLER% main.spec'
# Build this automatically only when tags are pushed to master or when a pipeline has been scheduled by Gitlab.
2018-12-29 03:07:56 +01:00
only:
2018-12-29 22:04:24 +01:00
- tags
- schedule_pipelines
# Make the dist folder available to other jobs.
# It will expire in 30 mins as we won't need the dist folder after the pipeline is completed.
2018-12-29 20:38:25 +01:00
artifacts:
2018-12-29 18:52:09 +01:00
paths:
2018-12-29 18:56:12 +01:00
- src\\dist
expire_in: 30 mins
2018-12-29 20:38:25 +01: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 20:38:25 +01:00
zip_py3:
stage: pack
tags:
- windows10
only:
2018-12-29 22:04:24 +01:00
- tags
- schedule_pipelines
2018-12-29 20:38:25 +01:00
dependencies:
- build_py3
script:
- cd scripts
- '%PYTHON3% prepare_zipversion.py'
- cd ..
- move src\music_dl.zip music_dl.zip
# No expiry date as there will be only releases in the artifacts.
2018-12-29 20:41:46 +01:00
artifacts:
2018-12-29 03:07:56 +01:00
paths:
- music_dl.zip
2018-12-29 16:09:25 +01:00
# This job takes the src\\dist generated in build_py3 and creates a setup installer file.
build_setup:
2018-12-29 20:38:25 +01:00
stage: pack
tags:
- windows10
only:
2018-12-29 22:04:24 +01:00
- tags
- schedule_pipelines
2018-12-29 20:38:25 +01:00
dependencies:
- build_py3
script:
- cd src
- '%NSIS% installer.nsi'
- cd ..
2018-12-29 20:56:47 +01:00
- move src\music_dl* .
artifacts:
paths:
- "music_dl_*"
name: music_dl
### 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 22:04:24 +01:00
build_py2:
stage: build
2018-12-29 16:09:25 +01:00
tags:
- windows7
before_script:
- '%PYTHON2% -v
2018-12-29 16:09:25 +01:00
- '%PYTHON2% -m pip install --upgrade pip'
- '%PYTHON2% -m pip install --upgrade -r requirements.txt'
2018-12-29 18:01:01 +01:00
- '%PYTHON2% -m pip install --upgrade pypubsub==3.3.0 PySocks win_inet_pton'
2018-12-29 16:09:25 +01:00
script:
- cd src
- '%PYTHON2% setup.py py2exe'
2018-12-29 22:04:24 +01:00
# Make the dist folder available to other jobs.
artifacts:
paths:
- src\\dist
expire_in: 30 mins
2018-12-29 22:04:24 +01:00
only:
- master
- tags
- schedule_pipelines
zip_py2:
stage: pack
tags:
- windows7
only:
- master
- tags
- schedule_pipelines
dependencies:
- build_py2
script:
2018-12-29 16:09:25 +01:00
- cd scripts
- '%PYTHON2% prepare_zipversion.py'
- cd ..
- move src\music_dl.zip music_dl_py2.zip
2018-12-29 16:13:19 +01:00
artifacts:
2018-12-29 16:09:25 +01:00
paths:
- music_dl_py2.zip