2021-01-05 15:12:36 -06:00
|
|
|
# This CI configuration file assumes we are going to use gitlab Shared runners at gitlab.com
|
2021-01-18 15:47:19 -06:00
|
|
|
# due to gitlab possibilities, we use a mix of Windows and docker containers (the python image) to build the project.
|
|
|
|
# the next variables are customized to the filepaths used when installing python and nsis with chocolatey on the windows runners.
|
2021-01-05 13:22:37 -06:00
|
|
|
variables:
|
2021-01-15 09:01:23 -06:00
|
|
|
PYTHON3_32: "C:\\python38\\python.exe"
|
2021-01-05 15:23:08 -06:00
|
|
|
NSIS: "C:\\program files (x86)\\nsis\\makensis.exe"
|
2021-01-05 13:22:37 -06:00
|
|
|
|
2021-01-18 15:47:19 -06:00
|
|
|
# The project defines 3 stages:
|
|
|
|
# 1. Generate_docs: generates the documentation and update translation files. This uses the python docker image.
|
|
|
|
# 2. Build: Creates the executable file by using a windows runner.
|
|
|
|
# 3. Upload: Puts everything in an ftp directory. I had to use a docker container here because the Windows runner has all ports blocked.
|
2021-01-18 15:13:08 -06:00
|
|
|
stages:
|
|
|
|
- generate_docs
|
|
|
|
- build
|
|
|
|
- upload
|
|
|
|
|
2021-01-05 15:12:36 -06:00
|
|
|
# This configures the environment for both channels
|
|
|
|
.configure_environment: &configure_environment
|
2019-01-02 10:06:19 -06:00
|
|
|
tags:
|
2021-01-05 15:18:27 -06:00
|
|
|
- shared-windows
|
|
|
|
- windows
|
|
|
|
- windows-1809
|
2021-01-05 15:12:36 -06:00
|
|
|
before_script:
|
2021-01-05 15:18:27 -06:00
|
|
|
- Set-Variable -Name "time" -Value (date -Format "%H:%m")
|
|
|
|
- echo ${time}
|
|
|
|
- echo "started by ${GITLAB_USER_NAME}"
|
2021-01-15 09:01:23 -06:00
|
|
|
- choco install python --version 3.8.7 -y -ForceX86
|
|
|
|
- choco install nsis -y -ForceX86
|
2021-01-05 15:18:27 -06:00
|
|
|
- '&$env:PYTHON3_32 -V'
|
|
|
|
- '&$env:PYTHON3_32 -m pip install --upgrade pip'
|
|
|
|
- '&$env:PYTHON3_32 -m pip install --upgrade -r requirements.txt'
|
|
|
|
- '&$env:PYTHON3_32 -m pip uninstall enum34 -y'
|
2019-12-10 09:56:40 -06:00
|
|
|
|
2021-01-05 15:12:36 -06:00
|
|
|
# Create documentation in all available languages so we'll have it at http://socializer.su/documentation
|
|
|
|
# this job is triggered on every commit to master, so we always will display the latest available version of the documentation in the website.
|
|
|
|
# We are not using the configure_environment job cause it adds all the dependencies, which are not needed for this to work.
|
|
|
|
documentation:
|
2021-01-18 15:13:08 -06:00
|
|
|
stage: generate_docs
|
2021-01-18 15:20:59 -06:00
|
|
|
image: python
|
2021-01-19 12:44:07 -06:00
|
|
|
interruptible: true
|
2021-01-05 15:12:36 -06:00
|
|
|
script:
|
2021-01-05 15:18:27 -06:00
|
|
|
- echo "started by ${GITLAB_USER_NAME}"
|
2021-01-18 15:20:59 -06:00
|
|
|
- python -V
|
2021-01-05 15:12:36 -06:00
|
|
|
### Dependencies.
|
2021-01-18 15:20:59 -06:00
|
|
|
- python -m pip install --upgrade markdown
|
2021-01-05 15:12:36 -06:00
|
|
|
# generate all html documents.
|
2021-01-18 15:20:59 -06:00
|
|
|
- cp changelog.md doc/changelog.md
|
2021-01-05 15:12:36 -06:00
|
|
|
- cd doc
|
2021-01-18 15:20:59 -06:00
|
|
|
- python documentation_importer.py
|
|
|
|
- cd ../src
|
|
|
|
- python ../doc/generator.py
|
|
|
|
- mv -f documentation ../
|
2021-01-05 15:12:36 -06:00
|
|
|
only:
|
|
|
|
- master
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- documentation
|
|
|
|
name: socializer_documentation
|
|
|
|
expire_in: 1 day
|
|
|
|
|
|
|
|
### Updates all translation templates for weblate
|
|
|
|
# this is also executed on every commit to master.
|
|
|
|
# commented out while we find a way to push to a git repository from a gitlab shared runner.
|
|
|
|
.update_translation_templates:
|
2021-01-18 15:13:08 -06:00
|
|
|
stage: generate_docs
|
2021-01-05 15:12:36 -06:00
|
|
|
tags:
|
|
|
|
- windows10
|
2021-01-19 12:44:07 -06:00
|
|
|
interruptible: true
|
2021-01-05 15:12:36 -06:00
|
|
|
script:
|
|
|
|
- '&$env:PYTHON3_32 -m pip install --upgrade babel'
|
|
|
|
- copy changelog.md doc\changelog.md
|
|
|
|
- cd doc
|
|
|
|
- '&$env:PYTHON3_32 documentation_importer.py'
|
|
|
|
- cd ..\src
|
|
|
|
- '&$env:PYTHON3_32 setup.py extract_messages -F babel.cfg --input-dirs . --output-file ..\scripts\socializer.pot'
|
|
|
|
- '&$env:PYTHON3_32 setup.py update_catalog --no-fuzzy-matching --domain socializer --output-dir locales --input-file ..\scripts\socializer.pot'
|
|
|
|
- cd ..\doc
|
|
|
|
- '&$env:PYTHON3_32 translate.py'
|
|
|
|
- cd ..
|
|
|
|
# After generation, it's time to push all translation updates.
|
|
|
|
- 'git config user.name "Windows runner"'
|
|
|
|
- 'git config user.email "manuel@manuelcortez.net"'
|
|
|
|
- 'git add scripts'
|
|
|
|
- 'git add src\locales'
|
|
|
|
- 'git remote set-url --push origin git@code.manuelcortez.net:$env:CI_PROJECT_PATH'
|
|
|
|
- 'git commit -m "Updated locales [skip ci]"'
|
|
|
|
- 'git push origin HEAD:$env:CI_COMMIT_REF_NAME'
|
|
|
|
only:
|
|
|
|
- master
|
2019-05-07 10:29:15 -05:00
|
|
|
|
2021-01-05 15:12:36 -06:00
|
|
|
alpha32:
|
|
|
|
<<: *configure_environment
|
2021-01-18 15:13:08 -06:00
|
|
|
stage: build
|
2021-01-19 12:44:07 -06:00
|
|
|
interruptible: true
|
2021-01-05 15:12:36 -06:00
|
|
|
script:
|
|
|
|
# Create html documentation firstly.
|
|
|
|
- copy changelog.md doc\changelog.md
|
|
|
|
- cd doc
|
|
|
|
- '&$env:PYTHON3_32 documentation_importer.py'
|
|
|
|
- cd ..\src
|
|
|
|
- '&$env:PYTHON3_32 ..\doc\generator.py'
|
|
|
|
# Writes version info useful for alphas.
|
|
|
|
- '&$env:PYTHON3_32 write_version_data.py'
|
|
|
|
# build it all.
|
|
|
|
- '&$env:PYTHON3_32 setup.py build'
|
|
|
|
# Once built, makes the installer for for alpha.
|
|
|
|
- '&$env:NSIS installer_alpha.nsi'
|
|
|
|
- cd ..
|
2021-01-18 15:13:08 -06:00
|
|
|
- mkdir artifacts
|
|
|
|
- move src\socializer* artifacts\
|
2021-01-05 15:12:36 -06:00
|
|
|
- cd scripts
|
|
|
|
# Zips the folder in order to create the portable socializer version.
|
|
|
|
- '&$env:PYTHON3_32 prepare_zipversion.py'
|
|
|
|
- cd ..
|
2021-01-18 15:13:08 -06:00
|
|
|
- move src\socializer.zip artifacts\socializer_x86_alpha.zip
|
2021-01-05 15:12:36 -06:00
|
|
|
- '&$env:PYTHON3_32 scripts/generate_update_file.py'
|
2021-01-18 15:13:08 -06:00
|
|
|
- move *.json artifacts
|
2021-01-05 15:12:36 -06:00
|
|
|
only:
|
|
|
|
- master
|
2021-01-18 15:13:08 -06:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- artifacts
|
|
|
|
expire_in: 1 day
|
|
|
|
|
2021-01-05 15:12:36 -06:00
|
|
|
# Generates a new stable version of the application every tag.
|
|
|
|
stable:
|
|
|
|
<<: *configure_environment
|
2021-01-18 15:13:08 -06:00
|
|
|
stage: build
|
2021-01-19 12:44:07 -06:00
|
|
|
interruptible: true
|
2018-12-16 07:23:45 -06:00
|
|
|
script:
|
2021-01-05 15:12:36 -06:00
|
|
|
- copy changelog.md doc\changelog.md
|
|
|
|
- cd doc
|
|
|
|
- '&$env:PYTHON3_32 documentation_importer.py'
|
|
|
|
- cd ..\src
|
|
|
|
- '&$env:PYTHON3_32 ..\doc\generator.py'
|
|
|
|
- '&$env:PYTHON3_32 write_version_data.py'
|
|
|
|
- '&$env:PYTHON3_32 setup.py build'
|
|
|
|
- '&$env:NSIS installer.nsi'
|
|
|
|
- cd ..
|
2021-01-18 15:47:19 -06:00
|
|
|
- mkdir artifacts
|
|
|
|
- move src\socializer* artifacts\
|
2021-01-05 15:12:36 -06:00
|
|
|
- cd scripts
|
|
|
|
- '&$env:PYTHON3_32 prepare_zipversion.py'
|
|
|
|
- cd ..
|
2021-01-18 15:47:19 -06:00
|
|
|
- move src\socializer.zip artifacts\socializer_x86.zip
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- artifacts
|
|
|
|
expire_in: 1 day
|
2021-01-05 15:12:36 -06:00
|
|
|
only:
|
2021-01-18 15:13:08 -06:00
|
|
|
- tags
|
|
|
|
|
|
|
|
upload:
|
|
|
|
stage: upload
|
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
image: python
|
2021-01-19 12:44:07 -06:00
|
|
|
interruptible: true
|
2021-01-18 15:13:08 -06:00
|
|
|
script:
|
|
|
|
- cd artifacts
|
|
|
|
- python ../scripts/upload.py
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
- tags
|
|
|
|
- schedules
|