Fix test failures in deploy_flask_app and backup_select_resources roles #543
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
- labeled | |
- unlabeled | |
- synchronize | |
branches: | |
- main | |
- 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 }} | |
steps: | |
- name: Checkout collection | |
uses: actions/checkout@v3 | |
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 | |
with: | |
collections_to_test: ${{ env.source_dir }} | |
total_jobs: 2 | |
- 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 }}" | |
shell: bash | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- splitter | |
if: ${{ needs.splitter.outputs.test_targets != '' }} | |
env: | |
source: "./source" | |
ansible_version: "milestone" | |
python_version: "3.11" | |
strategy: | |
fail-fast: false | |
matrix: | |
workflow-id: ${{ fromJson(needs.splitter.outputs.test_jobs) }} | |
name: "integration-${{ matrix.workflow-id }}" | |
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 }} | |
- name: Display ansible test targets | |
run: | | |
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}" | |
shell: bash | |
- name: Checkout collection | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ env.source }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python ${{ env.python_version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.python_version }} | |
# install ansible | |
- name: Install ansible-core (${{ env.ansible_version }}) | |
run: >- | |
python3 -m pip install | |
https://github.com/ansible/ansible/archive/${{ env.ansible_version }}.tar.gz | |
--disable-pip-version-check | |
shell: bash | |
- name: Pre install collections dependencies first so the collection install does not | |
run: ansible-galaxy collection install --pre '-r${{ env.source }}/tests/integration/requirements.yml' -p /home/runner/collections/ | |
- name: Build and install collection | |
id: install | |
uses: ansible-network/github_actions/.github/actions/build_install_collection@main | |
with: | |
install_python_dependencies: false | |
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 }} | |
# 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 | |
- name: Set up git | |
run: | | |
git config --global user.email gha@localhost | |
git config --global user.name "Github Actions" | |
shell: bash | |
- name: Run integration tests | |
uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main | |
with: | |
collection_path: ${{ steps.install.outputs.collection_path }} | |
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 }} |