-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (47 loc) · 1.59 KB
/
tests.yaml
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
# Reusable workflow that launches ansible-test tool (sanity checks, unit tests, etc).
name: Tests
on:
workflow_call:
env:
COLLECTION_PATH: ansible_collections/vidimensional/ansible_release_lookup
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.COLLECTION_PATH }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.COLLECTION_PATH }}
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
if [ -f requirements-dev.txt ]; then
pip install -r requirements-dev.txt
fi
- name: Run Ansible sanity checks
run: ansible-test sanity -v --venv --redact --python 3.10 --color yes
- name: Show Ansible sanity checks errors
if: ${{ failure() }}
run: |
# Output errors.
jq -C . tests/output/bot/*
echo $GITHUB_STEP_SUMMARY
# Save errors in summary
echo '# Failed sanity checks' >> ${GITHUB_STEP_SUMMARY}
echo '```json' >> ${GITHUB_STEP_SUMMARY}
cat tests/output/bot/* >> ${GITHUB_STEP_SUMMARY}
echo '```' >> ${GITHUB_STEP_SUMMARY}
- name: Ensure docs have correct format
run: ansible-doc -t lookup github_release -M "${PWD}/plugins/lookup/" --json
- name: Run unit tests
run: make unit