forked from ansible-collections/amazon.aws
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (147 loc) · 5.61 KB
/
Copy pathintegration.yml
File metadata and controls
162 lines (147 loc) · 5.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
name: integration
on:
- workflow_call
jobs:
retrieve-pr-info:
name: retrieve base ref
outputs:
base_ref: ${{ steps.retrieve-pr-info.outputs.base_ref }}
head_ref: ${{ steps.retrieve-pr-info.outputs.checkout_sha }}
runs-on: ubuntu-latest
steps:
- name: Retrieve pull request base ref
id: retrieve-pr-info
uses: actions/github-script@v7
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number, // The issue number from the trigger
});
const baseBranch = pr.data.base.ref;
// The specific commit hash of the PR
const checkoutSha = pr.data.head.sha;
// This sets the output for other jobs
core.setOutput('base_ref', baseBranch);
core.info(`Successfully set output 'base_ref' to: ${baseBranch}`);
core.setOutput('checkout_sha', checkoutSha);
core.info(`Successfully set output 'checkout_sha' to: ${checkoutSha}`);
splitter:
needs:
- retrieve-pr-info
name: ansible test splitter
permissions:
pull-requests: read
env:
amazon_dir: "./amazon_aws"
community_dir: "./community_aws"
outputs:
jobs: ${{ steps.compute.outputs.jobs }}
targets: ${{ steps.compute.outputs.targets }}
runs-on: ubuntu-latest
steps:
- name: Checkout the source collection (on issue comment)
uses: actions/checkout@v6
with:
path: "${{ env.amazon_dir }}"
fetch-depth: 0
ref: ${{ needs.retrieve-pr-info.outputs.head_ref }}
if: ${{ github.event_name == 'issue_comment' }}
- name: Checkout the source collection (on other triggering method)
uses: actions/checkout@v6
with:
path: "${{ env.amazon_dir }}"
fetch-depth: 0
if: ${{ github.event_name != 'issue_comment' }}
- name: Checkout community.aws collection
uses: actions/checkout@v6
with:
repository: ansible-collections/community.aws
path: "${{ env.community_dir }}"
fetch-depth: 0
ref: ${{ needs.retrieve-pr-info.outputs.base_ref }}
- name: list changes for pull request
id: compute
uses: ansible/cloud-content-ci-automation/.github/actions/ansible_test_splitter@6659b608aab58bf1d20641b805eb9cb4fd2b771f
with:
collections_to_test: "${{ env.amazon_dir}}, ${{ env.community_dir }}"
total_jobs: 24
base_ref: '${{ needs.retrieve-pr-info.outputs.base_ref }}'
run-tests:
needs:
- retrieve-pr-info
- splitter
permissions:
pull-requests: read
env:
amazon_dir: "./amazon_aws"
community_dir: "./community_aws"
all_targets: "${{ needs.splitter.outputs.targets }}"
tarball_dir: "./tarballs"
ansible_version: milestone
python_version: 3.12
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 8
matrix:
job-id: ${{ fromJson(needs.splitter.outputs.jobs) }}
name: "${{ matrix.job-id }}"
steps:
- name: Checkout the source collection (on issue comment)
uses: actions/checkout@v6
with:
path: "${{ env.amazon_dir }}"
fetch-depth: 0
ref: ${{ needs.retrieve-pr-info.outputs.head_ref }}
if: ${{ github.event_name == 'issue_comment' }}
- name: Checkout the source collection (on other triggering method)
uses: actions/checkout@v6
with:
path: "${{ env.amazon_dir }}"
fetch-depth: 0
if: ${{ github.event_name != 'issue_comment' }}
- name: Checkout community.aws collection
uses: actions/checkout@v6
with:
repository: ansible-collections/community.aws
path: "${{ env.community_dir }}"
fetch-depth: 0
ref: ${{ needs.retrieve-pr-info.outputs.base_ref }}
- name: Read job targets
id: read-targets
uses: ansible/cloud-content-ci-automation/.github/actions/ansible_read_targets@6659b608aab58bf1d20641b805eb9cb4fd2b771f
with:
job_id: "${{ matrix.job-id }}"
all_targets: "${{ env.all_targets }}"
- name: Determine Collection Path
id: set-path
run: |
if [[ "${{ matrix.job-id }}" == *"amazon.aws"* ]]; then
echo "collection_path=${{ env.amazon_dir }}" >> $GITHUB_OUTPUT
echo "collection_dep=${{ env.community_dir }}" >> $GITHUB_OUTPUT
else
echo "collection_path=${{ env.community_dir }}" >> $GITHUB_OUTPUT
echo "collection_dep=${{ env.amazon_dir }}" >> $GITHUB_OUTPUT
fi
- uses: ansible/ansible-test-auth@008750a5bf07124c3ab86d30d73d7319d7518f36
- name: Run integration tests
uses: ansible-community/ansible-test-gh-action@d3a8ec7a59694e25e210fcd44738910149537f0e
with:
ansible-core-version: ${{ env.ansible_version }}
origin-python-version: ${{ env.python_version }}
testing-type: integration
collection-src-directory: ${{ steps.set-path.outputs.collection_path }}
collection-root: ''
target: ${{ steps.read-targets.outputs.job_targets }}
test-deps: >-
ansible.utils
ansible.netcommon
community.general
community.crypto
ansible.windows
${{ steps.set-path.outputs.collection_dep }}
pre-test-cmd: |
python3 -m pip install -r tests/integration/requirements.txt -r tests/integration/constraints.txt