|
| 1 | + |
| 2 | +name: Tests |
| 3 | + |
| 4 | +# Controls when the action will run. |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +jobs: |
| 12 | + lint: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + ansible: |
| 18 | + - "2.9" |
| 19 | + - "2.10" |
| 20 | + - "2.12" |
| 21 | + steps: |
| 22 | + # Checks-out the repository under $GITHUB_WORKSPACE, so it's accessible to the job |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + if [[ "${{ matrix.ansible }}" = "2.9" ]]; then |
| 29 | + ansible_package=ansible |
| 30 | + elif [[ "${{ matrix.ansible }}" = "2.10" ]]; then |
| 31 | + ansible_package=ansible-base |
| 32 | + else |
| 33 | + ansible_package=ansible-core |
| 34 | + fi |
| 35 | + pip install $ansible_package==${{ matrix.ansible }}.* 'ansible-lint<5' |
| 36 | +
|
| 37 | + - name: Linting code |
| 38 | + run: | |
| 39 | + ansible-lint -v --force-color |
| 40 | +
|
| 41 | + integration: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + ansible: |
| 47 | + - "2.9" |
| 48 | + - "2.10" |
| 49 | + - "2.12" |
| 50 | + steps: |
| 51 | + # Checks-out the repository under $GITHUB_WORKSPACE, so it's accessible to the job |
| 52 | + - uses: actions/checkout@v2 |
| 53 | + |
| 54 | + - uses: actions/setup-python@v2 |
| 55 | + |
| 56 | + - name: Install dependencies |
| 57 | + run: | |
| 58 | + python3 -m pip install --upgrade pip |
| 59 | + if [[ "${{ matrix.ansible }}" = "2.9" ]]; then |
| 60 | + ansible_package=ansible |
| 61 | + elif [[ "${{ matrix.ansible }}" = "2.10" ]]; then |
| 62 | + ansible_package=ansible-base |
| 63 | + else |
| 64 | + ansible_package=ansible-core |
| 65 | + fi |
| 66 | + python3 -m pip install $ansible_package==${{ matrix.ansible }}.* docker |
| 67 | + ansible-galaxy collection build |
| 68 | + ansible-galaxy collection install *.tar.gz |
| 69 | +
|
| 70 | + # TODO: Use ansible-test to run these. |
| 71 | + - name: Running integration tests |
| 72 | + run: | |
| 73 | + ansible-playbook -i tests/inventory -v tests/*.yml -e ansible_python_interpreter=$(which python3) |
0 commit comments