music-dl/.gitlab-ci.yml

107 lines
3.0 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 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 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-30 01:14:41 -06:00
- '%PYTHON3% -m coverage report --omit="test*"'
2018-12-29 23:52:24 -06:00
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
2018-12-29 20:18:37 -06:00
only:
- master
- tags
- schedule_pipelines
# 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:
stage: build
2018-12-28 20:07:56 -06:00
tags:
2018-12-29 09:09:25 -06:00
- windows10
# 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'
# 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.
# 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
expire_in: 30 mins
2018-12-29 13:38:25 -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
# 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
# This job takes the src\\dist generated in build_py3 and creates a setup installer file.
build_setup:
2018-12-29 13:38:25 -06:00
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 src
- '%NSIS% installer.nsi'
- cd ..
2018-12-29 13:56:47 -06:00
- move src\music_dl* .
artifacts:
paths:
- "music_dl_*"
name: music_dl