mirror of https://github.com/ceph/ceph-ansible.git
tests: use github workflow for pytest
Move the pytest testing from TravisCI to Github workflow.
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 3e79f0322a
)
pull/6052/head
parent
04484f5c52
commit
fcf260b65b
|
@ -0,0 +1,24 @@
|
||||||
|
name: pytest
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'library/**.py'
|
||||||
|
- 'plugins/filter/**.py'
|
||||||
|
- 'tests/library/**.py'
|
||||||
|
- 'tests/plugins/filter/**.py'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.6, 3.7, 3.8]
|
||||||
|
name: Python ${{ matrix.python-version }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
architecture: x64
|
||||||
|
- run: pip install -r tests/requirements.txt
|
||||||
|
- run: pytest --cov=library/ --cov=plugins/filter/ -vvvv tests/library/ tests/plugins/filter/
|
|
@ -5,9 +5,8 @@ python:
|
||||||
notifications:
|
notifications:
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt
|
- pip install -r tests/requirements.txt
|
||||||
- pip install ansible-lint==4.2.0 pytest
|
- pip install ansible-lint==4.2.0
|
||||||
script:
|
script:
|
||||||
- if [[ -n $(grep --exclude-dir=.git -P "\xa0" -r .) ]]; then echo 'NBSP characters found'; exit 1; fi
|
- if [[ -n $(grep --exclude-dir=.git -P "\xa0" -r .) ]]; then echo 'NBSP characters found'; exit 1; fi
|
||||||
- pytest -vvvv tests/library/ tests/plugins/filter/
|
|
||||||
- for i in $(ls -1 roles/); do ANSIBLE_LOG_PATH=/dev/null ansible-lint -x 204 -v roles/$i/; if [ $? -ne 0 ]; then exit 1; fi; done
|
- for i in $(ls -1 roles/); do ANSIBLE_LOG_PATH=/dev/null ansible-lint -x 204 -v roles/$i/; if [ $? -ne 0 ]; then exit 1; fi; done
|
||||||
|
|
|
@ -9,3 +9,4 @@ netaddr
|
||||||
mock
|
mock
|
||||||
jmespath
|
jmespath
|
||||||
pytest-rerunfailures<9.0
|
pytest-rerunfailures<9.0
|
||||||
|
pytest-cov
|
||||||
|
|
Loading…
Reference in New Issue