2021-04-11 23:51:35 +02:00
|
|
|
default:
|
|
|
|
# Cancel any pipeline when a newer instance is started (does not seem to work
|
|
|
|
# currently for the detached pipelines created from merge requests...)
|
|
|
|
interruptible: true
|
|
|
|
|
2021-04-11 22:40:44 +02:00
|
|
|
stages:
|
|
|
|
- validation
|
|
|
|
- release
|
|
|
|
|
|
|
|
# Create YAML anchors to avoid code duplicate (note: an anchor cannot call
|
|
|
|
# another anchor as it will result in an array of array)
|
|
|
|
.apt_get_update: &apt_get_update
|
|
|
|
- apt-get update > /dev/null
|
|
|
|
|
2021-09-02 00:17:39 +02:00
|
|
|
.python_prep: &python_prep
|
2021-04-11 23:51:35 +02:00
|
|
|
- apt-get install --yes python3-dev python3-pip > /dev/null
|
|
|
|
- python3 -m pip --quiet install -r misc/python_requirements.txt
|
|
|
|
|
2021-04-11 22:40:44 +02:00
|
|
|
.release_script_prep: &release_script_prep
|
|
|
|
- apt-get install --yes python3-dev python3-pip git > /dev/null
|
|
|
|
- git clone https://framagit.org/thombet/scripts-for-kodi-add-ons.git
|
|
|
|
- python3 -m pip --quiet install -r scripts-for-kodi-add-ons/create-new-add-on-release/requirements.txt
|
|
|
|
|
2021-04-11 23:51:35 +02:00
|
|
|
# Quality job: check no pylint violations are reported.
|
|
|
|
quality:
|
|
|
|
stage: validation
|
|
|
|
# Do not get any artifacts from previous jobs
|
|
|
|
dependencies: []
|
|
|
|
rules:
|
|
|
|
# Run this job only on merge requests and only as "manual" (it would have
|
|
|
|
# been better to configure this at pipeline-level with "workflow" but it
|
|
|
|
# does not support "when: manual"...).
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
|
|
when: manual
|
|
|
|
before_script:
|
|
|
|
- *apt_get_update
|
2021-09-02 00:17:39 +02:00
|
|
|
- *python_prep
|
2021-04-11 23:51:35 +02:00
|
|
|
script:
|
|
|
|
- find . -iname '*.py' | xargs -t python3 -m pylint --rcfile=misc/pylint-rcfile.txt | tee pylint.log
|
|
|
|
artifacts:
|
|
|
|
name: "quality-logs-$CI_JOB_ID"
|
|
|
|
expose_as: "Quality Logs"
|
|
|
|
paths:
|
|
|
|
- pylint.log
|
|
|
|
expire_in: 1 week
|
|
|
|
when: always
|
|
|
|
|
2021-04-27 22:52:59 +02:00
|
|
|
# Translation job: check that all the string.po files use the same strings as
|
|
|
|
# the reference file
|
|
|
|
translation:
|
|
|
|
stage: validation
|
|
|
|
# Do not get any artifacts from previous jobs
|
|
|
|
dependencies: []
|
|
|
|
rules:
|
|
|
|
# Run this job only on merge requests containing changes in strings.po
|
|
|
|
# files and only as "manual"
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
|
|
changes:
|
|
|
|
- resources/language/*/strings.po
|
|
|
|
when: manual
|
|
|
|
before_script:
|
|
|
|
- *apt_get_update
|
|
|
|
- apt-get install --yes gettext > /dev/null
|
|
|
|
# We cannot use a simple "find ... -exec msgcmp {} strings.po" because it
|
|
|
|
# would always return 0 as exit code
|
|
|
|
script:
|
2021-09-03 18:47:47 +02:00
|
|
|
- files=$(find . -name strings.po -not -path './resources/language/resource.language.en_gb/*') && for file in $files; do echo -e "\n\033[94mChecking translation file $file\033[0m"; msgcmp $file ./resources/language/resource.language.en_gb/strings.po || continue; done
|
2021-04-27 22:52:59 +02:00
|
|
|
|
2021-04-11 22:40:44 +02:00
|
|
|
# Pre-release job: will be available in all the merge requests with release
|
|
|
|
# branches in order to verify the release can be actually created. The
|
|
|
|
# verification is done by running the release script in dry run mode.
|
|
|
|
pre-release:
|
|
|
|
stage: validation
|
|
|
|
# Do not get any artifacts from previous jobs
|
|
|
|
dependencies: []
|
|
|
|
rules:
|
|
|
|
# Run this job only on merge requests for release branches
|
|
|
|
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^release\//'
|
|
|
|
when: manual
|
|
|
|
before_script:
|
|
|
|
- *apt_get_update
|
|
|
|
- *release_script_prep
|
|
|
|
script:
|
|
|
|
- python3 scripts-for-kodi-add-ons/create-new-add-on-release/create-new-add-on-release.py --dry-run
|
|
|
|
|
|
|
|
# Release job: will create a new GitLab release with the latest commit on the
|
|
|
|
# main branch.
|
|
|
|
create-release:
|
|
|
|
stage: release
|
|
|
|
# Do not get any artifacts from previous jobs
|
|
|
|
dependencies: []
|
|
|
|
# Run this job only for new commits on the branch "main" and only as "manual"
|
|
|
|
# because it is not mandatory to release all the commits on mainline.
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
|
|
when: manual
|
|
|
|
- when: never
|
|
|
|
before_script:
|
|
|
|
- *apt_get_update
|
|
|
|
- *release_script_prep
|
|
|
|
script:
|
|
|
|
- python3 scripts-for-kodi-add-ons/create-new-add-on-release/create-new-add-on-release.py
|