The linting check can be done on any docker image with the latest python version. This updates de pre-commit checks and fix file linting to conform to new standards.
78 lines
2.1 KiB
YAML
78 lines
2.1 KiB
YAML
stages:
|
|
- lint
|
|
- test
|
|
- build
|
|
- release
|
|
|
|
pre-commit:
|
|
image: python
|
|
stage: lint
|
|
only:
|
|
- merge_requests
|
|
before_script:
|
|
- pip install pre-commit
|
|
script:
|
|
- pre-commit run --all --show-diff-on-failure --verbose --color always
|
|
|
|
pytest:
|
|
stage: test
|
|
tags:
|
|
- shell
|
|
only:
|
|
- merge_requests
|
|
- "main"
|
|
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+)\%/'
|
|
script:
|
|
- python3 -m venv ./.gitlab-ci-venv
|
|
- source ./.gitlab-ci-venv/bin/activate
|
|
# - pip install --upgrade pip
|
|
- pip install poetry
|
|
- poetry --version
|
|
- poetry install -v
|
|
- echo $PATH
|
|
- echo $PYTHONPATH
|
|
- poetry run pytest --version
|
|
- poetry run pytest --verbosity=2 --exitfirst --cov odoo_openupgrade_wizard
|
|
|
|
build:
|
|
stage: build
|
|
image: python:latest
|
|
rules:
|
|
# Do not run this job when a tag is created manually
|
|
- if: $CI_COMMIT_TAG
|
|
when: never
|
|
# Run this job when commits are pushed or merged to the default branch
|
|
# and the commit message contains "Bump to version"
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE =~ /^Bump to version.+/
|
|
script:
|
|
- pip install poetry
|
|
- poetry --version
|
|
- poetry build
|
|
- poetry publish --username $PYPI_USER --password $PYPI_TOKEN
|
|
- echo "VERSION=$(poetry version --short)" >> variables.env
|
|
artifacts:
|
|
reports:
|
|
# Use artifacts:reports:dotenv to expose the variables to other jobs
|
|
dotenv: variables.env
|
|
|
|
release:
|
|
stage: release
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
needs:
|
|
- job: build
|
|
artifacts: true
|
|
rules:
|
|
# Do not run this job when a tag is created manually
|
|
- if: $CI_COMMIT_TAG
|
|
when: never
|
|
# Run this job when commits are pushed or merged to the default branch
|
|
# and the commit message contains "Bump to version"
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE =~ /^Bump to version.+/
|
|
script:
|
|
- echo "running release_job for $VERSION"
|
|
release:
|
|
name: "$VERSION"
|
|
description: "$CI_COMMIT_DESCRIPTION"
|
|
tag_name: "$VERSION"
|
|
ref: "$CI_COMMIT_SHA"
|