mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-06-30 05:14:37 +02:00
Use ansible-community/ansible-test-gh-action for CI (#103)
* Use ansible-community/ansible-test-gh-action for CI Based upon https://github.com/ansible-collections/collection_template/pull/29. * Avoid trailing ';'. * Fix relative paths for collection installs. * Try multi-line command. * Prevent trailing newline.
This commit is contained in:
parent
af6524a1fd
commit
98bb520ce7
1 changed files with 33 additions and 120 deletions
147
.github/workflows/ansible-test.yml
vendored
147
.github/workflows/ansible-test.yml
vendored
|
@ -3,6 +3,9 @@
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
# For the comprehensive list of the inputs supported by the ansible-community/ansible-test-gh-action GitHub Action, see
|
||||||
|
# https://github.com/marketplace/actions/ansible-test
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
on:
|
on:
|
||||||
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
|
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
|
||||||
|
@ -16,12 +19,6 @@ on:
|
||||||
- cron: '15 5 * * *'
|
- cron: '15 5 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
###
|
|
||||||
# Sanity tests (REQUIRED)
|
|
||||||
#
|
|
||||||
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
|
|
||||||
|
|
||||||
sanity:
|
sanity:
|
||||||
name: Sanity (Ⓐ${{ matrix.ansible }})
|
name: Sanity (Ⓐ${{ matrix.ansible }})
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -37,52 +34,15 @@ jobs:
|
||||||
- devel
|
- devel
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Perform sanity testing
|
||||||
# ansible-test requires the collection to be in a directory in the form
|
uses: ansible-community/ansible-test-gh-action@release/v1
|
||||||
# .../ansible_collections/community/routeros/
|
|
||||||
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
with:
|
||||||
path: ansible_collections/community/routeros
|
ansible-core-version: ${{ matrix.ansible }}
|
||||||
|
testing-type: sanity
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
# it is just required to run that once as "ansible-test sanity" in the docker image
|
|
||||||
# will run on all python versions it supports.
|
|
||||||
python-version: '3.10'
|
|
||||||
|
|
||||||
# Install the head of the given branch (devel, stable-2.10)
|
|
||||||
- name: Install ansible-base (${{ matrix.ansible }})
|
|
||||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
|
||||||
|
|
||||||
- name: Install collection dependencies
|
|
||||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
|
||||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
pre-test-cmd: |-
|
||||||
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
||||||
# run ansible-test sanity inside of Docker.
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
||||||
# The docker container has all the pinned dependencies that are required
|
|
||||||
# and all python versions ansible supports.
|
|
||||||
- name: Run sanity tests
|
|
||||||
run: ansible-test sanity --docker -v --color --coverage
|
|
||||||
working-directory: ./ansible_collections/community/routeros
|
|
||||||
|
|
||||||
# ansible-test support producing code coverage date
|
|
||||||
- name: Generate coverage report
|
|
||||||
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
|
|
||||||
working-directory: ./ansible_collections/community/routeros
|
|
||||||
|
|
||||||
# See the reports at https://codecov.io/gh/ansible_collections/ansible-collections/community.routeros
|
|
||||||
- uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
||||||
###
|
|
||||||
# Unit tests (OPTIONAL)
|
|
||||||
#
|
|
||||||
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
|
|
||||||
|
|
||||||
units:
|
units:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -100,43 +60,17 @@ jobs:
|
||||||
- devel
|
- devel
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: >-
|
||||||
uses: actions/checkout@v3
|
Perform unit testing against
|
||||||
|
Ansible version ${{ matrix.ansible }}
|
||||||
|
uses: ansible-community/ansible-test-gh-action@release/v1
|
||||||
with:
|
with:
|
||||||
path: ansible_collections/community/routeros
|
ansible-core-version: ${{ matrix.ansible }}
|
||||||
|
testing-type: units
|
||||||
- name: Set up Python ${{ matrix.ansible }}
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
|
|
||||||
- name: Install ansible-base (${{ matrix.ansible }})
|
|
||||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
|
||||||
|
|
||||||
- name: Install collection dependencies
|
|
||||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
|
||||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
pre-test-cmd: |-
|
||||||
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
||||||
# Run the unit tests
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
||||||
- name: Run unit tests for all Python versions
|
|
||||||
run: ansible-test units -v --color --docker --coverage
|
|
||||||
working-directory: ./ansible_collections/community/routeros
|
|
||||||
|
|
||||||
# ansible-test support producing code coverage date
|
|
||||||
- name: Generate coverage report
|
|
||||||
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
|
|
||||||
working-directory: ./ansible_collections/community/routeros
|
|
||||||
|
|
||||||
# See the reports at https://codecov.io/gh/ansible_collections/ansible-collections/community.routeros
|
|
||||||
- uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
||||||
###
|
|
||||||
# Integration tests (RECOMMENDED)
|
|
||||||
#
|
|
||||||
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html
|
|
||||||
|
|
||||||
integration:
|
integration:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -176,37 +110,16 @@ jobs:
|
||||||
python: "3.10"
|
python: "3.10"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: >-
|
||||||
uses: actions/checkout@v3
|
Perform integration testing against
|
||||||
|
Ansible version ${{ matrix.ansible }}
|
||||||
|
under Python ${{ matrix.python }}
|
||||||
|
uses: ansible-community/ansible-test-gh-action@release/v1
|
||||||
with:
|
with:
|
||||||
path: ansible_collections/community/routeros
|
ansible-core-version: ${{ matrix.ansible }}
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
# it is just required to run that once as "ansible-test integration" in the docker image
|
|
||||||
# will run on all python versions it supports.
|
|
||||||
python-version: '3.10'
|
|
||||||
|
|
||||||
- name: Install ansible-core (${{ matrix.ansible }})
|
|
||||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
|
||||||
|
|
||||||
- name: Install collection dependencies
|
|
||||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
|
||||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
pre-test-cmd: |-
|
||||||
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ../../ansible/netcommon
|
||||||
# Run the integration tests
|
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.utils.git ../../ansible/utils
|
||||||
- name: Run integration test
|
target-python-version: ${{ matrix.python }}
|
||||||
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
|
testing-type: integration
|
||||||
working-directory: ./ansible_collections/community/routeros
|
|
||||||
|
|
||||||
# ansible-test support producing code coverage date
|
|
||||||
- name: Generate coverage report
|
|
||||||
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
|
|
||||||
working-directory: ./ansible_collections/community/routeros
|
|
||||||
|
|
||||||
# See the reports at https://codecov.io/gh/ansible-collections/community.routeros
|
|
||||||
- uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
fail_ci_if_error: false
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue