forked from espressif/idf-component-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
127 lines (115 loc) · 2.89 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
cache:
paths:
- .tox
key: "$CI_JOB_NAME-cache-2"
stages:
- check
- test
- deploy
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: "$CI_COMMIT_BRANCH"
lint:
image: python:3.9-slim-buster
stage: check
tags:
- lint
- internet
artifacts:
when: on_failure
paths:
- flake8_output.txt
- bandit_output.txt
expire_in: 1 week
before_script:
- pip install bandit flake8
script:
# disable B101: test for use of assert
- bandit --exclude="./tests,./integration_tests,./.tox,./.git" -r -f txt -s B101 -o bandit_output.txt .
- flake8 --config=.flake8 --output-file=flake8_output.txt --tee
.test_template:
stage: test
tags:
- test
- internet
before_script:
- pip install tox
artifacts:
reports:
cobertura: coverage.xml
test:py2.7:
extends: .test_template
image: python:2.7-slim-buster
script:
- tox -e py27
test:py3.5:
extends: .test_template
image: python:3.5-buster
script:
- tox -e py35
test:py3.9:
extends: .test_template
image: python:3.9-slim-buster
script:
- tox -e py39
.integration_test_template:
stage: test
tags:
- test
- internet
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$RUN_INTEGRATION_TESTS == "true"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- integration_tests/**/*
artifacts:
reports:
cobertura: coverage_integration.xml
before_script:
- apt-get update && apt-get install -y -q libusb-1.0 cmake git ninja-build
- git clone https://github.com/espressif/esp-idf.git
- cd ./esp-idf/
- git checkout ${IDF_BRANCH:-master}
- ./install.sh
- . ./export.sh
- git submodule update --init --recursive
- cd ..
- pip install $CI_PROJECT_DIR pytest pytest-cov jinja2
script:
- py.test -s -c pytest_integration.ini --cov=. --cov-report=xml:coverage_integration.xml --log-cli-level=INFO
integration_test:py2.7:
extends: .integration_test_template
image: python:2.7-slim-buster
parallel:
matrix:
- IDF_BRANCH: [release/v4.1, release/v4.2, release/v4.3]
integration_test:py3.5:
extends: .integration_test_template
image: python:3.5-slim-buster
parallel:
matrix:
- IDF_BRANCH: [release/v4.1, release/v4.2, release/v4.3]
integration_test:py3.6_idf_master:
extends: .integration_test_template
image: python:3.6-slim-buster
publish_on_pypi:
image: python:3.9-slim-buster
stage: deploy
tags:
- internet
variables:
TWINE_NON_INTERACTIVE: "true"
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${PYPI_TOKEN}
before_script:
- apt update && apt install curl jq -y
- pip install twine
script:
- ./publish.sh
rules:
- if: '$CI_COMMIT_BRANCH == "main"'