Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 19 additions & 32 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Integration
on:
pull_request_target:
pull_request:
types:
- opened
- reopened
Expand All @@ -12,49 +12,44 @@ on:
- stable-*

jobs:
safe-to-test:
if: ${{ github.event.label.name == 'safe to test' }} || ${{ github.event.action != 'labeled' }}
uses: ansible-network/github_actions/.github/workflows/safe-to-test.yml@main
splitter:
needs:
- safe-to-test
runs-on: ubuntu-latest
env:
source_dir: "cloud_awsops"
outputs:
test_targets: ${{ steps.splitter.outputs.test_targets }}
test_targets_json: ${{ steps.splitter.outputs.test_targets_json }}
test_jobs: ${{ steps.splitter.outputs.test_jobs }}
targets: ${{ steps.splitter.outputs.targets }}
test_jobs: ${{ steps.splitter.outputs.jobs }}
steps:
- name: Checkout collection
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ${{ env.source_dir }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: "0"

- name: List changes for pull request
id: splitter
uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@main
uses: ansible/cloud-content-ci-automation/.github/actions/ansible_test_splitter@main
with:
collections_to_test: ${{ env.source_dir }}
total_jobs: 2
base_ref: "${{ github.event.pull_request.base.ref }}"

- name: Display splitter output
run: |
echo "test_targets=${{ steps.splitter.outputs.test_targets }}"
echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}"
echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}"
echo "test_targets=${{ steps.splitter.outputs.targets }}"
echo "test_jobs=${{ steps.splitter.outputs.jobs }}"
shell: bash
test:
runs-on: ubuntu-latest
needs:
- splitter
if: ${{ needs.splitter.outputs.test_targets != '' }}
if: ${{ needs.splitter.outputs.targets != '' }}
environment: protected # requires manual approval within GitHub Actions to proceed
env:
source: "./source"
ansible_version: "milestone"
python_version: "3.12"
ansible_test_splitter_targets: "${{ needs.splitter.outputs.targets }}"
strategy:
fail-fast: false
matrix:
Expand All @@ -63,25 +58,20 @@ jobs:
steps:
- name: Read target
id: read-targets
run: |
import json, os
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
shell: python
env:
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }}
WORKFLOW_ID: ${{ matrix.workflow-id }}
uses: ansible/cloud-content-ci-automation/.github/actions/ansible_read_targets@main
with:
job_id: "${{ matrix.workflow-id }}"
all_targets: "${{ env.ansible_test_splitter_targets }}"

- name: Display ansible test targets
run: |
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}"
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.job_targets }}"
shell: bash

- name: Checkout collection
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ${{ env.source }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v4
Expand All @@ -107,10 +97,7 @@ jobs:
source_path: ${{ env.source }}

- name: Create AWS/sts session credentials
uses: ansible-network/github_actions/.github/actions/ansible_aws_test_provider@main
with:
collection_path: ${{ steps.install.outputs.collection_path }}
ansible_core_ci_key: ${{ secrets.ANSIBLE_CORE_CI_KEY }}
uses: ansible/ansible-test-auth@v1

# we use raw git to create a repository in the tests
# this fails if the committer doesn't have a name and an email set
Expand All @@ -127,4 +114,4 @@ jobs:
python_version: ${{ env.python_version }}
ansible_version: ${{ env.ansible_version }}
ansible_test_requirement_files: 'test-requirements.txt'
ansible_test_targets: ${{ steps.read-targets.outputs.ansible_test_targets }}
ansible_test_targets: ${{ steps.read-targets.outputs.job_targets }}
Loading