1name: CI
2on:
3- pull_request
4
5jobs:
6  sanity:
7    runs-on: ubuntu-latest
8    strategy:
9      matrix:
10        python_version: ["3.6"]
11        ansible_version: ["stable-2.10", "stable-2.11", "devel"]
12    steps:
13
14      - name: Check out code
15        uses: actions/checkout@v1
16        with:
17          path: ansible_collections/community/grafana
18
19      - name: Set up Python ${{ matrix.python_version }}
20        uses: actions/setup-python@v1
21        with:
22          python-version: ${{ matrix.python_version }}
23
24      - name: Install ansible
25        run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
26
27      - name: Run sanity tests
28        run: ansible-test sanity --docker -v --color
29
30  units:
31    runs-on: ubuntu-latest
32    strategy:
33      matrix:
34        python_version: ["3.6"]
35        ansible_version: ["stable-2.9", "stable-2.10", "devel"]
36    steps:
37      - name: Check out code
38        uses: actions/checkout@v1
39        with:
40          path: ansible_collections/community/grafana
41
42      - name: Set up Python ${{ matrix.python_version }}
43        uses: actions/setup-python@v1
44        with:
45          python-version: ${{ matrix.python_version }}
46
47      - name: Install ansible
48        run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
49
50      - name: Run unit tests
51        run: ansible-test units --docker -v --color --python ${{ matrix.python_version }} --coverage
52
53      - name: Generate coverage report.
54        run: ansible-test coverage xml -v --requirements --group-by command --group-by version
55
56      - uses: codecov/codecov-action@v1
57        with:
58          fail_ci_if_error: false
59
60  integration:
61    runs-on: ubuntu-latest
62    strategy:
63      matrix:
64        grafana_version: ["7.0.6",  "7.1.3", "8.1.2"]
65        ansible_version: ["stable-2.9", "stable-2.10", "devel"]
66        python_version: ["3.6"]
67    container:
68      image: python:${{ matrix.python_version }}-alpine
69    services:
70      grafana:
71        image: grafana/grafana:${{ matrix.grafana_version }}
72    steps:
73
74      - name: Install requirements on alpine
75        run: apk add bash git gcc python3-dev libc-dev libffi-dev openssl-dev rust cargo
76
77      - name: Check out code
78        uses: actions/checkout@v1
79        with:
80          path: ansible_collections/community/grafana
81
82      - name: Install deps
83        run: pip install coverage
84
85      - name: Install ansible
86        run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
87
88      - name: Run integration tests on Python ${{ matrix.python_version }}
89        run: ansible-test integration -v --color --retry-on-error --python ${{ matrix.python_version }} --continue-on-error --diff
90