Skip to content

Commit 1849594

Browse files
committed
ci: add linting and pytest
1 parent 73f7fd7 commit 1849594

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.gitlab-ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
stages:
2+
- lint
3+
- test
4+
- doc
5+
6+
before_script:
7+
- python3 -m venv .venv
8+
- source .venv/bin/activate
9+
- pip install .[dev]
10+
11+
lint:
12+
stage: lint
13+
dependencies: []
14+
script:
15+
- pip install pylint-gitlab
16+
# call ruff twice as there is no option to print output and generate report
17+
- ruff check || true
18+
- ruff --output-format=gitlab --output-file=codequality-ruff.json || true
19+
- |
20+
pylint \
21+
--exit-zero --load-plugins=pylint_gitlab \
22+
--output-format=gitlab-codeclimate:codequality-pylint.json,text labgrid
23+
artifacts:
24+
reports:
25+
codequality: codequality-*.json
26+
27+
test:
28+
stage: test
29+
dependencies: []
30+
allow_failure: true
31+
script:
32+
# set localhost known_hosts to current localhost
33+
- ssh-keygen -f "$HOME/.ssh/known_hosts" -R "localhost" || true
34+
- ssh -o StrictHostKeyChecking=no localhost true
35+
- |
36+
pytest \
37+
--cov-config .coveragerc --cov=labgrid \
38+
--junit-xml=junit.xml \
39+
--local-sshmanager --ssh-username $(whoami) \
40+
-k "not test_docker_with_daemon"
41+
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
42+
artifacts:
43+
reports:
44+
junit: junit.xml
45+
46+
pages:
47+
stage: doc
48+
dependencies: []
49+
script:
50+
- sphinx-build -b html doc public
51+
artifacts:
52+
paths:
53+
- public

0 commit comments

Comments
 (0)