From ab18c4e04baa3ae1ad0557d9065183e31082c815 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 12:44:19 +0530 Subject: [PATCH 01/36] test github cache: pip --- .github/workflows/pull-request-management.yml | 411 +++++++++--------- 1 file changed, 209 insertions(+), 202 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index a7c6dd44601..e42197d360e 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -108,6 +108,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} + cache: 'pip' - name: 'Install Python requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -115,210 +116,210 @@ jobs: # ----------------------------------- # # EOS CLI CONFIG GEN MOLECULE # ----------------------------------- # - molecule_eos_cli_config_gen: - name: Validate eos_cli_config_gen - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - avd_scenario: - - 'eos_cli_config_gen' - - 'eos_cli_config_gen_deprecated_vars' - - 'eos_cli_config_gen_negative_unit_tests' - ansible_version: - - 'ansible-core<2.19.0 --upgrade' - # Also test minimum ansible version for one scenario. - include: - - avd_scenario: 'eos_cli_config_gen' - ansible_version: 'ansible-core==2.15.0' - needs: [ file-changes ] - if: needs.file-changes.outputs.config_gen == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: 'ansible_collections/arista/avd' - molecule_command: 'test' - molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' - pip_file: .github/requirements-ci.txt - galaxy_file: "ansible_collections/arista/avd/collections.yml" - ansible: ${{ matrix.ansible_version }} - check_git: true - check_git_enforced: true - # - uses: actions/upload-artifact@v4 - # with: - # name: molecule-${{ matrix.avd_scenario }}-artifacts - # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} + # molecule_eos_cli_config_gen: + # name: Validate eos_cli_config_gen + # runs-on: ubuntu-latest + # strategy: + # fail-fast: true + # matrix: + # avd_scenario: + # - 'eos_cli_config_gen' + # - 'eos_cli_config_gen_deprecated_vars' + # - 'eos_cli_config_gen_negative_unit_tests' + # ansible_version: + # - 'ansible-core<2.19.0 --upgrade' + # # Also test minimum ansible version for one scenario. + # include: + # - avd_scenario: 'eos_cli_config_gen' + # ansible_version: 'ansible-core==2.15.0' + # needs: [ file-changes ] + # if: needs.file-changes.outputs.config_gen == 'true' + # steps: + # - uses: actions/checkout@v4 + # - name: Run molecule action + # uses: arista-netdevops-community/action-molecule-avd@v1.8.1 + # with: + # molecule_parentdir: 'ansible_collections/arista/avd' + # molecule_command: 'test' + # molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' + # pip_file: .github/requirements-ci.txt + # galaxy_file: "ansible_collections/arista/avd/collections.yml" + # ansible: ${{ matrix.ansible_version }} + # check_git: true + # check_git_enforced: true + # # - uses: actions/upload-artifact@v4 + # # with: + # # name: molecule-${{ matrix.avd_scenario }}-artifacts + # # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} - # ----------------------------------- # - # DHCP PROVISIONNER MOLECULE - # ----------------------------------- # - molecule_dhcp_provisionner: - name: Validate DHCP configuration - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - avd_scenario: ['dhcp_configuration', 'dhcp_provisioning'] - ansible_version: ['ansible-core<2.19.0 --upgrade'] - needs: [ file-changes ] - if: needs.file-changes.outputs.dhcp == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: 'ansible_collections/arista/avd' - molecule_command: 'test' - molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' - pip_file: .github/requirements-ci.txt - galaxy_file: "ansible_collections/arista/avd/collections.yml" - ansible: ${{ matrix.ansible_version }} - check_git: true - check_git_enforced: true - # - uses: actions/upload-artifact@v4 - # with: - # name: molecule-${{ matrix.avd_scenario }}-artifacts - # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} + # # ----------------------------------- # + # # DHCP PROVISIONNER MOLECULE + # # ----------------------------------- # + # molecule_dhcp_provisionner: + # name: Validate DHCP configuration + # runs-on: ubuntu-latest + # strategy: + # fail-fast: true + # matrix: + # avd_scenario: ['dhcp_configuration', 'dhcp_provisioning'] + # ansible_version: ['ansible-core<2.19.0 --upgrade'] + # needs: [ file-changes ] + # if: needs.file-changes.outputs.dhcp == 'true' + # steps: + # - uses: actions/checkout@v4 + # - name: Run molecule action + # uses: arista-netdevops-community/action-molecule-avd@v1.8.1 + # with: + # molecule_parentdir: 'ansible_collections/arista/avd' + # molecule_command: 'test' + # molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' + # pip_file: .github/requirements-ci.txt + # galaxy_file: "ansible_collections/arista/avd/collections.yml" + # ansible: ${{ matrix.ansible_version }} + # check_git: true + # check_git_enforced: true + # # - uses: actions/upload-artifact@v4 + # # with: + # # name: molecule-${{ matrix.avd_scenario }}-artifacts + # # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} - # ----------------------------------- # - # EOS Design MOLECULE - # ----------------------------------- # - molecule_eos_designs: - name: Validate eos_designs - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - avd_scenario: - - 'eos_designs_deprecated_vars' - - 'eos_designs-l2ls' - - 'eos_designs-mpls-isis-sr-ldp' - - 'eos_designs_negative_unit_tests' - - 'eos_designs-twodc-5stage-clos' - - 'eos_designs_unit_tests' - - 'evpn_underlay_ebgp_overlay_ebgp' - - 'evpn_underlay_isis_overlay_ibgp' - - 'evpn_underlay_ospf_overlay_ebgp' - - 'evpn_underlay_rfc5549_overlay_ebgp' - - 'example-campus-fabric' - - 'example-dual-dc-l3ls' - - 'example-isis-ldp-ipvpn' - - 'example-l2ls-fabric' - - 'example-single-dc-l3ls' - - 'example-cv-pathfinder' - ansible_version: - # Testing all scenario with 2.16.x, due to bug with in 2.17.0 with and the way we test eos_designs_negative_unit_tests https://github.com/ansible/ansible/issues/83292 - - 'ansible-core>=2.16.0,<2.17.0 --upgrade' - pip_requirements: - - '.github/requirements-ci.txt' - # Also test minimum ansible version for one scenario. - include: - - avd_scenario: 'eos_designs_unit_tests' - ansible_version: 'ansible-core==2.15.0' - pip_requirements: 'tmp-requirements-minimum.txt' - - avd_scenario: 'eos_designs_unit_tests' - ansible_version: 'ansible-core>=2.15.0,<2.16.0 --upgrade' - pip_requirements: '.github/requirements-ci.txt' - - avd_scenario: 'eos_designs_unit_tests' - ansible_version: 'ansible-core<2.18.0 --upgrade' - pip_requirements: '.github/requirements-ci.txt' - - avd_scenario: 'eos_designs_unit_tests' - ansible_version: 'ansible-core<2.19.0 --upgrade' - pip_requirements: '.github/requirements-ci.txt' - needs: [ file-changes ] - if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' - steps: - - uses: actions/checkout@v4 - - name: Build minimum requirements - run: | - pip install uv - uv pip compile .github/requirements-ci.txt --resolution=lowest-direct > ${{ matrix.pip_requirements }} - cat ${{ matrix.pip_requirements }} - if: matrix.pip_requirements == 'tmp-requirements-minimum.txt' - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: 'ansible_collections/arista/avd' - molecule_command: 'test' - molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' - pip_file: ${{ matrix.pip_requirements }} - galaxy_file: "ansible_collections/arista/avd/collections.yml" - ansible: ${{ matrix.ansible_version }} - check_git: true - check_git_enforced: true - # - uses: actions/upload-artifact@v4 - # with: - # name: molecule-${{ matrix.avd_scenario }}-artifacts - # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} - # ----------------------------------- # - # Cloudvision MOLECULE - # ----------------------------------- # - molecule_cloudvision: - name: Validate cvp_collection - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - avd_scenario: - - 'eos_config_deploy_cvp' - ansible_version: - - 'ansible-core<2.19.0 --upgrade' - include: - - avd_scenario: 'eos_config_deploy_cvp' - ansible_version: 'ansible-core==2.15.0' - needs: [ file-changes ] - if: needs.file-changes.outputs.cloudvision == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: 'ansible_collections/arista/avd' - molecule_command: 'test' - molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' - pip_file: .github/requirements-ci.txt - galaxy_file: "ansible_collections/arista/avd/collections.yml" - ansible: ${{ matrix.ansible_version }} - check_git: true - check_git_enforced: true - # - uses: actions/upload-artifact@v4 - # with: - # name: molecule-${{ matrix.avd_scenario }}-artifacts - # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} - # - # ----------------------------------- # - # EOS Validate State MOLECULE - # ----------------------------------- # - molecule_eos_validate_state: - name: Validate eos_validate_state - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - avd_scenario: - - 'eos_validate_state' - ansible_version: - - 'ansible-core<2.19.0 --upgrade' - include: - - avd_scenario: 'eos_validate_state' - ansible_version: 'ansible-core==2.15.0' - needs: [ file-changes ] - if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true' - steps: - - uses: actions/checkout@v4 - - name: Run molecule action - uses: arista-netdevops-community/action-molecule-avd@v1.8.1 - with: - molecule_parentdir: 'ansible_collections/arista/avd' - molecule_command: 'test' - molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' - pip_file: .github/requirements-ci.txt - galaxy_file: "ansible_collections/arista/avd/collections.yml" - ansible: ${{ matrix.ansible_version }} - check_git: true - check_git_enforced: true + # # ----------------------------------- # + # # EOS Design MOLECULE + # # ----------------------------------- # + # molecule_eos_designs: + # name: Validate eos_designs + # runs-on: ubuntu-latest + # strategy: + # fail-fast: true + # matrix: + # avd_scenario: + # - 'eos_designs_deprecated_vars' + # - 'eos_designs-l2ls' + # - 'eos_designs-mpls-isis-sr-ldp' + # - 'eos_designs_negative_unit_tests' + # - 'eos_designs-twodc-5stage-clos' + # - 'eos_designs_unit_tests' + # - 'evpn_underlay_ebgp_overlay_ebgp' + # - 'evpn_underlay_isis_overlay_ibgp' + # - 'evpn_underlay_ospf_overlay_ebgp' + # - 'evpn_underlay_rfc5549_overlay_ebgp' + # - 'example-campus-fabric' + # - 'example-dual-dc-l3ls' + # - 'example-isis-ldp-ipvpn' + # - 'example-l2ls-fabric' + # - 'example-single-dc-l3ls' + # - 'example-cv-pathfinder' + # ansible_version: + # # Testing all scenario with 2.16.x, due to bug with in 2.17.0 with and the way we test eos_designs_negative_unit_tests https://github.com/ansible/ansible/issues/83292 + # - 'ansible-core>=2.16.0,<2.17.0 --upgrade' + # pip_requirements: + # - '.github/requirements-ci.txt' + # # Also test minimum ansible version for one scenario. + # include: + # - avd_scenario: 'eos_designs_unit_tests' + # ansible_version: 'ansible-core==2.15.0' + # pip_requirements: 'tmp-requirements-minimum.txt' + # - avd_scenario: 'eos_designs_unit_tests' + # ansible_version: 'ansible-core>=2.15.0,<2.16.0 --upgrade' + # pip_requirements: '.github/requirements-ci.txt' + # - avd_scenario: 'eos_designs_unit_tests' + # ansible_version: 'ansible-core<2.18.0 --upgrade' + # pip_requirements: '.github/requirements-ci.txt' + # - avd_scenario: 'eos_designs_unit_tests' + # ansible_version: 'ansible-core<2.19.0 --upgrade' + # pip_requirements: '.github/requirements-ci.txt' + # needs: [ file-changes ] + # if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true' + # steps: + # - uses: actions/checkout@v4 + # - name: Build minimum requirements + # run: | + # pip install uv + # uv pip compile .github/requirements-ci.txt --resolution=lowest-direct > ${{ matrix.pip_requirements }} + # cat ${{ matrix.pip_requirements }} + # if: matrix.pip_requirements == 'tmp-requirements-minimum.txt' + # - name: Run molecule action + # uses: arista-netdevops-community/action-molecule-avd@v1.8.1 + # with: + # molecule_parentdir: 'ansible_collections/arista/avd' + # molecule_command: 'test' + # molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' + # pip_file: ${{ matrix.pip_requirements }} + # galaxy_file: "ansible_collections/arista/avd/collections.yml" + # ansible: ${{ matrix.ansible_version }} + # check_git: true + # check_git_enforced: true + # # - uses: actions/upload-artifact@v4 + # # with: + # # name: molecule-${{ matrix.avd_scenario }}-artifacts + # # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} + # # ----------------------------------- # + # # Cloudvision MOLECULE + # # ----------------------------------- # + # molecule_cloudvision: + # name: Validate cvp_collection + # runs-on: ubuntu-latest + # strategy: + # fail-fast: true + # matrix: + # avd_scenario: + # - 'eos_config_deploy_cvp' + # ansible_version: + # - 'ansible-core<2.19.0 --upgrade' + # include: + # - avd_scenario: 'eos_config_deploy_cvp' + # ansible_version: 'ansible-core==2.15.0' + # needs: [ file-changes ] + # if: needs.file-changes.outputs.cloudvision == 'true' + # steps: + # - uses: actions/checkout@v4 + # - name: Run molecule action + # uses: arista-netdevops-community/action-molecule-avd@v1.8.1 + # with: + # molecule_parentdir: 'ansible_collections/arista/avd' + # molecule_command: 'test' + # molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' + # pip_file: .github/requirements-ci.txt + # galaxy_file: "ansible_collections/arista/avd/collections.yml" + # ansible: ${{ matrix.ansible_version }} + # check_git: true + # check_git_enforced: true + # # - uses: actions/upload-artifact@v4 + # # with: + # # name: molecule-${{ matrix.avd_scenario }}-artifacts + # # path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }} + # # + # # ----------------------------------- # + # # EOS Validate State MOLECULE + # # ----------------------------------- # + # molecule_eos_validate_state: + # name: Validate eos_validate_state + # runs-on: ubuntu-latest + # strategy: + # fail-fast: true + # matrix: + # avd_scenario: + # - 'eos_validate_state' + # ansible_version: + # - 'ansible-core<2.19.0 --upgrade' + # include: + # - avd_scenario: 'eos_validate_state' + # ansible_version: 'ansible-core==2.15.0' + # needs: [ file-changes ] + # if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true' + # steps: + # - uses: actions/checkout@v4 + # - name: Run molecule action + # uses: arista-netdevops-community/action-molecule-avd@v1.8.1 + # with: + # molecule_parentdir: 'ansible_collections/arista/avd' + # molecule_command: 'test' + # molecule_args: '--scenario-name ${{ matrix.avd_scenario }}' + # pip_file: .github/requirements-ci.txt + # galaxy_file: "ansible_collections/arista/avd/collections.yml" + # ansible: ${{ matrix.ansible_version }} + # check_git: true + # check_git_enforced: true # ----------------------------------- # # Ansible tests @@ -337,6 +338,7 @@ jobs: 3.11 3.12 3.13 + cache: 'pip' - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -356,6 +358,7 @@ jobs: with: python-version: | 3.10 + cache: 'pip' - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -376,6 +379,7 @@ jobs: python-version: | 3.12 3.13 + cache: 'pip' - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -398,6 +402,7 @@ jobs: 3.11 3.12 3.13 + cache: 'pip' - name: 'Install Python & Ansible requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -419,6 +424,7 @@ jobs: with: python-version: | 3.10 + cache: 'pip' - uses: actions/checkout@v4 - name: 'Install Python & Ansible requirements' run: | @@ -459,6 +465,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + cache: 'pip' - name: 'Install tox' run: | pip install tox tox-gh-actions --upgrade From 5f83a5c206af8dce1c67e1f14b8f2977a6eb7ecb Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 15:05:22 +0530 Subject: [PATCH 02/36] adding cache for ansible dependencies --- .github/workflows/pull-request-management.yml | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index e42197d360e..d5c724da47e 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -339,6 +339,14 @@ jobs: 3.12 3.13 cache: 'pip' + - name: Cache ansible-core dependencies + id: cache-ansible + uses: actions/cache@v3 + with: + path: ~/.cache/ansible-core + key: ${{ runner.os }}-ansible-core-<2.19.0 + restore-keys: | + ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -359,6 +367,14 @@ jobs: python-version: | 3.10 cache: 'pip' + - name: Cache ansible-core dependencies + id: cache-ansible + uses: actions/cache@v3 + with: + path: ~/.cache/ansible-core + key: ${{ runner.os }}-ansible-core-<2.19.0 + restore-keys: | + ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -380,6 +396,14 @@ jobs: 3.12 3.13 cache: 'pip' + - name: Cache ansible-core dependencies + id: cache-ansible + uses: actions/cache@v3 + with: + path: ~/.cache/ansible-core + key: ${{ runner.os }}-ansible-core-<2.19.0 + restore-keys: | + ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -420,12 +444,20 @@ jobs: env: GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg steps: + - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: | 3.10 cache: 'pip' - - uses: actions/checkout@v4 + - name: Cache ansible-core dependencies + id: cache-ansible + uses: actions/cache@v3 + with: + path: ~/.cache/ansible-core + key: ${{ runner.os }}-ansible-core-<2.19.0 + restore-keys: | + ${{ runner.os }}-ansible-core- - name: 'Install Python & Ansible requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade From 1797262545f7ab988e6046cc2d973ed5bcf9871a Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 15:46:34 +0530 Subject: [PATCH 03/36] remove ansibel ache --- .github/workflows/pull-request-management.yml | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index d5c724da47e..65116659b64 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -339,14 +339,14 @@ jobs: 3.12 3.13 cache: 'pip' - - name: Cache ansible-core dependencies - id: cache-ansible - uses: actions/cache@v3 - with: - path: ~/.cache/ansible-core - key: ${{ runner.os }}-ansible-core-<2.19.0 - restore-keys: | - ${{ runner.os }}-ansible-core- + # - name: Cache ansible-core dependencies + # id: cache-ansible + # uses: actions/cache@v3 + # with: + # path: ~/.cache/ansible-core + # key: ${{ runner.os }}-ansible-core-<2.19.0 + # restore-keys: | + # ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -367,14 +367,6 @@ jobs: python-version: | 3.10 cache: 'pip' - - name: Cache ansible-core dependencies - id: cache-ansible - uses: actions/cache@v3 - with: - path: ~/.cache/ansible-core - key: ${{ runner.os }}-ansible-core-<2.19.0 - restore-keys: | - ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -396,14 +388,6 @@ jobs: 3.12 3.13 cache: 'pip' - - name: Cache ansible-core dependencies - id: cache-ansible - uses: actions/cache@v3 - with: - path: ~/.cache/ansible-core - key: ${{ runner.os }}-ansible-core-<2.19.0 - restore-keys: | - ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -450,14 +434,6 @@ jobs: python-version: | 3.10 cache: 'pip' - - name: Cache ansible-core dependencies - id: cache-ansible - uses: actions/cache@v3 - with: - path: ~/.cache/ansible-core - key: ${{ runner.os }}-ansible-core-<2.19.0 - restore-keys: | - ${{ runner.os }}-ansible-core- - name: 'Install Python & Ansible requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade From 3bf075d2a5cb9b9c11262ce6e106ed8f6a62a7d9 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 15:54:07 +0530 Subject: [PATCH 04/36] test condition --- .github/workflows/pull-request-management.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 65116659b64..b8ab18b3e76 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -332,6 +332,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 + id: pipcache with: python-version: | 3.10 @@ -348,6 +349,7 @@ jobs: # restore-keys: | # ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' + if: steps.pipcache.outputs.cache-hit != true run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test sanity' From 07fe2b28ab1dd096b47aa5fbefe2a29021c9a46e Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 16:32:20 +0530 Subject: [PATCH 05/36] removing cache --- .github/workflows/pull-request-management.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index b8ab18b3e76..bb9c1832b84 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -108,7 +108,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} - cache: 'pip' - name: 'Install Python requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -339,7 +338,6 @@ jobs: 3.11 3.12 3.13 - cache: 'pip' # - name: Cache ansible-core dependencies # id: cache-ansible # uses: actions/cache@v3 @@ -368,7 +366,6 @@ jobs: with: python-version: | 3.10 - cache: 'pip' - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -389,7 +386,6 @@ jobs: python-version: | 3.12 3.13 - cache: 'pip' - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -412,7 +408,6 @@ jobs: 3.11 3.12 3.13 - cache: 'pip' - name: 'Install Python & Ansible requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -435,7 +430,6 @@ jobs: with: python-version: | 3.10 - cache: 'pip' - name: 'Install Python & Ansible requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -475,7 +469,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - cache: 'pip' - name: 'Install tox' run: | pip install tox tox-gh-actions --upgrade From 7dd88e7193a4e921e781683c0d817364a022f638 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 16:37:15 +0530 Subject: [PATCH 06/36] adding cache --- .github/workflows/pull-request-management.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index bb9c1832b84..867ac8318e1 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -108,6 +108,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} + cache: 'pip' - name: 'Install Python requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -338,6 +339,7 @@ jobs: 3.11 3.12 3.13 + cache: 'pip' # - name: Cache ansible-core dependencies # id: cache-ansible # uses: actions/cache@v3 @@ -347,7 +349,7 @@ jobs: # restore-keys: | # ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' - if: steps.pipcache.outputs.cache-hit != true + if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test sanity' @@ -366,6 +368,7 @@ jobs: with: python-version: | 3.10 + cache: 'pip' - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -386,6 +389,7 @@ jobs: python-version: | 3.12 3.13 + cache: 'pip' - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -408,6 +412,7 @@ jobs: 3.11 3.12 3.13 + cache: 'pip' - name: 'Install Python & Ansible requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -430,6 +435,7 @@ jobs: with: python-version: | 3.10 + cache: 'pip' - name: 'Install Python & Ansible requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -469,6 +475,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + cache: 'pip' - name: 'Install tox' run: | pip install tox tox-gh-actions --upgrade From 4adc10e6f5059aabb2ad250e9355e5d72d6212cf Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 19:18:38 +0530 Subject: [PATCH 07/36] Add cache-hit condition to each job --- .github/workflows/pull-request-management.yml | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 867ac8318e1..ea1d75bd480 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -106,10 +106,12 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 + id: pipcache with: python-version: ${{ matrix.python_version }} cache: 'pip' - name: 'Install Python requirements' + if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -340,14 +342,6 @@ jobs: 3.12 3.13 cache: 'pip' - # - name: Cache ansible-core dependencies - # id: cache-ansible - # uses: actions/cache@v3 - # with: - # path: ~/.cache/ansible-core - # key: ${{ runner.os }}-ansible-core-<2.19.0 - # restore-keys: | - # ${{ runner.os }}-ansible-core- - name: 'Install Python requirements' if: steps.pipcache.outputs.cache-hit != 'true' run: | @@ -365,11 +359,13 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 + id: pipcache with: python-version: | 3.10 cache: 'pip' - name: 'Install Python requirements' + if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test units test cases' @@ -385,12 +381,14 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 + id: pipcache with: python-version: | 3.12 3.13 cache: 'pip' - name: 'Install Python requirements' + if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test integration test cases' @@ -413,6 +411,8 @@ jobs: 3.12 3.13 cache: 'pip' + + ## create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - name: 'Install Python & Ansible requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -436,6 +436,8 @@ jobs: python-version: | 3.10 cache: 'pip' + + # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - name: 'Install Python & Ansible requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -473,10 +475,12 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 + id: pipcache with: python-version: ${{ matrix.python }} cache: 'pip' - name: 'Install tox' + if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install tox tox-gh-actions --upgrade - name: "Run pytest via tox for ${{ matrix.python }}" From 102ed30bcbb6971a450f5db30858a9b50216b73f Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 12:38:03 +0530 Subject: [PATCH 08/36] no conditions --- .github/workflows/pull-request-management.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index ea1d75bd480..092fe1b097f 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -343,7 +343,7 @@ jobs: 3.13 cache: 'pip' - name: 'Install Python requirements' - if: steps.pipcache.outputs.cache-hit != 'true' + # if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test sanity' @@ -365,7 +365,7 @@ jobs: 3.10 cache: 'pip' - name: 'Install Python requirements' - if: steps.pipcache.outputs.cache-hit != 'true' + # if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test units test cases' @@ -388,7 +388,7 @@ jobs: 3.13 cache: 'pip' - name: 'Install Python requirements' - if: steps.pipcache.outputs.cache-hit != 'true' + # if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: 'Run ansible-test integration test cases' @@ -480,7 +480,7 @@ jobs: python-version: ${{ matrix.python }} cache: 'pip' - name: 'Install tox' - if: steps.pipcache.outputs.cache-hit != 'true' + # if: steps.pipcache.outputs.cache-hit != 'true' run: | pip install tox tox-gh-actions --upgrade - name: "Run pytest via tox for ${{ matrix.python }}" From 6a47d1ad765a4e283388ae1f542a44ad4f31894e Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 18:30:30 +0530 Subject: [PATCH 09/36] common job for dependency and restore in other jobs --- .github/workflows/pull-request-management.yml | 385 ++++++++++++------ 1 file changed, 263 insertions(+), 122 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 092fe1b097f..e601be735d6 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -326,164 +326,305 @@ jobs: # ----------------------------------- # # Ansible tests # ----------------------------------- # - ansible_test_sanity: - name: Run ansible-test sanity validation + + python_requirements: + name: Install and cache Python requirements runs-on: ubuntu-latest - needs: [ file-changes ] + needs: [file-changes] + if: needs.file-changes.outputs.requirements == 'true' + strategy: + fail-fast: true + matrix: + python_version: + - "3.10" + - "3.11" + - "3.12" + - "3.13" steps: - uses: actions/checkout@v4 - - name: Set up Python 3 + + # Set up Python version + - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v5 - id: pipcache with: - python-version: | - 3.10 - 3.11 - 3.12 - 3.13 - cache: 'pip' - - name: 'Install Python requirements' - # if: steps.pipcache.outputs.cache-hit != 'true' + python-version: ${{ matrix.python_version }} + cache: pip + + # Restore cache for requirements-ci.txt + - name: Restore cache for requirements-ci.txt + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + + # Restore cache for requirements-dev.txt + - name: Restore cache for requirements-dev.txt + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles('ansible_collections/arista/avd/requirements-dev.txt') }}-${{ matrix.python_version }} + + # Restore cache for ansible-core + - name: Restore cache for ansible-core + uses: actions/cache@v3 + with: + path: ~/.cache/ansible + key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} + + - name: Install ansible requirements run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test sanity' + pip install "ansible-core<2.19.0" --upgrade + + # Install Python requirements (both requirements files) + - name: Install Python requirements run: | - cd ansible_collections/arista/avd/ - ansible-test sanity --color yes -v + pip install -r .github/requirements-ci.txt --upgrade + pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - ansible_test_units: - name: Run ansible-test units test cases + ansible_test_sanity: + name: Run ansible-test sanity validation runs-on: ubuntu-latest - needs: [ file-changes ] + needs: [python_requirements, file-changes] steps: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 - id: pipcache with: python-version: | 3.10 - cache: 'pip' - - name: 'Install Python requirements' - # if: steps.pipcache.outputs.cache-hit != 'true' - run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test units test cases' + 3.11 + 3.12 + 3.13 + + # - name: Restore cache for requirements-ci.txt + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + # restore-keys: | + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.11 + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + + # - name: Restore cache for ansible-core<2.19.0 + # uses: actions/cache@v3 + # with: + # path: ~/.cache/ansible + # key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} + # restore-keys: | + # ${{ runner.os }}-pip-ansible-core-3.10 + # ${{ runner.os }}-pip-ansible-core-3.11 + # ${{ runner.os }}-pip-ansible-core-3.12 + # ${{ runner.os }}-pip-ansible-core-3.13 + + - name: 'Run ansible-test sanity' run: | cd ansible_collections/arista/avd/ - ansible-test units -vv + ansible-test sanity --color yes -v ansible_test_integration: name: Run ansible-test integration test cases runs-on: ubuntu-latest - needs: [ file-changes ] + needs: [ python_requirements, file-changes ] steps: - uses: actions/checkout@v4 - name: Set up Python 3 uses: actions/setup-python@v5 - id: pipcache with: python-version: | 3.12 3.13 - cache: 'pip' - - name: 'Install Python requirements' - # if: steps.pipcache.outputs.cache-hit != 'true' - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test integration -vv + - name: Restore cache for requirements-ci.txt + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + restore-keys: | + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - ansible_lint: - name: Run ansible-lint test case - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 + - name: Restore cache for ansible-core<2.19.0 + uses: actions/cache@v3 with: - python-version: | - 3.10 - 3.11 - 3.12 - 3.13 - cache: 'pip' + path: ~/.cache/ansible + key: ${{ runner.os }}-pip-ansible-core-3.13 + restore-keys: | + ${{ runner.os }}-pip-ansible-core-3.12 + ${{ runner.os }}-pip-ansible-core-3.13 - ## create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - name: 'Install Python & Ansible requirements' + - name: Print pip list run: | - pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + echo "Installed Python packages for Python version ${{ matrix.python_version }}:" + pip list + + # - name: 'Install Python requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Run ansible-test integration test cases' run: | cd ansible_collections/arista/avd/ - ansible-lint --force-color --strict -v - # ----------------------------------- # - # Galaxy Importer - # ----------------------------------- # - galaxy_importer: - name: Test galaxy-importer - runs-on: ubuntu-20.04 # Older version to be compatible with old python - env: - GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - cache: 'pip' + ansible-test integration -vv - # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - name: 'Install Python & Ansible requirements' - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - name: Install galaxy-importer - # Install the specific version of galaxy-importer used on galaxy.ansible.com - # The version conflicts with our requirements, - # so we let the galaxy-importer version resolve remaining requirements. - run: | - pip install "galaxy-importer==0.4.25" - - name: 'Build ansible package' - run: make collection-build - - name: 'Run galaxy-importer checks' - run: python -m galaxy_importer.main *.tar.gz - - uses: actions/upload-artifact@v4 - with: - name: importer-logs - path: ./importer_result.json + # ansible_test_sanity: + # name: Run ansible-test sanity validation + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.10 + # 3.11 + # 3.12 + # 3.13 + # cache: 'pip' + # - name: 'Install Python requirements' + # # if: steps.pipcache.outputs.cache-hit != 'true' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test sanity' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test sanity --color yes -v - # ----------------------------------- # - # Test of pyavd - # ----------------------------------- # - pyavd: - name: Test pyavd - runs-on: ubuntu-latest - needs: [file-changes] - if: | - needs.file-changes.outputs.eos_design == 'true' || - needs.file-changes.outputs.config_gen == 'true' || - needs.file-changes.outputs.pyavd == 'true' - strategy: - matrix: - python: ["3.10", "3.11", "3.12", "3.13"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: ${{ matrix.python }} - cache: 'pip' - - name: 'Install tox' - # if: steps.pipcache.outputs.cache-hit != 'true' - run: | - pip install tox tox-gh-actions --upgrade - - name: "Run pytest via tox for ${{ matrix.python }}" - working-directory: python-avd - run: | - tox + # ansible_test_units: + # name: Run ansible-test units test cases + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # - name: 'Install Python requirements' + # # if: steps.pipcache.outputs.cache-hit != 'true' + # run: | + # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test units test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv + + # ansible_test_integration: + # name: Run ansible-test integration test cases + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.12 + # 3.13 + # cache: 'pip' + # - name: 'Install Python requirements' + # # if: steps.pipcache.outputs.cache-hit != 'true' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test integration -vv + + # ansible_lint: + # name: Run ansible-lint test case + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # 3.11 + # 3.12 + # 3.13 + # cache: 'pip' + + # ## create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # - name: 'Install Python & Ansible requirements' + # run: | + # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + # ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-lint --force-color --strict -v + # # ----------------------------------- # + # # Galaxy Importer + # # ----------------------------------- # + # galaxy_importer: + # name: Test galaxy-importer + # runs-on: ubuntu-20.04 # Older version to be compatible with old python + # env: + # GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # cache: 'pip' + + # # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # - name: 'Install Python & Ansible requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # - name: Install galaxy-importer + # # Install the specific version of galaxy-importer used on galaxy.ansible.com + # # The version conflicts with our requirements, + # # so we let the galaxy-importer version resolve remaining requirements. + # run: | + # pip install "galaxy-importer==0.4.25" + # - name: 'Build ansible package' + # run: make collection-build + # - name: 'Run galaxy-importer checks' + # run: python -m galaxy_importer.main *.tar.gz + # - uses: actions/upload-artifact@v4 + # with: + # name: importer-logs + # path: ./importer_result.json + + # # ----------------------------------- # + # # Test of pyavd + # # ----------------------------------- # + # pyavd: + # name: Test pyavd + # runs-on: ubuntu-latest + # needs: [file-changes] + # if: | + # needs.file-changes.outputs.eos_design == 'true' || + # needs.file-changes.outputs.config_gen == 'true' || + # needs.file-changes.outputs.pyavd == 'true' + # strategy: + # matrix: + # python: ["3.10", "3.11", "3.12", "3.13"] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: ${{ matrix.python }} + # cache: 'pip' + # - name: 'Install tox' + # # if: steps.pipcache.outputs.cache-hit != 'true' + # run: | + # pip install tox tox-gh-actions --upgrade + # - name: "Run pytest via tox for ${{ matrix.python }}" + # working-directory: python-avd + # run: | + # tox From df8346950c5996c8d581a080a65c881bda68bfcd Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 18:38:10 +0530 Subject: [PATCH 10/36] pre-comit fix --- .github/workflows/pull-request-management.yml | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index e601be735d6..761b758cd0d 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -89,31 +89,31 @@ jobs: # ----------------------------------- # # Test Requirements # ----------------------------------- # - python_requirements: - name: Test Python requirements installation - runs-on: ubuntu-latest - needs: [ file-changes ] - if: needs.file-changes.outputs.requirements == 'true' - strategy: - fail-fast: true - matrix: - python_version: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: ${{ matrix.python_version }} - cache: 'pip' - - name: 'Install Python requirements' - if: steps.pipcache.outputs.cache-hit != 'true' - run: | - pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + # python_requirements: + # name: Test Python requirements installation + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # if: needs.file-changes.outputs.requirements == 'true' + # strategy: + # fail-fast: true + # matrix: + # python_version: + # - "3.10" + # - "3.11" + # - "3.12" + # - "3.13" + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: ${{ matrix.python_version }} + # cache: 'pip' + # - name: 'Install Python requirements' + # if: steps.pipcache.outputs.cache-hit != 'true' + # run: | + # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade # ----------------------------------- # # EOS CLI CONFIG GEN MOLECULE @@ -578,7 +578,7 @@ jobs: # 3.10 # cache: 'pip' - # # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml # - name: 'Install Python & Ansible requirements' # run: | # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade From 7ce7f328b994ce096134d0ac7bb0c178ade440d9 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 19:08:31 +0530 Subject: [PATCH 11/36] trying with dry-run --- .github/workflows/pull-request-management.yml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 761b758cd0d..ae2d74018d5 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -452,6 +452,31 @@ jobs: restore-keys: | ${{ runner.os }}-pip-ansible-core-3.12 ${{ runner.os }}-pip-ansible-core-3.13 + + # # Restore dependencies cache + # - name: Restore dependencies cache + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-requirements-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + # restore-keys: | + # ${{ runner.os }}-pip-requirements- + + # Check dependencies without installation + - name: Check Python requirements (dry-run) + run: | + pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade --dry-run + + - name: Check ansible requirements (dry-run) + run: | + pip install --cache-dir ~/.cache/ansible -r ansible-core<2.19.0 --upgrade --dry-run + + # Install dependencies if needed + - name: Install Python requirements + if: failure() # Runs only if the dry-run step fails + run: | + pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade + - name: Print pip list run: | From e7f6a97f964b5c993621533074429a57b7985573 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 19:32:51 +0530 Subject: [PATCH 12/36] Reverting the separate cache job and using setup-python --- .github/workflows/pull-request-management.yml | 599 +++++++++--------- 1 file changed, 294 insertions(+), 305 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index ae2d74018d5..1fdae038a99 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -89,31 +89,28 @@ jobs: # ----------------------------------- # # Test Requirements # ----------------------------------- # - # python_requirements: - # name: Test Python requirements installation - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # if: needs.file-changes.outputs.requirements == 'true' - # strategy: - # fail-fast: true - # matrix: - # python_version: - # - "3.10" - # - "3.11" - # - "3.12" - # - "3.13" - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: ${{ matrix.python_version }} - # cache: 'pip' - # - name: 'Install Python requirements' - # if: steps.pipcache.outputs.cache-hit != 'true' - # run: | - # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + python_requirements: + name: Test Python requirements installation + runs-on: ubuntu-latest + needs: [ file-changes ] + if: needs.file-changes.outputs.requirements == 'true' + strategy: + fail-fast: true + matrix: + python_version: + - "3.10" + - "3.11" + - "3.12" + - "3.13" + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_version }} + - name: 'Install Python requirements' + run: | + pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade # ----------------------------------- # # EOS CLI CONFIG GEN MOLECULE @@ -327,329 +324,321 @@ jobs: # Ansible tests # ----------------------------------- # - python_requirements: - name: Install and cache Python requirements - runs-on: ubuntu-latest - needs: [file-changes] - if: needs.file-changes.outputs.requirements == 'true' - strategy: - fail-fast: true - matrix: - python_version: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - steps: - - uses: actions/checkout@v4 - - # Set up Python version - - name: Set up Python ${{ matrix.python_version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python_version }} - cache: pip - - # Restore cache for requirements-ci.txt - - name: Restore cache for requirements-ci.txt - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} - - # Restore cache for requirements-dev.txt - - name: Restore cache for requirements-dev.txt - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles('ansible_collections/arista/avd/requirements-dev.txt') }}-${{ matrix.python_version }} - - # Restore cache for ansible-core - - name: Restore cache for ansible-core - uses: actions/cache@v3 - with: - path: ~/.cache/ansible - key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - - - name: Install ansible requirements - run: | - pip install "ansible-core<2.19.0" --upgrade - - # Install Python requirements (both requirements files) - - name: Install Python requirements - run: | - pip install -r .github/requirements-ci.txt --upgrade - pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - - ansible_test_sanity: - name: Run ansible-test sanity validation - runs-on: ubuntu-latest - needs: [python_requirements, file-changes] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - 3.11 - 3.12 - 3.13 - - # - name: Restore cache for requirements-ci.txt - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} - # restore-keys: | - # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 - # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.11 - # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 - # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - - # - name: Restore cache for ansible-core<2.19.0 - # uses: actions/cache@v3 - # with: - # path: ~/.cache/ansible - # key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - # restore-keys: | - # ${{ runner.os }}-pip-ansible-core-3.10 - # ${{ runner.os }}-pip-ansible-core-3.11 - # ${{ runner.os }}-pip-ansible-core-3.12 - # ${{ runner.os }}-pip-ansible-core-3.13 - - - name: 'Run ansible-test sanity' - run: | - cd ansible_collections/arista/avd/ - ansible-test sanity --color yes -v - - ansible_test_integration: - name: Run ansible-test integration test cases - runs-on: ubuntu-latest - needs: [ python_requirements, file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.12 - 3.13 - - name: Restore cache for requirements-ci.txt - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - restore-keys: | - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - - - name: Restore cache for ansible-core<2.19.0 - uses: actions/cache@v3 - with: - path: ~/.cache/ansible - key: ${{ runner.os }}-pip-ansible-core-3.13 - restore-keys: | - ${{ runner.os }}-pip-ansible-core-3.12 - ${{ runner.os }}-pip-ansible-core-3.13 - - # # Restore dependencies cache - # - name: Restore dependencies cache - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip-requirements-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} - # restore-keys: | - # ${{ runner.os }}-pip-requirements- - - # Check dependencies without installation - - name: Check Python requirements (dry-run) - run: | - pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade --dry-run + # python_requirements: + # name: Install and cache Python requirements + # runs-on: ubuntu-latest + # needs: [file-changes] + # if: needs.file-changes.outputs.requirements == 'true' + # strategy: + # fail-fast: true + # matrix: + # python_version: + # - "3.10" + # - "3.11" + # - "3.12" + # - "3.13" + # steps: + # - uses: actions/checkout@v4 - - name: Check ansible requirements (dry-run) - run: | - pip install --cache-dir ~/.cache/ansible -r ansible-core<2.19.0 --upgrade --dry-run + # # Set up Python version + # - name: Set up Python ${{ matrix.python_version }} + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python_version }} + # cache: pip - # Install dependencies if needed - - name: Install Python requirements - if: failure() # Runs only if the dry-run step fails - run: | - pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade + # # Restore cache for requirements-ci.txt + # - name: Restore cache for requirements-ci.txt + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + # # Restore cache for requirements-dev.txt + # - name: Restore cache for requirements-dev.txt + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles('ansible_collections/arista/avd/requirements-dev.txt') }}-${{ matrix.python_version }} - - name: Print pip list - run: | - echo "Installed Python packages for Python version ${{ matrix.python_version }}:" - pip list + # # Restore cache for ansible-core + # - name: Restore cache for ansible-core + # uses: actions/cache@v3 + # with: + # path: ~/.cache/ansible + # key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - # - name: 'Install Python requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: Install ansible requirements + # run: | + # pip install "ansible-core<2.19.0" --upgrade - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test integration -vv + # # Install Python requirements (both requirements files) + # - name: Install Python requirements + # run: | + # pip install -r .github/requirements-ci.txt --upgrade + # pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade # ansible_test_sanity: # name: Run ansible-test sanity validation # runs-on: ubuntu-latest - # needs: [ file-changes ] + # needs: [python_requirements, file-changes] # steps: # - uses: actions/checkout@v4 # - name: Set up Python 3 # uses: actions/setup-python@v5 - # id: pipcache # with: # python-version: | # 3.10 # 3.11 # 3.12 # 3.13 - # cache: 'pip' - # - name: 'Install Python requirements' - # # if: steps.pipcache.outputs.cache-hit != 'true' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + + # # - name: Restore cache for requirements-ci.txt + # # uses: actions/cache@v3 + # # with: + # # path: ~/.cache/pip + # # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + # # restore-keys: | + # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 + # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.11 + # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 + # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + + # # - name: Restore cache for ansible-core<2.19.0 + # # uses: actions/cache@v3 + # # with: + # # path: ~/.cache/ansible + # # key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} + # # restore-keys: | + # # ${{ runner.os }}-pip-ansible-core-3.10 + # # ${{ runner.os }}-pip-ansible-core-3.11 + # # ${{ runner.os }}-pip-ansible-core-3.12 + # # ${{ runner.os }}-pip-ansible-core-3.13 + # - name: 'Run ansible-test sanity' # run: | # cd ansible_collections/arista/avd/ # ansible-test sanity --color yes -v - # ansible_test_units: - # name: Run ansible-test units test cases - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.10 - # cache: 'pip' - # - name: 'Install Python requirements' - # # if: steps.pipcache.outputs.cache-hit != 'true' - # run: | - # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: 'Run ansible-test units test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test units -vv - # ansible_test_integration: # name: Run ansible-test integration test cases # runs-on: ubuntu-latest - # needs: [ file-changes ] + # needs: [ python_requirements, file-changes ] # steps: # - uses: actions/checkout@v4 # - name: Set up Python 3 # uses: actions/setup-python@v5 - # id: pipcache # with: # python-version: | # 3.12 # 3.13 - # cache: 'pip' - # - name: 'Install Python requirements' - # # if: steps.pipcache.outputs.cache-hit != 'true' + # - name: Restore cache for requirements-ci.txt + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + # restore-keys: | + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + + # - name: Restore cache for ansible-core<2.19.0 + # uses: actions/cache@v3 + # with: + # path: ~/.cache/ansible + # key: ${{ runner.os }}-pip-ansible-core-3.13 + # restore-keys: | + # ${{ runner.os }}-pip-ansible-core-3.12 + # ${{ runner.os }}-pip-ansible-core-3.13 + + # # # Restore dependencies cache + # # - name: Restore dependencies cache + # # uses: actions/cache@v3 + # # with: + # # path: ~/.cache/pip + # # key: ${{ runner.os }}-pip-requirements-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + # # restore-keys: | + # # ${{ runner.os }}-pip-requirements- + + # # Check dependencies without installation + # - name: Check Python requirements (dry-run) # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: 'Run ansible-test integration test cases' + # pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade --dry-run + + # - name: Check ansible requirements (dry-run) # run: | - # cd ansible_collections/arista/avd/ - # ansible-test integration -vv + # pip install --cache-dir ~/.cache/ansible -r ansible-core<2.19.0 --upgrade --dry-run + + # # Install dependencies if needed + # - name: Install Python requirements + # if: failure() # Runs only if the dry-run step fails + # run: | + # pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade - # ansible_lint: - # name: Run ansible-lint test case - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # 3.11 - # 3.12 - # 3.13 - # cache: 'pip' - # ## create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # - name: 'Install Python & Ansible requirements' + # - name: Print pip list # run: | - # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - # ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # echo "Installed Python packages for Python version ${{ matrix.python_version }}:" + # pip list + + # # - name: 'Install Python requirements' + # # run: | + # # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test integration test cases' # run: | # cd ansible_collections/arista/avd/ - # ansible-lint --force-color --strict -v - # # ----------------------------------- # - # # Galaxy Importer - # # ----------------------------------- # - # galaxy_importer: - # name: Test galaxy-importer - # runs-on: ubuntu-20.04 # Older version to be compatible with old python - # env: - # GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # cache: 'pip' + # ansible-test integration -vv - # # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # - name: 'Install Python & Ansible requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # - name: Install galaxy-importer - # # Install the specific version of galaxy-importer used on galaxy.ansible.com - # # The version conflicts with our requirements, - # # so we let the galaxy-importer version resolve remaining requirements. - # run: | - # pip install "galaxy-importer==0.4.25" - # - name: 'Build ansible package' - # run: make collection-build - # - name: 'Run galaxy-importer checks' - # run: python -m galaxy_importer.main *.tar.gz - # - uses: actions/upload-artifact@v4 - # with: - # name: importer-logs - # path: ./importer_result.json + ansible_test_sanity: + name: Run ansible-test sanity validation + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + cache: 'pip' + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Run ansible-test sanity' + run: | + cd ansible_collections/arista/avd/ + ansible-test sanity --color yes -v - # # ----------------------------------- # - # # Test of pyavd - # # ----------------------------------- # - # pyavd: - # name: Test pyavd - # runs-on: ubuntu-latest - # needs: [file-changes] - # if: | - # needs.file-changes.outputs.eos_design == 'true' || - # needs.file-changes.outputs.config_gen == 'true' || - # needs.file-changes.outputs.pyavd == 'true' - # strategy: - # matrix: - # python: ["3.10", "3.11", "3.12", "3.13"] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: ${{ matrix.python }} - # cache: 'pip' - # - name: 'Install tox' - # # if: steps.pipcache.outputs.cache-hit != 'true' - # run: | - # pip install tox tox-gh-actions --upgrade - # - name: "Run pytest via tox for ${{ matrix.python }}" - # working-directory: python-avd - # run: | - # tox + ansible_test_units: + name: Run ansible-test units test cases + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.10 + cache: 'pip' + - name: 'Install Python requirements' + run: | + pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Run ansible-test units test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test units -vv + + ansible_test_integration: + name: Run ansible-test integration test cases + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.12 + 3.13 + cache: 'pip' + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test integration -vv + + ansible_lint: + name: Run ansible-lint test case + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + cache: 'pip' + - name: 'Install Python & Ansible requirements' + run: | + pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-lint --force-color --strict -v + # ----------------------------------- # + # Galaxy Importer + # ----------------------------------- # + galaxy_importer: + name: Test galaxy-importer + runs-on: ubuntu-20.04 # Older version to be compatible with old python + env: + GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + cache: 'pip' + # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: 'Install Python & Ansible requirements' + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: Install galaxy-importer + # Install the specific version of galaxy-importer used on galaxy.ansible.com + # The version conflicts with our requirements, + # so we let the galaxy-importer version resolve remaining requirements. + run: | + pip install "galaxy-importer==0.4.25" + - name: 'Build ansible package' + run: make collection-build + - name: 'Run galaxy-importer checks' + run: python -m galaxy_importer.main *.tar.gz + - uses: actions/upload-artifact@v4 + with: + name: importer-logs + path: ./importer_result.json + + # ----------------------------------- # + # Test of pyavd + # ----------------------------------- # + pyavd: + name: Test pyavd + runs-on: ubuntu-latest + needs: [file-changes] + if: | + needs.file-changes.outputs.eos_design == 'true' || + needs.file-changes.outputs.config_gen == 'true' || + needs.file-changes.outputs.pyavd == 'true' + strategy: + matrix: + python: ["3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + - name: 'Install tox' + run: | + pip install tox tox-gh-actions --upgrade + - name: "Run pytest via tox for ${{ matrix.python }}" + working-directory: python-avd + run: | + tox From 52bea37673410da28b8bb4f586a9d08c510b165d Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 10 Dec 2024 13:06:50 +0530 Subject: [PATCH 13/36] separate cache step for ansible-collections --- .github/workflows/pull-request-management.yml | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 1fdae038a99..650ed4a7d0c 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -574,7 +574,18 @@ jobs: - name: 'Install Python & Ansible requirements' run: | pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + + - name: Cache Ansible Galaxy Collections + uses: actions/cache@v3 + with: + path: ~/.ansible/collections + key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + restore-keys: | + ansible-galaxy- + + - name: Install Ansible Galaxy Collections + run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: 'Run ansible-test integration test cases' run: | cd ansible_collections/arista/avd/ @@ -594,11 +605,28 @@ jobs: python-version: | 3.10 cache: 'pip' - # create a separate step to cache insatalling ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - name: 'Install Python & Ansible requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: Cache Ansible Galaxy Collections + uses: actions/cache@v3 + with: + path: ~/.ansible/collections + key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + restore-keys: | + ansible-galaxy- + - name: Install Ansible Galaxy Collections + run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + + - name: Cache galaxy-importer + id: cache-galaxy-importer + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 + restore-keys: | + pip-galaxy-importer-${{ runner.os }}- + - name: Install galaxy-importer # Install the specific version of galaxy-importer used on galaxy.ansible.com # The version conflicts with our requirements, From 3d35c7cdcd106711dfe38848723d3c62300159cc Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 10 Dec 2024 19:12:21 +0530 Subject: [PATCH 14/36] test update --- python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py b/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py index 2385f0e6646..2e0ea638b13 100644 --- a/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py +++ b/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py @@ -9,7 +9,7 @@ if TYPE_CHECKING: from . import EosDesignsFacts - +# comment for testing CI class MlagMixin: """ Mixin Class used to generate some of the EosDesignsFacts. From 1282d5db1b199279b86d069ffa8ca7240f25d9cf Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Thu, 12 Dec 2024 17:10:59 +0530 Subject: [PATCH 15/36] print wheel file path --- .github/workflows/pull-request-management.yml | 351 +++++++++--------- 1 file changed, 178 insertions(+), 173 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 650ed4a7d0c..cfbc2125dd3 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -89,28 +89,28 @@ jobs: # ----------------------------------- # # Test Requirements # ----------------------------------- # - python_requirements: - name: Test Python requirements installation - runs-on: ubuntu-latest - needs: [ file-changes ] - if: needs.file-changes.outputs.requirements == 'true' - strategy: - fail-fast: true - matrix: - python_version: - - "3.10" - - "3.11" - - "3.12" - - "3.13" - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python_version }} - - name: 'Install Python requirements' - run: | - pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + # python_requirements: + # name: Test Python requirements installation + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # if: needs.file-changes.outputs.requirements == 'true' + # strategy: + # fail-fast: true + # matrix: + # python_version: + # - "3.10" + # - "3.11" + # - "3.12" + # - "3.13" + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python_version }} + # - name: 'Install Python requirements' + # run: | + # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade # ----------------------------------- # # EOS CLI CONFIG GEN MOLECULE @@ -508,165 +508,170 @@ jobs: - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + + - name: Find and print wheel file path + run: | + find . -type f -name '*5.2.0.dev1-py3-none-any.whl' -print + - name: 'Run ansible-test sanity' run: | cd ansible_collections/arista/avd/ ansible-test sanity --color yes -v - ansible_test_units: - name: Run ansible-test units test cases - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: | - 3.10 - cache: 'pip' - - name: 'Install Python requirements' - run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test units test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test units -vv + # ansible_test_units: + # name: Run ansible-test units test cases + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # - name: 'Install Python requirements' + # run: | + # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test units test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv - ansible_test_integration: - name: Run ansible-test integration test cases - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: | - 3.12 - 3.13 - cache: 'pip' - - name: 'Install Python requirements' - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test integration -vv + # ansible_test_integration: + # name: Run ansible-test integration test cases + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.12 + # 3.13 + # cache: 'pip' + # - name: 'Install Python requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test integration -vv - ansible_lint: - name: Run ansible-lint test case - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - 3.11 - 3.12 - 3.13 - cache: 'pip' - - name: 'Install Python & Ansible requirements' - run: | - pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + # ansible_lint: + # name: Run ansible-lint test case + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # 3.11 + # 3.12 + # 3.13 + # cache: 'pip' + # - name: 'Install Python & Ansible requirements' + # run: | + # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - - name: Cache Ansible Galaxy Collections - uses: actions/cache@v3 - with: - path: ~/.ansible/collections - key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - restore-keys: | - ansible-galaxy- + # - name: Cache Ansible Galaxy Collections + # uses: actions/cache@v3 + # with: + # path: ~/.ansible/collections + # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + # restore-keys: | + # ansible-galaxy- - - name: Install Ansible Galaxy Collections - run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + # - name: Install Ansible Galaxy Collections + # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-lint --force-color --strict -v - # ----------------------------------- # - # Galaxy Importer - # ----------------------------------- # - galaxy_importer: - name: Test galaxy-importer - runs-on: ubuntu-20.04 # Older version to be compatible with old python - env: - GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - cache: 'pip' - - name: 'Install Python & Ansible requirements' - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: Cache Ansible Galaxy Collections - uses: actions/cache@v3 - with: - path: ~/.ansible/collections - key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - restore-keys: | - ansible-galaxy- - - name: Install Ansible Galaxy Collections - run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - - name: Cache galaxy-importer - id: cache-galaxy-importer - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 - restore-keys: | - pip-galaxy-importer-${{ runner.os }}- - - - name: Install galaxy-importer - # Install the specific version of galaxy-importer used on galaxy.ansible.com - # The version conflicts with our requirements, - # so we let the galaxy-importer version resolve remaining requirements. - run: | - pip install "galaxy-importer==0.4.25" - - name: 'Build ansible package' - run: make collection-build - - name: 'Run galaxy-importer checks' - run: python -m galaxy_importer.main *.tar.gz - - uses: actions/upload-artifact@v4 - with: - name: importer-logs - path: ./importer_result.json + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-lint --force-color --strict -v + # # ----------------------------------- # + # # Galaxy Importer + # # ----------------------------------- # + # galaxy_importer: + # name: Test galaxy-importer + # runs-on: ubuntu-20.04 # Older version to be compatible with old python + # env: + # GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # - name: 'Install Python & Ansible requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: Cache Ansible Galaxy Collections + # uses: actions/cache@v3 + # with: + # path: ~/.ansible/collections + # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + # restore-keys: | + # ansible-galaxy- + # - name: Install Ansible Galaxy Collections + # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # ----------------------------------- # - # Test of pyavd - # ----------------------------------- # - pyavd: - name: Test pyavd - runs-on: ubuntu-latest - needs: [file-changes] - if: | - needs.file-changes.outputs.eos_design == 'true' || - needs.file-changes.outputs.config_gen == 'true' || - needs.file-changes.outputs.pyavd == 'true' - strategy: - matrix: - python: ["3.10", "3.11", "3.12", "3.13"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - cache: 'pip' - - name: 'Install tox' - run: | - pip install tox tox-gh-actions --upgrade - - name: "Run pytest via tox for ${{ matrix.python }}" - working-directory: python-avd - run: | - tox + # - name: Cache galaxy-importer + # id: cache-galaxy-importer + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 + # restore-keys: | + # pip-galaxy-importer-${{ runner.os }}- + + # - name: Install galaxy-importer + # # Install the specific version of galaxy-importer used on galaxy.ansible.com + # # The version conflicts with our requirements, + # # so we let the galaxy-importer version resolve remaining requirements. + # run: | + # pip install "galaxy-importer==0.4.25" + # - name: 'Build ansible package' + # run: make collection-build + # - name: 'Run galaxy-importer checks' + # run: python -m galaxy_importer.main *.tar.gz + # - uses: actions/upload-artifact@v4 + # with: + # name: importer-logs + # path: ./importer_result.json + + # # ----------------------------------- # + # # Test of pyavd + # # ----------------------------------- # + # pyavd: + # name: Test pyavd + # runs-on: ubuntu-latest + # needs: [file-changes] + # if: | + # needs.file-changes.outputs.eos_design == 'true' || + # needs.file-changes.outputs.config_gen == 'true' || + # needs.file-changes.outputs.pyavd == 'true' + # strategy: + # matrix: + # python: ["3.10", "3.11", "3.12", "3.13"] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python }} + # cache: 'pip' + # - name: 'Install tox' + # run: | + # pip install tox tox-gh-actions --upgrade + # - name: "Run pytest via tox for ${{ matrix.python }}" + # working-directory: python-avd + # run: | + # tox From 8d0ba6cb844b1159283a3baa24f1313c60fbee94 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Thu, 12 Dec 2024 17:21:04 +0530 Subject: [PATCH 16/36] print wheel file path --- .github/workflows/pull-request-management.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index cfbc2125dd3..f7017cd14d9 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -510,8 +510,16 @@ jobs: pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - name: Find and print wheel file path + shell: bash run: | - find . -type f -name '*5.2.0.dev1-py3-none-any.whl' -print + set -e + echo "Searching for the wheel file..." + FILE_PATH=$(find . -type f -name '*5.2.0.dev1-py3-none-any.whl') + if [ -z "$FILE_PATH" ]; then + echo "Error: Wheel file not found." + exit 1 + fi + echo "Found wheel file at: $FILE_PATH" - name: 'Run ansible-test sanity' run: | From 431d36b9320a8009b5b244bd855f769621eea255 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Thu, 12 Dec 2024 17:51:54 +0530 Subject: [PATCH 17/36] print wheel file path --- .github/workflows/pull-request-management.yml | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index f7017cd14d9..4738a50bb26 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -509,17 +509,21 @@ jobs: run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: Find and print wheel file path - shell: bash + # - name: Find and print wheel file path + # shell: bash + # run: | + # set -e + # echo "Searching for the wheel file..." + # FILE_PATH=$(find . -type f -name '*5.2.0.dev1-py3-none-any.whl') + # if [ -z "$FILE_PATH" ]; then + # echo "Error: Wheel file not found." + # exit 1 + # fi + # echo "Found wheel file at: $FILE_PATH" + + - name: list run: | - set -e - echo "Searching for the wheel file..." - FILE_PATH=$(find . -type f -name '*5.2.0.dev1-py3-none-any.whl') - if [ -z "$FILE_PATH" ]; then - echo "Error: Wheel file not found." - exit 1 - fi - echo "Found wheel file at: $FILE_PATH" + ls -l /home/runner/.cache/pip/wheels/3f/b8/e4/06a7ef48f65a79014cac4474ca06ed03f987ae6daa2aa02141/ - name: 'Run ansible-test sanity' run: | From 54edeb98897474aa7b8b711f73a323edf71a38af Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Thu, 12 Dec 2024 18:04:18 +0530 Subject: [PATCH 18/36] added cache-latest --- .github/workflows/pull-request-management.yml | 324 +++++++++--------- 1 file changed, 157 insertions(+), 167 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 4738a50bb26..67f6b8d8324 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -505,185 +505,175 @@ jobs: 3.12 3.13 cache: 'pip' + cache-latest: true - name: 'Install Python requirements' run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: Find and print wheel file path - # shell: bash - # run: | - # set -e - # echo "Searching for the wheel file..." - # FILE_PATH=$(find . -type f -name '*5.2.0.dev1-py3-none-any.whl') - # if [ -z "$FILE_PATH" ]; then - # echo "Error: Wheel file not found." - # exit 1 - # fi - # echo "Found wheel file at: $FILE_PATH" - - - name: list - run: | - ls -l /home/runner/.cache/pip/wheels/3f/b8/e4/06a7ef48f65a79014cac4474ca06ed03f987ae6daa2aa02141/ - - name: 'Run ansible-test sanity' run: | cd ansible_collections/arista/avd/ ansible-test sanity --color yes -v - # ansible_test_units: - # name: Run ansible-test units test cases - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.10 - # cache: 'pip' - # - name: 'Install Python requirements' - # run: | - # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: 'Run ansible-test units test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test units -vv + ansible_test_units: + name: Run ansible-test units test cases + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.10 + cache: 'pip' + cache-latest: true + - name: 'Install Python requirements' + run: | + pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Run ansible-test units test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test units -vv - # ansible_test_integration: - # name: Run ansible-test integration test cases - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.12 - # 3.13 - # cache: 'pip' - # - name: 'Install Python requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: 'Run ansible-test integration test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test integration -vv + ansible_test_integration: + name: Run ansible-test integration test cases + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.12 + 3.13 + cache: 'pip' + cache-latest: true + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test integration -vv - # ansible_lint: - # name: Run ansible-lint test case - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # 3.11 - # 3.12 - # 3.13 - # cache: 'pip' - # - name: 'Install Python & Ansible requirements' - # run: | - # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + ansible_lint: + name: Run ansible-lint test case + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + cache: 'pip' + cache-latest: true + - name: 'Install Python & Ansible requirements' + run: | + pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - # - name: Cache Ansible Galaxy Collections - # uses: actions/cache@v3 - # with: - # path: ~/.ansible/collections - # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - # restore-keys: | - # ansible-galaxy- + - name: Cache Ansible Galaxy Collections + uses: actions/cache@v3 + with: + path: ~/.ansible/collections + key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + restore-keys: | + ansible-galaxy- - # - name: Install Ansible Galaxy Collections - # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: Install Ansible Galaxy Collections + run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # - name: 'Run ansible-test integration test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-lint --force-color --strict -v - # # ----------------------------------- # - # # Galaxy Importer - # # ----------------------------------- # - # galaxy_importer: - # name: Test galaxy-importer - # runs-on: ubuntu-20.04 # Older version to be compatible with old python - # env: - # GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # cache: 'pip' - # - name: 'Install Python & Ansible requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: Cache Ansible Galaxy Collections - # uses: actions/cache@v3 - # with: - # path: ~/.ansible/collections - # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - # restore-keys: | - # ansible-galaxy- - # - name: Install Ansible Galaxy Collections - # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - # - name: Cache galaxy-importer - # id: cache-galaxy-importer - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 - # restore-keys: | - # pip-galaxy-importer-${{ runner.os }}- - - # - name: Install galaxy-importer - # # Install the specific version of galaxy-importer used on galaxy.ansible.com - # # The version conflicts with our requirements, - # # so we let the galaxy-importer version resolve remaining requirements. - # run: | - # pip install "galaxy-importer==0.4.25" - # - name: 'Build ansible package' - # run: make collection-build - # - name: 'Run galaxy-importer checks' - # run: python -m galaxy_importer.main *.tar.gz - # - uses: actions/upload-artifact@v4 - # with: - # name: importer-logs - # path: ./importer_result.json + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-lint --force-color --strict -v + # ----------------------------------- # + # Galaxy Importer + # ----------------------------------- # + galaxy_importer: + name: Test galaxy-importer + runs-on: ubuntu-20.04 # Older version to be compatible with old python + env: + GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + cache: 'pip' + cache-latest: true + - name: 'Install Python & Ansible requirements' + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: Cache Ansible Galaxy Collections + uses: actions/cache@v3 + with: + path: ~/.ansible/collections + key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + restore-keys: | + ansible-galaxy- + - name: Install Ansible Galaxy Collections + run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + + - name: Cache galaxy-importer + id: cache-galaxy-importer + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 + restore-keys: | + pip-galaxy-importer-${{ runner.os }}- + + - name: Install galaxy-importer + # Install the specific version of galaxy-importer used on galaxy.ansible.com + # The version conflicts with our requirements, + # so we let the galaxy-importer version resolve remaining requirements. + run: | + pip install "galaxy-importer==0.4.25" + - name: 'Build ansible package' + run: make collection-build + - name: 'Run galaxy-importer checks' + run: python -m galaxy_importer.main *.tar.gz + - uses: actions/upload-artifact@v4 + with: + name: importer-logs + path: ./importer_result.json - # # ----------------------------------- # - # # Test of pyavd - # # ----------------------------------- # - # pyavd: - # name: Test pyavd - # runs-on: ubuntu-latest - # needs: [file-changes] - # if: | - # needs.file-changes.outputs.eos_design == 'true' || - # needs.file-changes.outputs.config_gen == 'true' || - # needs.file-changes.outputs.pyavd == 'true' - # strategy: - # matrix: - # python: ["3.10", "3.11", "3.12", "3.13"] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python }} - # cache: 'pip' - # - name: 'Install tox' - # run: | - # pip install tox tox-gh-actions --upgrade - # - name: "Run pytest via tox for ${{ matrix.python }}" - # working-directory: python-avd - # run: | - # tox + # ----------------------------------- # + # Test of pyavd + # ----------------------------------- # + pyavd: + name: Test pyavd + runs-on: ubuntu-latest + needs: [file-changes] + if: | + needs.file-changes.outputs.eos_design == 'true' || + needs.file-changes.outputs.config_gen == 'true' || + needs.file-changes.outputs.pyavd == 'true' + strategy: + matrix: + python: ["3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + cache-latest: true + - name: 'Install tox' + run: | + pip install tox tox-gh-actions --upgrade + - name: "Run pytest via tox for ${{ matrix.python }}" + working-directory: python-avd + run: | + tox From 01a785746e1a18b9ae99ed1468b31a38d0f7bd31 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Wed, 18 Dec 2024 12:42:00 +0530 Subject: [PATCH 19/36] print runner path --- .github/workflows/pull-request-management.yml | 333 +++++++++--------- 1 file changed, 170 insertions(+), 163 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 67f6b8d8324..bbb372523aa 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -506,174 +506,181 @@ jobs: 3.13 cache: 'pip' cache-latest: true - - name: 'Install Python requirements' + - name: Print runner path run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + echo "Runner Tool Cache: $RUNNER_TOOL_CACHE" + echo "Runner Temp: $RUNNER_TEMP" + echo "Runner Workspace: $RUNNER_WORKSPACE" + echo "Home Directory: $HOME" + echo "GitHub Workspace: $GITHUB_WORKSPACE" + # - name: 'Install Python requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + + # - name: 'Run ansible-test sanity' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test sanity --color yes -v + + # ansible_test_units: + # name: Run ansible-test units test cases + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # cache-latest: true + # - name: 'Install Python requirements' + # run: | + # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test units test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv - - name: 'Run ansible-test sanity' - run: | - cd ansible_collections/arista/avd/ - ansible-test sanity --color yes -v + # ansible_test_integration: + # name: Run ansible-test integration test cases + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.12 + # 3.13 + # cache: 'pip' + # cache-latest: true + # - name: 'Install Python requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test integration -vv - ansible_test_units: - name: Run ansible-test units test cases - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: | - 3.10 - cache: 'pip' - cache-latest: true - - name: 'Install Python requirements' - run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test units test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test units -vv + # ansible_lint: + # name: Run ansible-lint test case + # runs-on: ubuntu-latest + # needs: [ file-changes ] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # 3.11 + # 3.12 + # 3.13 + # cache: 'pip' + # cache-latest: true + # - name: 'Install Python & Ansible requirements' + # run: | + # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - ansible_test_integration: - name: Run ansible-test integration test cases - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: | - 3.12 - 3.13 - cache: 'pip' - cache-latest: true - - name: 'Install Python requirements' - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test integration -vv + # - name: Cache Ansible Galaxy Collections + # uses: actions/cache@v3 + # with: + # path: ~/.ansible/collections + # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + # restore-keys: | + # ansible-galaxy- - ansible_lint: - name: Run ansible-lint test case - runs-on: ubuntu-latest - needs: [ file-changes ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - 3.11 - 3.12 - 3.13 - cache: 'pip' - cache-latest: true - - name: 'Install Python & Ansible requirements' - run: | - pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + # - name: Install Ansible Galaxy Collections + # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-lint --force-color --strict -v + # # ----------------------------------- # + # # Galaxy Importer + # # ----------------------------------- # + # galaxy_importer: + # name: Test galaxy-importer + # runs-on: ubuntu-20.04 # Older version to be compatible with old python + # env: + # GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # cache-latest: true + # - name: 'Install Python & Ansible requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: Cache Ansible Galaxy Collections + # uses: actions/cache@v3 + # with: + # path: ~/.ansible/collections + # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + # restore-keys: | + # ansible-galaxy- + # - name: Install Ansible Galaxy Collections + # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - name: Cache Ansible Galaxy Collections - uses: actions/cache@v3 - with: - path: ~/.ansible/collections - key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - restore-keys: | - ansible-galaxy- + # - name: Cache galaxy-importer + # id: cache-galaxy-importer + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 + # restore-keys: | + # pip-galaxy-importer-${{ runner.os }}- - - name: Install Ansible Galaxy Collections - run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-lint --force-color --strict -v - # ----------------------------------- # - # Galaxy Importer - # ----------------------------------- # - galaxy_importer: - name: Test galaxy-importer - runs-on: ubuntu-20.04 # Older version to be compatible with old python - env: - GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - cache: 'pip' - cache-latest: true - - name: 'Install Python & Ansible requirements' - run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: Cache Ansible Galaxy Collections - uses: actions/cache@v3 - with: - path: ~/.ansible/collections - key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - restore-keys: | - ansible-galaxy- - - name: Install Ansible Galaxy Collections - run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - - name: Cache galaxy-importer - id: cache-galaxy-importer - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 - restore-keys: | - pip-galaxy-importer-${{ runner.os }}- - - - name: Install galaxy-importer - # Install the specific version of galaxy-importer used on galaxy.ansible.com - # The version conflicts with our requirements, - # so we let the galaxy-importer version resolve remaining requirements. - run: | - pip install "galaxy-importer==0.4.25" - - name: 'Build ansible package' - run: make collection-build - - name: 'Run galaxy-importer checks' - run: python -m galaxy_importer.main *.tar.gz - - uses: actions/upload-artifact@v4 - with: - name: importer-logs - path: ./importer_result.json + # - name: Install galaxy-importer + # # Install the specific version of galaxy-importer used on galaxy.ansible.com + # # The version conflicts with our requirements, + # # so we let the galaxy-importer version resolve remaining requirements. + # run: | + # pip install "galaxy-importer==0.4.25" + # - name: 'Build ansible package' + # run: make collection-build + # - name: 'Run galaxy-importer checks' + # run: python -m galaxy_importer.main *.tar.gz + # - uses: actions/upload-artifact@v4 + # with: + # name: importer-logs + # path: ./importer_result.json - # ----------------------------------- # - # Test of pyavd - # ----------------------------------- # - pyavd: - name: Test pyavd - runs-on: ubuntu-latest - needs: [file-changes] - if: | - needs.file-changes.outputs.eos_design == 'true' || - needs.file-changes.outputs.config_gen == 'true' || - needs.file-changes.outputs.pyavd == 'true' - strategy: - matrix: - python: ["3.10", "3.11", "3.12", "3.13"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - cache: 'pip' - cache-latest: true - - name: 'Install tox' - run: | - pip install tox tox-gh-actions --upgrade - - name: "Run pytest via tox for ${{ matrix.python }}" - working-directory: python-avd - run: | - tox + # # ----------------------------------- # + # # Test of pyavd + # # ----------------------------------- # + # pyavd: + # name: Test pyavd + # runs-on: ubuntu-latest + # needs: [file-changes] + # if: | + # needs.file-changes.outputs.eos_design == 'true' || + # needs.file-changes.outputs.config_gen == 'true' || + # needs.file-changes.outputs.pyavd == 'true' + # strategy: + # matrix: + # python: ["3.10", "3.11", "3.12", "3.13"] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python }} + # cache: 'pip' + # cache-latest: true + # - name: 'Install tox' + # run: | + # pip install tox tox-gh-actions --upgrade + # - name: "Run pytest via tox for ${{ matrix.python }}" + # working-directory: python-avd + # run: | + # tox From cdd299ad974592a4b605cf04b64b6bcfc3e9b490 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Wed, 18 Dec 2024 12:49:41 +0530 Subject: [PATCH 20/36] print WHEEL_CACHE_PATH --- .github/workflows/pull-request-management.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index bbb372523aa..ec21c3e3ca1 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -508,11 +508,10 @@ jobs: cache-latest: true - name: Print runner path run: | - echo "Runner Tool Cache: $RUNNER_TOOL_CACHE" - echo "Runner Temp: $RUNNER_TEMP" - echo "Runner Workspace: $RUNNER_WORKSPACE" - echo "Home Directory: $HOME" - echo "GitHub Workspace: $GITHUB_WORKSPACE" + WHEEL_CACHE_PATH="$(pip cache dir)/wheels" + echo "Wheel cache path: $WHEEL_CACHE_PATH" + # Optionally, expose this path for other steps + echo "WHEEL_CACHE_PATH=$WHEEL_CACHE_PATH" >> $GITHUB_ENV # - name: 'Install Python requirements' # run: | # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade From 43d63ace5345e6b615c031719d52174ea9a4872d Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Wed, 18 Dec 2024 14:54:22 +0530 Subject: [PATCH 21/36] full wheel path --- .github/workflows/pull-request-management.yml | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index ec21c3e3ca1..8145603848c 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -508,10 +508,22 @@ jobs: cache-latest: true - name: Print runner path run: | - WHEEL_CACHE_PATH="$(pip cache dir)/wheels" - echo "Wheel cache path: $WHEEL_CACHE_PATH" - # Optionally, expose this path for other steps - echo "WHEEL_CACHE_PATH=$WHEEL_CACHE_PATH" >> $GITHUB_ENV + WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" + echo "Wheel cache root: $WHEEL_CACHE_ROOT" + + FULL_WHEEL_PATH=$(find "$WHEEL_CACHE_ROOT" -type d -mindepth 4 -maxdepth 4) + if [ -z "$FULL_WHEEL_PATH" ]; then + echo "No wheel files found." + exit 1 + fi + + echo "Full wheel path: $FULL_WHEEL_PATH" + echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV + + - name: Use the full pip wheel path + run: | + echo "Full wheel path from environment: $FULL_WHEEL_PATH" + ls -l $FULL_WHEEL_PATH # - name: 'Install Python requirements' # run: | # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade From a4edc8231a2fc1c994c74ba823c25ac6fc1b31a9 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 12:24:57 +0530 Subject: [PATCH 22/36] extract path from logs --- .github/workflows/pull-request-management.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 8145603848c..fa171f97f29 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -506,6 +506,25 @@ jobs: 3.13 cache: 'pip' cache-latest: true + + - name: Install dependencies and capture wheel path + run: | + # Install dependencies and capture logs + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade | tee pip_install.log + + # Extract the "Stored in directory" path from logs + FULL_WHEEL_PATH=$(grep "Stored in directory:" pip_install.log | awk '{print $NF}') + + # Verify the path and print it + if [ -z "$FULL_WHEEL_PATH" ]; then + echo "Wheel path not found in logs." + exit 1 + fi + echo "Full wheel path: $FULL_WHEEL_PATH" + + # Export the path for use in other steps + echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV + - name: Print runner path run: | WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" From 3cd83614ce81a9ac23943265f3194fa13156e437 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 12:32:47 +0530 Subject: [PATCH 23/36] ls print --- .github/workflows/pull-request-management.yml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 621fa7f2c3b..2cd0af791e3 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -522,22 +522,22 @@ jobs: fi echo "Full wheel path: $FULL_WHEEL_PATH" - # Export the path for use in other steps - echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV + # # Export the path for use in other steps + # echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV - - name: Print runner path - run: | - WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" - echo "Wheel cache root: $WHEEL_CACHE_ROOT" + # - name: Print runner path + # run: | + # WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" + # echo "Wheel cache root: $WHEEL_CACHE_ROOT" - FULL_WHEEL_PATH=$(find "$WHEEL_CACHE_ROOT" -type d -mindepth 4 -maxdepth 4) - if [ -z "$FULL_WHEEL_PATH" ]; then - echo "No wheel files found." - exit 1 - fi + # FULL_WHEEL_PATH=$(find "$WHEEL_CACHE_ROOT" -type d -mindepth 4 -maxdepth 4) + # if [ -z "$FULL_WHEEL_PATH" ]; then + # echo "No wheel files found." + # exit 1 + # fi - echo "Full wheel path: $FULL_WHEEL_PATH" - echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV + # echo "Full wheel path: $FULL_WHEEL_PATH" + # echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV - name: Use the full pip wheel path run: | From 3610aec9123032dcb5e6af1bd3873dcb839ca3e1 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 12:43:14 +0530 Subject: [PATCH 24/36] find wheel file in the wheel path --- .github/workflows/pull-request-management.yml | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 2cd0af791e3..82fd925c8be 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -513,7 +513,7 @@ jobs: pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade | tee pip_install.log # Extract the "Stored in directory" path from logs - FULL_WHEEL_PATH=$(grep "Stored in directory:" pip_install.log | awk '{print $NF}') + FULL_WHEEL_PATH=$(grep -m 1 "Stored in directory:" pip_install.log | awk '{print $NF}') # Verify the path and print it if [ -z "$FULL_WHEEL_PATH" ]; then @@ -522,8 +522,24 @@ jobs: fi echo "Full wheel path: $FULL_WHEEL_PATH" - # # Export the path for use in other steps - # echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV + # Use the previously extracted FULL_WHEEL_PATH + echo "Searching for pyavd-5.2.0.dev2-py3-none-any.whl in $FULL_WHEEL_PATH" + + # List the contents of the directory + echo "Contents of the wheel directory:" + ls -al "$FULL_WHEEL_PATH" + + # Find the specific file in the directory + WHEEL_FILE=$(find "$FULL_WHEEL_PATH" -type f -name "pyavd-5.2.0.dev2-py3-none-any.whl") + + # Check if the file exists + if [ -z "$WHEEL_FILE" ]; then + echo "Wheel file not found: pyavd-5.2.0.dev2-py3-none-any.whl" + exit 1 + fi + + echo "Found wheel file: $WHEEL_FILE" + # - name: Print runner path # run: | From af9b453b26f0389c6ceb7da8af91f2ef21a5b14d Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 13:27:31 +0530 Subject: [PATCH 25/36] upload/download artifact --- .github/workflows/pull-request-management.yml | 45 +++++++++++++++++-- .../_eos_designs/eos_designs_facts/mlag.py | 1 + 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 82fd925c8be..447d358851b 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -449,7 +449,7 @@ jobs: # restore-keys: | # ${{ runner.os }}-pip-ansible-core-3.12 # ${{ runner.os }}-pip-ansible-core-3.13 - + # # # Restore dependencies cache # # - name: Restore dependencies cache # # uses: actions/cache@v3 @@ -474,7 +474,6 @@ jobs: # run: | # pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade - # - name: Print pip list # run: | # echo "Installed Python packages for Python version ${{ matrix.python_version }}:" @@ -514,7 +513,7 @@ jobs: # Extract the "Stored in directory" path from logs FULL_WHEEL_PATH=$(grep -m 1 "Stored in directory:" pip_install.log | awk '{print $NF}') - + # Verify the path and print it if [ -z "$FULL_WHEEL_PATH" ]; then echo "Wheel path not found in logs." @@ -540,7 +539,45 @@ jobs: echo "Found wheel file: $WHEEL_FILE" + echo "WHEEL_FILE=$WHEEL_FILE" >> $GITHUB_ENV + + - name: Upload wheel artifact + uses: actions/upload-artifact@v3 + with: + name: pyavd-wheel + path: ${{ env.WHEEL_FILE }} + + download-and-use: + runs-on: ubuntu-latest + needs: ansible_test_sanity + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + cache: 'pip' + cache-latest: true + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts + + - name: Install the wheel file + run: | + # Verify the downloaded artifact + echo "Contents of artifacts directory:" + ls -al ./artifacts + + # Install the wheel file + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl # - name: Print runner path # run: | # WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" @@ -643,7 +680,7 @@ jobs: # - name: Install Ansible Galaxy Collections # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - + # - name: 'Run ansible-test integration test cases' # run: | # cd ansible_collections/arista/avd/ diff --git a/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py b/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py index 2e0ea638b13..58d8624eb96 100644 --- a/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py +++ b/python-avd/pyavd/_eos_designs/eos_designs_facts/mlag.py @@ -9,6 +9,7 @@ if TYPE_CHECKING: from . import EosDesignsFacts + # comment for testing CI class MlagMixin: """ From 21a0d9a85dfee156bf108fb06febc77406a657d9 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 13:55:30 +0530 Subject: [PATCH 26/36] run unit test with downloading artifacts --- .github/workflows/pull-request-management.yml | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 447d358851b..37938d9f420 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -559,9 +559,6 @@ jobs: with: python-version: | 3.10 - 3.11 - 3.12 - 3.13 cache: 'pip' cache-latest: true - name: Download wheel artifact @@ -570,14 +567,22 @@ jobs: name: pyavd-wheel path: ./artifacts - - name: Install the wheel file - run: | - # Verify the downloaded artifact - echo "Contents of artifacts directory:" - ls -al ./artifacts + # - name: Install the wheel file + # run: | + # # Verify the downloaded artifact + # echo "Contents of artifacts directory:" + # ls -al ./artifacts - # Install the wheel file + # # Install the wheel file + # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + - name: 'Install Python requirements' + run: | + pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" --upgrade pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + - name: 'Run ansible-test units test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test units -vv # - name: Print runner path # run: | # WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" @@ -592,10 +597,10 @@ jobs: # echo "Full wheel path: $FULL_WHEEL_PATH" # echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV - - name: Use the full pip wheel path - run: | - echo "Full wheel path from environment: $FULL_WHEEL_PATH" - ls -l $FULL_WHEEL_PATH + # - name: Use the full pip wheel path + # run: | + # echo "Full wheel path from environment: $FULL_WHEEL_PATH" + # ls -l $FULL_WHEEL_PATH # - name: 'Install Python requirements' # run: | # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade From 8a1fcd6af22a5b35ed3b98465e16cd869d4f6692 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 14:01:30 +0530 Subject: [PATCH 27/36] test with python 3.10 --- .github/workflows/pull-request-management.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 37938d9f420..0ec86b354fa 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -500,9 +500,6 @@ jobs: with: python-version: | 3.10 - 3.11 - 3.12 - 3.13 cache: 'pip' cache-latest: true From 173f16b5cc590d313af73751b110bf5dc85999e2 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 14:07:05 +0530 Subject: [PATCH 28/36] install dev req --- .github/workflows/pull-request-management.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 0ec86b354fa..090bb54c30a 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -574,7 +574,7 @@ jobs: # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - name: 'Install Python requirements' run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" --upgrade + pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - name: 'Run ansible-test units test cases' run: | From fbd9587cf99f9c230cf863647b6b06aca480974d Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 15:43:59 +0530 Subject: [PATCH 29/36] update job names --- .github/workflows/pull-request-management.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 090bb54c30a..d63e51dd17b 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -488,7 +488,7 @@ jobs: # cd ansible_collections/arista/avd/ # ansible-test integration -vv - ansible_test_sanity: + ansible_test_sanit: name: Run ansible-test sanity validation runs-on: ubuntu-latest needs: [ file-changes ] @@ -544,9 +544,9 @@ jobs: name: pyavd-wheel path: ${{ env.WHEEL_FILE }} - download-and-use: + download-dependencies: runs-on: ubuntu-latest - needs: ansible_test_sanity + needs: ansible_test_sanit steps: - uses: actions/checkout@v4 From d330bdb6c708174309ed0b9c3b35c781fe68edb8 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 23 Dec 2024 20:50:31 +0530 Subject: [PATCH 30/36] run integration test --- .github/workflows/pull-request-management.yml | 105 ++++++++++-------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index d63e51dd17b..b945b8f82fc 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -499,7 +499,8 @@ jobs: id: pipcache with: python-version: | - 3.10 + 3.12 + 3.13 cache: 'pip' cache-latest: true @@ -544,25 +545,25 @@ jobs: name: pyavd-wheel path: ${{ env.WHEEL_FILE }} - download-dependencies: - runs-on: ubuntu-latest - needs: ansible_test_sanit + # download-dependencies: + # runs-on: ubuntu-latest + # needs: ansible_test_sanit - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: | - 3.10 - cache: 'pip' - cache-latest: true - - name: Download wheel artifact - uses: actions/download-artifact@v3 - with: - name: pyavd-wheel - path: ./artifacts + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # cache-latest: true + # - name: Download wheel artifact + # uses: actions/download-artifact@v3 + # with: + # name: pyavd-wheel + # path: ./artifacts # - name: Install the wheel file # run: | @@ -572,14 +573,14 @@ jobs: # # Install the wheel file # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - - name: 'Install Python requirements' - run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - - name: 'Run ansible-test units test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test units -vv + # - name: 'Install Python requirements' + # run: | + # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + # - name: 'Run ansible-test units test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv # - name: Print runner path # run: | # WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" @@ -629,28 +630,34 @@ jobs: # cd ansible_collections/arista/avd/ # ansible-test units -vv - # ansible_test_integration: - # name: Run ansible-test integration test cases - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.12 - # 3.13 - # cache: 'pip' - # cache-latest: true - # - name: 'Install Python requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: 'Run ansible-test integration test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test integration -vv + ansible_test_integration: + name: Run ansible-test integration test cases + runs-on: ubuntu-latest + needs: [ file-changes, ansible_test_sanit] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.12 + 3.13 + cache: 'pip' + cache-latest: true + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" --upgrade + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test integration -vv # ansible_lint: # name: Run ansible-lint test case From 78cb9060d0f5337d80620082073764c303e5b5e0 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 24 Dec 2024 18:13:01 +0530 Subject: [PATCH 31/36] test unit test job with ptyhon 3.12 --- .github/workflows/pull-request-management.yml | 112 +++++++++--------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index b945b8f82fc..d4ad7ab392c 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -488,7 +488,7 @@ jobs: # cd ansible_collections/arista/avd/ # ansible-test integration -vv - ansible_test_sanit: + ansible_test_sanity: name: Run ansible-test sanity validation runs-on: ubuntu-latest needs: [ file-changes ] @@ -500,7 +500,6 @@ jobs: with: python-version: | 3.12 - 3.13 cache: 'pip' cache-latest: true @@ -545,25 +544,24 @@ jobs: name: pyavd-wheel path: ${{ env.WHEEL_FILE }} - # download-dependencies: - # runs-on: ubuntu-latest - # needs: ansible_test_sanit - - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.10 - # cache: 'pip' - # cache-latest: true - # - name: Download wheel artifact - # uses: actions/download-artifact@v3 - # with: - # name: pyavd-wheel - # path: ./artifacts + ansible_unit_tests: + runs-on: ubuntu-latest + needs: ansible_test_sanity + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.12 + cache: 'pip' + cache-latest: true + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts # - name: Install the wheel file # run: | @@ -573,14 +571,14 @@ jobs: # # Install the wheel file # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - # - name: 'Install Python requirements' - # run: | - # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - # - name: 'Run ansible-test units test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test units -vv + - name: 'Install Python requirements' + run: | + pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + - name: 'Run ansible-test units test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test units -vv # - name: Print runner path # run: | # WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" @@ -630,34 +628,34 @@ jobs: # cd ansible_collections/arista/avd/ # ansible-test units -vv - ansible_test_integration: - name: Run ansible-test integration test cases - runs-on: ubuntu-latest - needs: [ file-changes, ansible_test_sanit] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - id: pipcache - with: - python-version: | - 3.12 - 3.13 - cache: 'pip' - cache-latest: true - - name: Download wheel artifact - uses: actions/download-artifact@v3 - with: - name: pyavd-wheel - path: ./artifacts - - name: 'Install Python requirements' - run: | - pip install "ansible-core<2.19.0" --upgrade - pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - - name: 'Run ansible-test integration test cases' - run: | - cd ansible_collections/arista/avd/ - ansible-test integration -vv + # ansible_test_integration: + # name: Run ansible-test integration test cases + # runs-on: ubuntu-latest + # needs: [ file-changes, ansible_test_sanity] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # id: pipcache + # with: + # python-version: | + # 3.12 + # 3.13 + # cache: 'pip' + # cache-latest: true + # - name: Download wheel artifact + # uses: actions/download-artifact@v3 + # with: + # name: pyavd-wheel + # path: ./artifacts + # - name: 'Install Python requirements' + # run: | + # pip install "ansible-core<2.19.0" --upgrade + # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + # - name: 'Run ansible-test integration test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test integration -vv # ansible_lint: # name: Run ansible-lint test case From a0e43d0d3803b18114b836335730fb4548ef8a7f Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 24 Dec 2024 18:40:45 +0530 Subject: [PATCH 32/36] test integration with ANSIBLE_TEST_PYTHON_VERSION --- .github/workflows/pull-request-management.yml | 56 +++++++++---------- .../arista/avd/plugins/__init__.py | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index d4ad7ab392c..0c4525aa9fc 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -628,34 +628,34 @@ jobs: # cd ansible_collections/arista/avd/ # ansible-test units -vv - # ansible_test_integration: - # name: Run ansible-test integration test cases - # runs-on: ubuntu-latest - # needs: [ file-changes, ansible_test_sanity] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.12 - # 3.13 - # cache: 'pip' - # cache-latest: true - # - name: Download wheel artifact - # uses: actions/download-artifact@v3 - # with: - # name: pyavd-wheel - # path: ./artifacts - # - name: 'Install Python requirements' - # run: | - # pip install "ansible-core<2.19.0" --upgrade - # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - # - name: 'Run ansible-test integration test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test integration -vv + ansible_test_integration: + name: Run ansible-test integration test cases + runs-on: ubuntu-latest + needs: [ file-changes, ansible_test_sanity] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + id: pipcache + with: + python-version: | + 3.12 + 3.13 + cache: 'pip' + cache-latest: true + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-test integration -vv # ansible_lint: # name: Run ansible-lint test case diff --git a/ansible_collections/arista/avd/plugins/__init__.py b/ansible_collections/arista/avd/plugins/__init__.py index 473eccb2bd4..f3082e16928 100644 --- a/ansible_collections/arista/avd/plugins/__init__.py +++ b/ansible_collections/arista/avd/plugins/__init__.py @@ -9,7 +9,7 @@ PYTHON_AVD_PATH = Path(__file__).parents[4] / "python-avd" RUNNING_FROM_SOURCE_PATH = PYTHON_AVD_PATH / "pyavd/running_from_src.txt" -RUNNING_FROM_SOURCE = RUNNING_FROM_SOURCE_PATH.exists() and not environ.get("AVD_NEVER_RUN_FROM_SOURCE") +RUNNING_FROM_SOURCE = RUNNING_FROM_SOURCE_PATH.exists() and not environ.get("ANSIBLE_TEST_PYTHON_VERSION") if RUNNING_FROM_SOURCE: import sys From 16239c19a98c23560e3306057cf9745ae8c6f62b Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 24 Dec 2024 18:54:55 +0530 Subject: [PATCH 33/36] updated artifacts in other jobs as well --- .github/workflows/pull-request-management.yml | 128 +++++++++--------- 1 file changed, 67 insertions(+), 61 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 0c4525aa9fc..6ca92bd1d23 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -657,41 +657,47 @@ jobs: cd ansible_collections/arista/avd/ ansible-test integration -vv - # ansible_lint: - # name: Run ansible-lint test case - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # 3.11 - # 3.12 - # 3.13 - # cache: 'pip' - # cache-latest: true - # - name: 'Install Python & Ansible requirements' - # run: | - # pip install -r .github/requirements-ci.txt -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + ansible_lint: + name: Run ansible-lint test case + runs-on: ubuntu-latest + needs: [ file-changes, ansible_test_sanity ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + cache: 'pip' + cache-latest: true + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts + - name: 'Install Python & Ansible requirements' + run: | + pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - # - name: Cache Ansible Galaxy Collections - # uses: actions/cache@v3 - # with: - # path: ~/.ansible/collections - # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - # restore-keys: | - # ansible-galaxy- + - name: Cache Ansible Galaxy Collections + uses: actions/cache@v3 + with: + path: ~/.ansible/collections + key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + restore-keys: | + ansible-galaxy- - # - name: Install Ansible Galaxy Collections - # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + - name: Install Ansible Galaxy Collections + run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # - name: 'Run ansible-test integration test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-lint --force-color --strict -v + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/avd/ + ansible-lint --force-color --strict -v # # ----------------------------------- # # # Galaxy Importer # # ----------------------------------- # @@ -745,32 +751,32 @@ jobs: # name: importer-logs # path: ./importer_result.json - # # ----------------------------------- # - # # Test of pyavd - # # ----------------------------------- # - # pyavd: - # name: Test pyavd - # runs-on: ubuntu-latest - # needs: [file-changes] - # if: | - # needs.file-changes.outputs.eos_design == 'true' || - # needs.file-changes.outputs.config_gen == 'true' || - # needs.file-changes.outputs.pyavd == 'true' - # strategy: - # matrix: - # python: ["3.10", "3.11", "3.12", "3.13"] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python }} - # cache: 'pip' - # cache-latest: true - # - name: 'Install tox' - # run: | - # pip install tox tox-gh-actions --upgrade - # - name: "Run pytest via tox for ${{ matrix.python }}" - # working-directory: python-avd - # run: | - # tox + # ----------------------------------- # + # Test of pyavd + # ----------------------------------- # + pyavd: + name: Test pyavd + runs-on: ubuntu-latest + needs: [file-changes] + if: | + needs.file-changes.outputs.eos_design == 'true' || + needs.file-changes.outputs.config_gen == 'true' || + needs.file-changes.outputs.pyavd == 'true' + strategy: + matrix: + python: ["3.10", "3.11", "3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + cache-latest: true + - name: 'Install tox' + run: | + pip install tox tox-gh-actions --upgrade + - name: "Run pytest via tox for ${{ matrix.python }}" + working-directory: python-avd + run: | + tox From d802c7c86fd9f9cbe057e800244b9d5c1ddc9b19 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 6 Jan 2025 15:59:34 +0530 Subject: [PATCH 34/36] changing python version in sanity job --- .github/workflows/pull-request-management.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 6ca92bd1d23..7f19f4311a1 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -499,9 +499,12 @@ jobs: id: pipcache with: python-version: | + 3.10 + 3.11 3.12 + 3.13 cache: 'pip' - cache-latest: true + check-latest: true - name: Install dependencies and capture wheel path run: | @@ -556,7 +559,7 @@ jobs: python-version: | 3.12 cache: 'pip' - cache-latest: true + check-latest: true - name: Download wheel artifact uses: actions/download-artifact@v3 with: @@ -619,7 +622,7 @@ jobs: # python-version: | # 3.10 # cache: 'pip' - # cache-latest: true + # check-latest: true # - name: 'Install Python requirements' # run: | # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -642,7 +645,7 @@ jobs: 3.12 3.13 cache: 'pip' - cache-latest: true + check-latest: true - name: Download wheel artifact uses: actions/download-artifact@v3 with: @@ -672,7 +675,7 @@ jobs: 3.12 3.13 cache: 'pip' - cache-latest: true + check-latest: true - name: Download wheel artifact uses: actions/download-artifact@v3 with: @@ -713,7 +716,7 @@ jobs: # python-version: | # 3.10 # cache: 'pip' - # cache-latest: true + # check-latest: true # - name: 'Install Python & Ansible requirements' # run: | # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade @@ -772,7 +775,7 @@ jobs: with: python-version: ${{ matrix.python }} cache: 'pip' - cache-latest: true + check-latest: true - name: 'Install tox' run: | pip install tox tox-gh-actions --upgrade From 2d5a49f5b830d0d6de081f8f3c1e0b4d5ae5ac82 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 6 Jan 2025 16:10:11 +0530 Subject: [PATCH 35/36] create separate job for install deoendencies --- .github/workflows/pull-request-management.yml | 97 +++++++------------ 1 file changed, 35 insertions(+), 62 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 7f19f4311a1..4b46ef36252 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -488,8 +488,8 @@ jobs: # cd ansible_collections/arista/avd/ # ansible-test integration -vv - ansible_test_sanity: - name: Run ansible-test sanity validation + install_dependencies: + name: Install dependencies runs-on: ubuntu-latest needs: [ file-changes ] steps: @@ -547,9 +547,39 @@ jobs: name: pyavd-wheel path: ${{ env.WHEEL_FILE }} + ansible_test_sanity: + name: Run ansible-test sanity validation + runs-on: ubuntu-latest + needs: [ file-changes, install_dependencies ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 + cache: 'pip' + check-latest: true + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" --upgrade + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl + - name: 'Run ansible-test sanity' + run: | + cd ansible_collections/arista/avd/ + ansible-test sanity --color yes -v + ansible_unit_tests: runs-on: ubuntu-latest - needs: ansible_test_sanity + needs: install_dependencies steps: - uses: actions/checkout@v4 - name: Set up Python 3 @@ -565,15 +595,6 @@ jobs: with: name: pyavd-wheel path: ./artifacts - - # - name: Install the wheel file - # run: | - # # Verify the downloaded artifact - # echo "Contents of artifacts directory:" - # ls -al ./artifacts - - # # Install the wheel file - # pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r ansible_collections/arista/avd/requirements-dev.txt --upgrade @@ -582,59 +603,11 @@ jobs: run: | cd ansible_collections/arista/avd/ ansible-test units -vv - # - name: Print runner path - # run: | - # WHEEL_CACHE_ROOT="$(pip cache dir)/wheels" - # echo "Wheel cache root: $WHEEL_CACHE_ROOT" - - # FULL_WHEEL_PATH=$(find "$WHEEL_CACHE_ROOT" -type d -mindepth 4 -maxdepth 4) - # if [ -z "$FULL_WHEEL_PATH" ]; then - # echo "No wheel files found." - # exit 1 - # fi - - # echo "Full wheel path: $FULL_WHEEL_PATH" - # echo "FULL_WHEEL_PATH=$FULL_WHEEL_PATH" >> $GITHUB_ENV - - # - name: Use the full pip wheel path - # run: | - # echo "Full wheel path from environment: $FULL_WHEEL_PATH" - # ls -l $FULL_WHEEL_PATH - # - name: 'Install Python requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - # - name: 'Run ansible-test sanity' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test sanity --color yes -v - - # ansible_test_units: - # name: Run ansible-test units test cases - # runs-on: ubuntu-latest - # needs: [ file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # id: pipcache - # with: - # python-version: | - # 3.10 - # cache: 'pip' - # check-latest: true - # - name: 'Install Python requirements' - # run: | - # pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: 'Run ansible-test units test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test units -vv ansible_test_integration: name: Run ansible-test integration test cases runs-on: ubuntu-latest - needs: [ file-changes, ansible_test_sanity] + needs: [ file-changes, install_dependencies] steps: - uses: actions/checkout@v4 - name: Set up Python 3 @@ -663,7 +636,7 @@ jobs: ansible_lint: name: Run ansible-lint test case runs-on: ubuntu-latest - needs: [ file-changes, ansible_test_sanity ] + needs: [ file-changes, install_dependencies ] steps: - uses: actions/checkout@v4 - name: Set up Python 3 From 4232886a2797947116d854fc31c1eb308488a369 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Mon, 6 Jan 2025 16:22:16 +0530 Subject: [PATCH 36/36] update galaxy-importer job --- .github/workflows/pull-request-management.yml | 264 ++++-------------- 1 file changed, 49 insertions(+), 215 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 4b46ef36252..924d3cc71eb 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -324,170 +324,6 @@ jobs: # Ansible tests # ----------------------------------- # - # python_requirements: - # name: Install and cache Python requirements - # runs-on: ubuntu-latest - # needs: [file-changes] - # if: needs.file-changes.outputs.requirements == 'true' - # strategy: - # fail-fast: true - # matrix: - # python_version: - # - "3.10" - # - "3.11" - # - "3.12" - # - "3.13" - # steps: - # - uses: actions/checkout@v4 - - # # Set up Python version - # - name: Set up Python ${{ matrix.python_version }} - # uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python_version }} - # cache: pip - - # # Restore cache for requirements-ci.txt - # - name: Restore cache for requirements-ci.txt - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} - - # # Restore cache for requirements-dev.txt - # - name: Restore cache for requirements-dev.txt - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles('ansible_collections/arista/avd/requirements-dev.txt') }}-${{ matrix.python_version }} - - # # Restore cache for ansible-core - # - name: Restore cache for ansible-core - # uses: actions/cache@v3 - # with: - # path: ~/.cache/ansible - # key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - - # - name: Install ansible requirements - # run: | - # pip install "ansible-core<2.19.0" --upgrade - - # # Install Python requirements (both requirements files) - # - name: Install Python requirements - # run: | - # pip install -r .github/requirements-ci.txt --upgrade - # pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - - # ansible_test_sanity: - # name: Run ansible-test sanity validation - # runs-on: ubuntu-latest - # needs: [python_requirements, file-changes] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # 3.11 - # 3.12 - # 3.13 - - # # - name: Restore cache for requirements-ci.txt - # # uses: actions/cache@v3 - # # with: - # # path: ~/.cache/pip - # # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} - # # restore-keys: | - # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 - # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.11 - # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 - # # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - - # # - name: Restore cache for ansible-core<2.19.0 - # # uses: actions/cache@v3 - # # with: - # # path: ~/.cache/ansible - # # key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - # # restore-keys: | - # # ${{ runner.os }}-pip-ansible-core-3.10 - # # ${{ runner.os }}-pip-ansible-core-3.11 - # # ${{ runner.os }}-pip-ansible-core-3.12 - # # ${{ runner.os }}-pip-ansible-core-3.13 - - # - name: 'Run ansible-test sanity' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test sanity --color yes -v - - # ansible_test_integration: - # name: Run ansible-test integration test cases - # runs-on: ubuntu-latest - # needs: [ python_requirements, file-changes ] - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3 - # uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.12 - # 3.13 - # - name: Restore cache for requirements-ci.txt - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - # restore-keys: | - # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.12 - # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - - # - name: Restore cache for ansible-core<2.19.0 - # uses: actions/cache@v3 - # with: - # path: ~/.cache/ansible - # key: ${{ runner.os }}-pip-ansible-core-3.13 - # restore-keys: | - # ${{ runner.os }}-pip-ansible-core-3.12 - # ${{ runner.os }}-pip-ansible-core-3.13 - - # # # Restore dependencies cache - # # - name: Restore dependencies cache - # # uses: actions/cache@v3 - # # with: - # # path: ~/.cache/pip - # # key: ${{ runner.os }}-pip-requirements-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} - # # restore-keys: | - # # ${{ runner.os }}-pip-requirements- - - # # Check dependencies without installation - # - name: Check Python requirements (dry-run) - # run: | - # pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade --dry-run - - # - name: Check ansible requirements (dry-run) - # run: | - # pip install --cache-dir ~/.cache/ansible -r ansible-core<2.19.0 --upgrade --dry-run - - # # Install dependencies if needed - # - name: Install Python requirements - # if: failure() # Runs only if the dry-run step fails - # run: | - # pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade - - # - name: Print pip list - # run: | - # echo "Installed Python packages for Python version ${{ matrix.python_version }}:" - # pip list - - # # - name: 'Install Python requirements' - # # run: | - # # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - # - name: 'Run ansible-test integration test cases' - # run: | - # cd ansible_collections/arista/avd/ - # ansible-test integration -vv - install_dependencies: name: Install dependencies runs-on: ubuntu-latest @@ -674,58 +510,56 @@ jobs: run: | cd ansible_collections/arista/avd/ ansible-lint --force-color --strict -v - # # ----------------------------------- # - # # Galaxy Importer - # # ----------------------------------- # - # galaxy_importer: - # name: Test galaxy-importer - # runs-on: ubuntu-20.04 # Older version to be compatible with old python - # env: - # GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-python@v5 - # with: - # python-version: | - # 3.10 - # cache: 'pip' - # check-latest: true - # - name: 'Install Python & Ansible requirements' - # run: | - # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - # - name: Cache Ansible Galaxy Collections - # uses: actions/cache@v3 - # with: - # path: ~/.ansible/collections - # key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} - # restore-keys: | - # ansible-galaxy- - # - name: Install Ansible Galaxy Collections - # run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - - # - name: Cache galaxy-importer - # id: cache-galaxy-importer - # uses: actions/cache@v3 - # with: - # path: ~/.cache/pip - # key: pip-galaxy-importer-${{ runner.os }}-galaxy-importer-0.4.25 - # restore-keys: | - # pip-galaxy-importer-${{ runner.os }}- + # ----------------------------------- # + # Galaxy Importer + # ----------------------------------- # + galaxy_importer: + name: Test galaxy-importer + runs-on: ubuntu-20.04 # Older version to be compatible with old python + needs: [ install_dependencies ] + env: + GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg + steps: + - uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + - uses: actions/checkout@v4 + - name: Download wheel artifact + uses: actions/download-artifact@v3 + with: + name: pyavd-wheel + path: ./artifacts + - name: 'Install Python & Ansible requirements' + run: | + pip install "ansible-core<2.19.0" --upgrade + pip install ./artifacts/pyavd-5.2.0.dev2-py3-none-any.whl - # - name: Install galaxy-importer - # # Install the specific version of galaxy-importer used on galaxy.ansible.com - # # The version conflicts with our requirements, - # # so we let the galaxy-importer version resolve remaining requirements. - # run: | - # pip install "galaxy-importer==0.4.25" - # - name: 'Build ansible package' - # run: make collection-build - # - name: 'Run galaxy-importer checks' - # run: python -m galaxy_importer.main *.tar.gz - # - uses: actions/upload-artifact@v4 - # with: - # name: importer-logs - # path: ./importer_result.json + - name: Cache Ansible Galaxy Collections + uses: actions/cache@v3 + with: + path: ~/.ansible/collections + key: ansible-galaxy-${{ hashFiles('ansible_collections/arista/avd/collections.yml') }} + restore-keys: | + ansible-galaxy- + + - name: Install Ansible Galaxy Collections + run: ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + + - name: Install galaxy-importer + # Install the specific version of galaxy-importer used on galaxy.ansible.com + # The version conflicts with our requirements, + # so we let the galaxy-importer version resolve remaining requirements. + run: | + pip install "galaxy-importer==0.4.26" + - name: 'Build ansible package' + run: make collection-build + - name: 'Run galaxy-importer checks' + run: python -m galaxy_importer.main *.tar.gz + - uses: actions/upload-artifact@v4 + with: + name: importer-logs + path: ./importer_result.json # ----------------------------------- # # Test of pyavd