1- include : https://gitlab/Sensirion/Python/ci-config-python/raw/master/gitlab-ci-template-v2.yml
1+ include :
2+ - project : Sensirion/Python/ci-config-python
3+ ref : master
4+ file : gitlab-ci-template-v2.yml
5+
26stages :
37 - prepare
48 - build
59 - deploy
610
11+ variables :
12+ YQ_URL : https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64
13+
714check_rst_syntax :
815 stage : prepare
916 extends : .check_rst_syntax_v2
@@ -12,29 +19,28 @@ check_editorconfig:
1219 stage : prepare
1320 extends : .check_editorconfig_v2
1421
15-
1622py3p6_linux_build :
1723 stage : build
1824 extends : .py3p6_linux_build_v2
19- variables :
20- PYTEST_ADDOPTS : ' -m "not needs_device"'
25+
26+ py3p8_linux_sdist :
27+ stage : build
28+ extends : .py3p8_linux_sdist_v2
2129
2230py3p8_linux_build :
2331 stage : build
2432 extends : .py3p8_linux_build_v2
25- variables :
26- PYTEST_ADDOPTS : ' -m "not needs_device"'
27-
2833
2934py3p8_64bit_win_build :
3035 stage : build
3136 extends : .py3p8_64bit_win_docker_build_v2
32- variables :
33- PYTEST_ADDOPTS : ' -m "not needs_device"'
3437
3538build_docs :
3639 stage : build
37- extends : .build_docs_v2
40+ tags : [ linux, docker ]
41+ image : registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.8-20.04-2.11.0
42+ variables :
43+ SPHINXOPTS : " -W --keep-going"
3844 script :
3945 - python setup.py install
4046 - pip install -r docs/requirements.txt
@@ -43,7 +49,7 @@ build_docs:
4349 after_script :
4450 - mv docs/_build/html/ public/ # everything in public/ will get published
4551 artifacts :
46- paths : [public]
52+ paths : [ public ]
4753 expire_in : 1 week
4854 when : always
4955
@@ -54,7 +60,7 @@ deploy_stable:
5460 extends : .deploy_stable_v2
5561 environment :
5662 name : pypi.org
57- url : https://pypi.org/project/sensirion_shdlc_svm41 /
63+ url : https://pypi.org/project/sensirion_uart_svm4x /
5864 before_script :
5965 - pip install twine~=1.12.1
6066 script :
@@ -65,16 +71,11 @@ deploy_stable:
6571
6672deploy_docs :
6773 stage : deploy
68- tags : [linux, docker]
69- image : registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.8-20.04-2.6 .0
70- dependencies : []
71- only : [master, tags]
74+ tags : [ linux, docker ]
75+ image : registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.8-20.04-2.11 .0
76+ dependencies : [ build_docs ]
77+ only : [ master, tags ]
7278 script :
73- - python setup.py install
74- - pip install -r docs/requirements.txt
75- - cd docs
76- - make html
77- after_script :
7879 - chmod 777 ./ci/set_git_config.sh
7980 - ./ci/set_git_config.sh
8081 - chmod 777 ./ci/checkin_doc.sh
@@ -83,7 +84,52 @@ deploy_docs:
8384TODO_check :
8485 stage : prepare
8586 image :
86- name : registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
87+ name : registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
88+ tags : [ linux, docker ]
89+ script :
90+ - ' ! grep -rnw --exclude=.gitlab-ci.yml --exclude-dir=.git . -e "TODO"'
91+
92+ metadata_check :
93+ stage : prepare
94+ image :
95+ name : registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.2.0
8796 tags : [linux, docker]
97+ before_script :
98+ - apt-get -qq update && apt-get -qq install -y wget
99+ - if ! [ -d downloads/ ]; then mkdir downloads; fi
100+ - if ! [ -e downloads/yq ]; then wget --no-verbose $YQ_URL -O downloads/yq; fi
101+ - cp downloads/yq /usr/local/bin/yq && chmod +x /usr/local/bin/yq
88102 script :
89- - ' ! grep -rnw --exclude=.gitlab-ci.yml --exclude-dir=.git . -e "TODO"'
103+ # check if metadata.yml exists
104+ - >
105+ if ! [ -f "metadata.yml" ]; then
106+ echo "metadata.yml file not found"
107+ exit 1
108+ fi
109+ # check that dg_status is 'released'
110+ - export DG_STATUS=$(yq ".dg_status.[]" ./metadata.yml)
111+ - >
112+ if [ $DG_STATUS != "released" ]; then
113+ echo "dg_status in metadata.yml has to be 'released', not '$DG_STATUS'"
114+ exit 1
115+ fi
116+ # check that last_generated is not older than timestamp of last non-merge commit (+ 3 minutes)
117+ - export IS_MANUALLY_MODIFIED=$(yq ".is_manually_modified" ./metadata.yml)
118+ - >
119+ if [ $IS_MANUALLY_MODIFIED = false ]; then
120+ export LAST_GENERATED_TS=$(yq ".last_generated" ./metadata.yml)
121+ export LAST_GENERATED_TS_EPOCH=$(date -d "$LAST_GENERATED_TS" +%s)
122+ export LAST_NON_MERGE_COMMIT_TS=$(git log --format=%ad --date=iso-strict --no-merges -1)
123+ export COMMIT_TS_EPOCH=$(date -d "$LAST_NON_MERGE_COMMIT_TS" +%s)
124+ if [ $(($LAST_GENERATED_TS_EPOCH + 180)) -lt $COMMIT_TS_EPOCH ]; then
125+ echo "'last_generated' timestamp in metadata.yml is older than commit timestamp ($LAST_GENERATED_TS vs $LAST_NON_MERGE_COMMIT_TS)"
126+ exit 1
127+ fi
128+ fi
129+ # check that 'is_manually_modified' is set to true if commit is not from driver generator
130+ - export LAST_NON_MERGE_COMMIT_AUTHOR=$(git log --format=%an --no-merges -1)
131+ - >
132+ if ! [ "$LAST_NON_MERGE_COMMIT_AUTHOR" = "Driver Generator 2" ] && [ "$IS_MANUALLY_MODIFIED" = false ]; then
133+ echo "Last commit is not from Driver Generator. Please update 'is_manually_modified' in metadata.yml"
134+ exit 1
135+ fi
0 commit comments