| 1 |
# README FIRST |
| 2 |
# 1. Subscribe to https://github.com/ansible-collections/news-for-maintainers |
| 3 |
# (click the Watch button on the homepage > Custom > Issues) |
| 4 |
# and keep this matrix up to date in accordance to related announcements. |
| 5 |
# Timely add new ansible-core versions and consider dropping support |
| 6 |
# and testing against its EOL versions. |
| 7 |
# 2. If your collection repository is under the ansible-collections org, |
| 8 |
# please keep in mind that the number of GHA jobs is limited |
| 9 |
# and shared across all the collections in the org. |
| 10 |
# So, focusing on good test coverage of your collection, |
| 11 |
# please avoid testing against unnecessary entities such as |
| 12 |
# ansible-core EOL versions your collection does not support |
| 13 |
# or ansible-core versions that are not EOL yet but not supported by the collection. |
| 14 |
# 3. If you don't have unit or integration tests, remove corresponding sections. |
| 15 |
# 4. If your collection depends on other collections ensure they are installed, |
| 16 |
# add them to the "test-deps" input. |
| 17 |
# 5. For the comprehensive list of the inputs supported by the |
| 18 |
# ansible-community/ansible-test-gh-action GitHub Action, see |
| 19 |
# https://github.com/marketplace/actions/ansible-test. |
| 20 |
# 6. If you want to prevent merging PRs that do not pass all tests, |
| 21 |
# make sure to add the "check" job to your repository branch |
| 22 |
# protection once this workflow is added. |
| 23 |
# It is also possible to tweak which jobs are allowed to fail. See |
| 24 |
# https://github.com/marketplace/actions/alls-green#gotchas for more detail. |
| 25 |
# 7. If you need help please ask in #community:ansible.com on Matrix |
| 26 |
# or in bridged #ansible-community on the Libera.Chat IRC channel. |
| 27 |
# See https://docs.ansible.com/ansible/devel/community/communication.html |
| 28 |
# for details. |
| 29 |
# 8. If your collection is [going to get] included in the Ansible package, |
| 30 |
# it has to adhere to Python compatibility and CI testing requirements described in |
| 31 |
# https://docs.ansible.com/ansible/latest/community/collection_contributors/collection_requirements.html. |
| 32 |
|
| 33 |
--- |
| 34 |
name: Sanity tests |
| 35 |
on: |
| 36 |
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests |
| 37 |
push: |
| 38 |
branches: |
| 39 |
- main |
| 40 |
- stable-* |
| 41 |
pull_request: |
| 42 |
# Run CI once per day (at 04:23 UTC) |
| 43 |
# This ensures that even if there haven't been commits that we are still |
| 44 |
# testing against latest version of ansible-test for each ansible-core |
| 45 |
# version |
| 46 |
schedule: |
| 47 |
- cron: "23 4 * * *" |
| 48 |
|
| 49 |
concurrency: |
| 50 |
group: >- |
| 51 |
${{ github.workflow }}-${{ |
| 52 |
github.event.pull_request.number || github.sha |
| 53 |
}} |
| 54 |
cancel-in-progress: true |
| 55 |
|
| 56 |
jobs: |
| 57 |
### |
| 58 |
# Sanity tests (REQUIRED) |
| 59 |
# |
| 60 |
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html |
| 61 |
|
| 62 |
sanity: |
| 63 |
name: Sanity (Ⓐ${{ matrix.ansible }}) |
| 64 |
strategy: |
| 65 |
matrix: |
| 66 |
ansible: |
| 67 |
# It's important that Sanity is tested against all stable-X.Y branches |
| 68 |
# Testing against `devel` may fail as new tests are added. |
| 69 |
# An alternative to `devel` is the `milestone` branch with |
| 70 |
# gets synchronized with `devel` every few weeks and therefore |
| 71 |
# tends to be a more stable target. Be aware that it is not updated |
| 72 |
# around creation of a new stable branch, this might cause a problem |
| 73 |
# that two different versions of ansible-test use the same sanity test |
| 74 |
# ignore.txt file. |
| 75 |
# Add new versions announced in |
| 76 |
# https://github.com/ansible-collections/news-for-maintainers in a timely manner, |
| 77 |
# consider dropping testing against EOL versions and versions you don't support. |
| 78 |
- stable-2.15 |
| 79 |
- stable-2.16 |
| 80 |
- stable-2.17 |
| 81 |
- stable-2.18 |
| 82 |
- stable-2.19 |
| 83 |
- devel |
| 84 |
# - milestone |
| 85 |
runs-on: ubuntu-latest |
| 86 |
steps: |
| 87 |
# Run sanity tests inside a Docker container. |
| 88 |
# The docker container has all the pinned dependencies that are |
| 89 |
# required and all Python versions Ansible supports. |
| 90 |
- name: Perform sanity testing |
| 91 |
# See the documentation for the following GitHub action on |
| 92 |
# https://github.com/ansible-community/ansible-test-gh-action/blob/main/README.md |
| 93 |
uses: ansible-community/ansible-test-gh-action@release/v1 |
| 94 |
with: |
| 95 |
ansible-core-version: ${{ matrix.ansible }} |
| 96 |
testing-type: sanity |
| 97 |
# OPTIONAL If your sanity tests require code |
| 98 |
# from other collections, install them like this |
| 99 |
# test-deps: >- |
| 100 |
# ansible.netcommon |
| 101 |
# ansible.utils |
| 102 |
test-deps: >- |
| 103 |
cloud.common |
| 104 |
# OPTIONAL If set to true, will test only against changed files, |
| 105 |
# which should improve CI performance. See limitations on |
| 106 |
# https://github.com/ansible-community/ansible-test-gh-action#pull-request-change-detection |
| 107 |
pull-request-change-detection: false |
| 108 |
coverage: never # coverage is always very low for sanity tests, and doesn't make much sense |
| 109 |
|
| 110 |
check: # This job does nothing and is only used for the branch protection |
| 111 |
# or multi-stage CI jobs, like making sure that all tests pass before |
| 112 |
# a publishing job is started. |
| 113 |
if: always() |
| 114 |
|
| 115 |
needs: |
| 116 |
- sanity |
| 117 |
|
| 118 |
runs-on: ubuntu-latest |
| 119 |
|
| 120 |
steps: |
| 121 |
- name: Decide whether the needed jobs succeeded or failed |
| 122 |
uses: re-actors/alls-green@release/v1 |
| 123 |
with: |
| 124 |
jobs: ${{ toJSON(needs) }} |