Debian Codegraph @

ansible_collections/google/cloud/.github/workflows/ansible-test.yml

raw symbols SCIP
1 ---
2 # Should be kept up to date with https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml
3 # Integration tests are run separately from the ansible-integration-tests.yml workflow.
4 name: Run tests for the cloud.google collection
5 on:
6 # Run CI against all pushes (direct commits, also merged PRs), Pull Requests
7 push:
8 branches:
9 - main
10 - stable-*
11 pull_request:
12 # Run CI once per day (at 06:00 UTC)
13 # This ensures that even if there haven't been commits that we are still
14 # testing against latest version of ansible-test for each ansible-core
15 # version
16 schedule:
17 - cron: '0 6 * * *'
18
19 concurrency:
20 group: >-
21 ${{ github.workflow }}-${{
22 github.event.pull_request.number || github.sha
23 }}
24 cancel-in-progress: true
25
26 jobs:
27
28 ###
29 # Sanity tests (REQUIRED)
30 #
31 # https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
32
33 setup:
34 runs-on: ubuntu-latest
35 outputs:
36 matrix: ${{ steps.set-matrix.outputs.matrix }}
37 steps:
38 - uses: actions/checkout@v4
39 - id: set-matrix
40 run: |
41 # yq reads the .yaml and outputs a clean, minified JSON string
42 MATRIX_JSON=$(yq -o=json -I=0 .github/test-matrix.yaml)
43 echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
44
45 sanity:
46 name: Sanity (Ⓐ${{ matrix.ansible }} / Ⓟ${{ matrix.python }})
47 runs-on: ubuntu-latest
48 needs: setup
49 strategy:
50 matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
51 continue-on-error: ${{ matrix.ansible == 'devel' || matrix.ansible == 'milestone' }}
52
53 steps:
54 # Run sanity tests inside a Docker container.
55 # The docker container has all the pinned dependencies that are
56 # required and all Python versions Ansible supports.
57 - name: Perform sanity testing
58 # See the documentation for the following GitHub action on
59 # https://github.com/ansible-community/ansible-test-gh-action/blob/main/README.md
60 uses: ansible-community/ansible-test-gh-action@d3a8ec7a59694e25e210fcd44738910149537f0e # 1.17.0
61 with:
62 ansible-core-version: ${{ matrix.ansible }}
63 target-python-version: ${{ matrix.python }}
64 testing-type: sanity
65 # OPTIONAL If your sanity tests require code
66 # from other collections, install them like this
67 # test-deps: >-
68 # ansible.netcommon
69 # ansible.utils
70 # OPTIONAL If set to true, will test only against changed files,
71 # which should improve CI performance. See limitations on
72 # https://github.com/ansible-community/ansible-test-gh-action#pull-request-change-detection
73 pull-request-change-detection: false
74
75 ###
76 # Unit tests (OPTIONAL)
77 #
78 # https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
79
80 units:
81 name: Units (Ⓐ${{ matrix.ansible }} / Ⓟ${{ matrix.python }})
82 runs-on: ubuntu-latest
83 needs: setup
84 strategy:
85 matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
86 continue-on-error: ${{ matrix.ansible == 'devel' || matrix.ansible == 'milestone' }}
87
88 steps:
89 - name: >-
90 Perform unit testing against
91 Ansible version ${{ matrix.ansible }} and Python version ${{ matrix.python }}
92 # See the documentation for the following GitHub action on
93 # https://github.com/ansible-community/ansible-test-gh-action/blob/main/README.md
94 uses: ansible-community/ansible-test-gh-action@d3a8ec7a59694e25e210fcd44738910149537f0e # 1.17.0
95 with:
96 ansible-core-version: ${{ matrix.ansible }}
97 target-python-version: ${{ matrix.python }}
98 testing-type: units
99 # OPTIONAL If your unit tests require code
100 # from other collections, install them like this
101 test-deps: >-
102 ansible.netcommon
103 ansible.utils
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