Commit 833ec988 authored by Nsukami Patrick's avatar Nsukami Patrick
Browse files

ci: Update CI config to use predefined templates

- Use gitlab ci templates include
- Fix various F811 errors, redefinition of unused ...
- Remove now useless triggered jobs: `trigger-cubicweb-pipeline` & `trigger-readthedocs`
parent c5fb30b4a17b
Pipeline #73711 passed with stages
in 1 minute and 23 seconds
---
image: python
# avoid running duplicate pipelines for both topic head and MR
# see: https://docs.gitlab.com/ee/ci/yaml/#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_REF_NAME =~ /^topic\/.*/ && $CI_OPEN_MERGE_REQUESTS'
when: never
- when: always
default:
image: python:3.7
include:
- project: "open-source/gitlab-ci-templates"
ref: "branch/default"
file:
- "templates/no-duplicated-ci-pipelines.yml" # use workflow to avoid duplicated pipelines
- "templates/lint/flake8.yml" # will do the equivalent of 'tox -e flake8'
- "templates/lint/black.yml" # will do the equivalent of 'tox -e black'
- "templates/lint/check-manifest.yml" # will do the equivalent of 'tox -e check-manifest'
- "templates/lint/yamllint.yml" # will do the equivalent of 'tox -e yamllint'
- "templates/tests/py3.yml" # will do the equivalent of 'tox -e py3'
- "templates/lint/mypy.yml" # will do the equivalent of 'tox -e mypy'
stages:
- lint
- tests
- after-tests
before_script:
- pip install tox
py3:
except:
variables:
- $TRIGGERED_FROM_OTHER_PROJECT
stage: tests
script: tox -e py3
artifacts:
paths:
- py3-deprecated-warnings.json
py3-from-forge:
stage: tests
script: tox -e py3-from-forge
artifacts:
paths:
- py3-deprecated-warnings.json
flake8:
except:
variables:
- $TRIGGERED_FROM_OTHER_PROJECT
stage: tests
script: tox -e flake8
black:
stage: tests
rules:
- changes:
- "**/*.py"
script: tox -e black
mypy:
except:
variables:
- $TRIGGERED_FROM_OTHER_PROJECT
stage: tests
script: tox -e mypy
check-manifest:
except:
variables:
- $TRIGGERED_FROM_OTHER_PROJECT
stage: tests
script: tox -e check-manifest
trigger-cubicweb-pipeline:
stage: after-tests
except:
variables:
- $TRIGGERED_FROM_OTHER_PROJECT && $TRIGGERED_FROM_OTHER_PROJECT != "rql"
variables:
TRIGGERED_FROM_OTHER_PROJECT: "rql"
trigger:
project: cubicweb/cubicweb
branch: branch/default
strategy: depend
trigger-readthedocs:
only:
refs:
- branch/default
except:
variables:
- $TRIGGERED_FROM_OTHER_PROJECT
stage: after-tests
script:
# regarding the " everywhere when there is a '%': yaml is extremly weird when % are involved
- curl -X POST -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/rql/109441/ -w "\nhttp code:"\ "%{http_code}\n" -f
yamllint:
stage: lint
rules:
- changes:
- "**/*.yaml"
- "*.yaml"
- "**/*.yml"
- "*.yml"
script:
- tox -e yamllint
......@@ -130,8 +130,8 @@ RQL_FUNCTIONS_REGISTRY: "logilab.database._FunctionRegistry" = (
)
@monkeypatch(FunctionDescr) # type: ignore[no-redef]
def st_description( # noqa
@monkeypatch(FunctionDescr) # type: ignore[no-redef] # noqa
def st_description(
self,
funcnode: "rql.nodes.Function",
mainindex: Optional[int],
......@@ -157,13 +157,13 @@ def st_check_backend(self, backend: Any, funcnode: "rql.nodes.Function") -> None
)
@monkeypatch(FunctionDescr) # type: ignore[no-redef]
def rql_return_type(self, funcnode: "rql.nodes.Function") -> Optional[str]: # noqa
@monkeypatch(FunctionDescr) # type: ignore[no-redef] # noqa
def rql_return_type(self, funcnode: "rql.nodes.Function") -> Optional[str]:
return self.rtype
@monkeypatch(CAST) # type: ignore[no-redef]
def st_description( # noqa
@monkeypatch(CAST) # type: ignore[no-redef] # noqa
def st_description(
self,
funcnode: "rql.nodes.Function",
mainindex: Optional[int],
......@@ -172,8 +172,8 @@ def st_description( # noqa
return self.rql_return_type(funcnode)
@monkeypatch(CAST) # type: ignore[no-redef]
def rql_return_type(self, funcnode: "rql.nodes.Function") -> str: # noqa
@monkeypatch(CAST) # type: ignore[no-redef] # noqa
def rql_return_type(self, funcnode: "rql.nodes.Function") -> str:
# mypy: "BaseNode" has no attribute "value" [attr-defined]
# this is black magic to set rql_return_type to logilab.database classes
# this code assume that CAST only works with nodes that has a value
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment