From 2d3913db409ba75eeeb7bbabf01dae82d88efd9c Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 12:59:54 +0530 Subject: [PATCH 01/18] test separate cache job --- .github/workflows/pull-request-management.yml | 75 ++++++++++++++++--- 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index a7c6dd44601..a361b40f3ae 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -326,10 +326,32 @@ jobs: ansible_test_sanity: name: Run ansible-test sanity validation runs-on: ubuntu-latest - needs: [ file-changes ] + needs: [file-changes] steps: - uses: actions/checkout@v4 - - name: Set up Python 3 + + # Cache pip dependencies + - name: Cache pip dependencies + id: cache-pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('.github/requirements-ci.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + # Cache ansible-core dependencies + - 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- + + # Set up Python + - name: Set up Python uses: actions/setup-python@v5 with: python-version: | @@ -337,10 +359,16 @@ jobs: 3.11 3.12 3.13 - - name: 'Install Python requirements' + + # Install Python and Ansible dependencies if cache misses + - name: Install Python requirements + if: steps.cache-pip.outputs.cache-hit != 'true' || steps.cache-ansible.outputs.cache-hit != 'true' run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Run ansible-test sanity' + pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade + pip install --cache-dir ~/.cache/ansible-core "ansible-core<2.19.0" + + # Run ansible-test sanity + - name: Run ansible-test sanity run: | cd ansible_collections/arista/avd/ ansible-test sanity --color yes -v @@ -348,22 +376,47 @@ jobs: ansible_test_units: name: Run ansible-test units test cases runs-on: ubuntu-latest - needs: [ file-changes ] + needs: [file-changes] steps: + # Checkout repository - uses: actions/checkout@v4 + + # Cache Python dependencies + - name: Cache Python dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('.github/requirements-ci.txt') }}-${{ hashFiles('.github/requirements-extra.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + # Set up Python environment - name: Set up Python 3 uses: actions/setup-python@v5 with: - python-version: | - 3.10 - - name: 'Install Python requirements' + python-version: 3.10 + + # Install Python dependencies + - 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' + # Create a requirements file for additional dependencies + echo "mock" > .github/requirements-extra.txt + echo "pytest" >> .github/requirements-extra.txt + echo "pytest-mock" >> .github/requirements-extra.txt + echo "pytest-xdist" >> .github/requirements-extra.txt + echo "pyyaml" >> .github/requirements-extra.txt + echo "ansible-core<2.19.0" >> .github/requirements-extra.txt + + # Install all dependencies + pip install -r .github/requirements-ci.txt -r .github/requirements-extra.txt --upgrade + + # Run ansible-test units + - 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 From 73a2d41915caf76737bc2b47d37ebddc5869f454 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Tue, 3 Dec 2024 13:05:23 +0530 Subject: [PATCH 02/18] fix unit test --- .github/workflows/pull-request-management.yml | 607 +++++++++--------- 1 file changed, 304 insertions(+), 303 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index a361b40f3ae..803f9ea7097 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -115,210 +115,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 @@ -394,7 +394,8 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v5 with: - python-version: 3.10 + python-version: | + 3.10 # Install Python dependencies - name: Install Python requirements @@ -417,105 +418,105 @@ jobs: 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 - with: - python-version: | - 3.12 - 3.13 - - 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 + # with: + # python-version: | + # 3.12 + # 3.13 + # - 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 - - 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/setup-python@v5 - with: - python-version: | - 3.10 - - uses: actions/checkout@v4 - - 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_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 + # - 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/setup-python@v5 + # with: + # python-version: | + # 3.10 + # - uses: actions/checkout@v4 + # - 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 }} - - 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 }} + # - 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 79cb887e81b0dff46ae78a48e6c23c7191b57579 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Wed, 4 Dec 2024 18:43:15 +0530 Subject: [PATCH 03/18] single job for dependency --- .github/workflows/pull-request-management.yml | 265 ++++++++++++------ 1 file changed, 173 insertions(+), 92 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 803f9ea7097..a7bdf76d73a 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 @@ -320,55 +320,55 @@ jobs: # check_git: true # check_git_enforced: true - # ----------------------------------- # - # Ansible tests - # ----------------------------------- # - ansible_test_sanity: - name: Run ansible-test sanity validation + install_dependencies: + name: Install and cache dependencies runs-on: ubuntu-latest - needs: [file-changes] steps: - uses: actions/checkout@v4 - - # Cache pip dependencies - - name: Cache pip dependencies - id: cache-pip - uses: actions/cache@v3 + - name: Set up Python 3 + id: setup-python + uses: actions/setup-python@v5 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('.github/requirements-ci.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - # Cache ansible-core dependencies - - name: Cache ansible-core dependencies - id: cache-ansible + python-version: 3.13 + cache: 'pip' + - name: Cache dependencies uses: actions/cache@v3 with: - path: ~/.cache/ansible-core - key: ${{ runner.os }}-ansible-core-<2.19.0 + path: | + ~/.cache/pip + ~/.cache/ansible-core + key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-${{ steps.setup-python.outputs.python-version }} restore-keys: | - ${{ runner.os }}-ansible-core- + ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- + ${{ runner.os }}-dependencies- + - name: 'Install Python requirements' + run: | + pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + - name: 'Install Ansible collections' + run: | + ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml - # Set up Python - - name: Set up Python + 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 - - # Install Python and Ansible dependencies if cache misses - - name: Install Python requirements - if: steps.cache-pip.outputs.cache-hit != 'true' || steps.cache-ansible.outputs.cache-hit != 'true' - run: | - pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade - pip install --cache-dir ~/.cache/ansible-core "ansible-core<2.19.0" - - # Run ansible-test sanity - - name: Run ansible-test sanity + python-version: 3.13 + - name: Restore dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.cache/ansible-core + key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-3.13 + restore-keys: | + ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- + ${{ runner.os }}-dependencies- + - name: 'Run ansible-test sanity' run: | cd ansible_collections/arista/avd/ ansible-test sanity --color yes -v @@ -376,46 +376,127 @@ jobs: ansible_test_units: name: Run ansible-test units test cases runs-on: ubuntu-latest - needs: [file-changes] + needs: [file-changes, install_dependencies] steps: - # Checkout repository - uses: actions/checkout@v4 - - # Cache Python dependencies - - name: Cache Python dependencies - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('.github/requirements-ci.txt') }}-${{ hashFiles('.github/requirements-extra.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - # Set up Python environment - name: Set up Python 3 uses: actions/setup-python@v5 with: - python-version: | - 3.10 - - # Install Python dependencies - - name: Install Python requirements + python-version: 3.13 + cache: pip + - name: Restore dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.cache/ansible-core + key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-3.13 + restore-keys: | + ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- + ${{ runner.os }}-dependencies- + - name: Install additional requirements run: | - # Create a requirements file for additional dependencies - echo "mock" > .github/requirements-extra.txt - echo "pytest" >> .github/requirements-extra.txt - echo "pytest-mock" >> .github/requirements-extra.txt - echo "pytest-xdist" >> .github/requirements-extra.txt - echo "pyyaml" >> .github/requirements-extra.txt - echo "ansible-core<2.19.0" >> .github/requirements-extra.txt - - # Install all dependencies - pip install -r .github/requirements-ci.txt -r .github/requirements-extra.txt --upgrade - - # Run ansible-test units - - name: Run ansible-test units test cases + pip install mock pytest pytest-mock pytest-xdist pyyaml + - name: 'Run ansible-test units test cases' run: | cd ansible_collections/arista/avd/ ansible-test units -vv + # ----------------------------------- # + # Ansible tests + # ----------------------------------- # + # ansible_test_sanity: + # name: Run ansible-test sanity validation + # runs-on: ubuntu-latest + # needs: [file-changes] + # steps: + # - uses: actions/checkout@v4 + + # # Cache pip dependencies + # - name: Cache pip dependencies + # id: cache-pip + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-${{ hashFiles('.github/requirements-ci.txt') }} + # restore-keys: | + # ${{ runner.os }}-pip- + + # # Cache ansible-core dependencies + # - 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- + + # # Set up Python + # - name: Set up Python + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # 3.11 + # 3.12 + # 3.13 + + # # Install Python and Ansible dependencies if cache misses + # - name: Install Python requirements + # if: steps.cache-pip.outputs.cache-hit != 'true' || steps.cache-ansible.outputs.cache-hit != 'true' + # run: | + # pip install --cache-dir ~/.cache/pip -r .github/requirements-ci.txt --upgrade + # pip install --cache-dir ~/.cache/ansible-core "ansible-core<2.19.0" + + # # Run ansible-test sanity + # - 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: + # # Checkout repository + # - uses: actions/checkout@v4 + + # # Cache Python dependencies + # - name: Cache Python dependencies + # uses: actions/cache@v3 + # with: + # path: ~/.cache/pip + # key: ${{ runner.os }}-pip-${{ hashFiles('.github/requirements-ci.txt') }}-${{ hashFiles('.github/requirements-extra.txt') }} + # restore-keys: | + # ${{ runner.os }}-pip- + + # # Set up Python environment + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + + # # Install Python dependencies + # - name: Install Python requirements + # run: | + # # Create a requirements file for additional dependencies + # echo "mock" > .github/requirements-extra.txt + # echo "pytest" >> .github/requirements-extra.txt + # echo "pytest-mock" >> .github/requirements-extra.txt + # echo "pytest-xdist" >> .github/requirements-extra.txt + # echo "pyyaml" >> .github/requirements-extra.txt + # echo "ansible-core<2.19.0" >> .github/requirements-extra.txt + + # # Install all dependencies + # pip install -r .github/requirements-ci.txt -r .github/requirements-extra.txt --upgrade + + # # Run ansible-test units + # - name: Run ansible-test units test cases + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv # ansible_test_integration: From 6c0e6d781bc3cde3a144e0cad43b31fc263c1103 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Wed, 4 Dec 2024 19:24:36 +0530 Subject: [PATCH 04/18] add cache pip to sanity test --- .github/workflows/pull-request-management.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index a7bdf76d73a..0e6898892fe 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -357,7 +357,8 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: 3.13 + cache: pip - name: Restore dependencies uses: actions/cache@v3 with: From 060e59ab1e131a62c83a0780d527f5fee857fd2e Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 11:40:04 +0530 Subject: [PATCH 05/18] add python version to unit tests --- .github/workflows/pull-request-management.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 0e6898892fe..114b0afa86f 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -383,7 +383,11 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: | + 3.10 + 3.11 + 3.12 + 3.13 cache: pip - name: Restore dependencies uses: actions/cache@v3 From ef689e9e7f3e7c61a60a27c4640e6b449a14c37f Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 11:58:10 +0530 Subject: [PATCH 06/18] changing python version to 3.10 --- .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 114b0afa86f..dd1fd2a296b 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -329,7 +329,8 @@ jobs: id: setup-python uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: | + 3.10 cache: 'pip' - name: Cache dependencies uses: actions/cache@v3 @@ -357,7 +358,8 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: | + 3.10 cache: pip - name: Restore dependencies uses: actions/cache@v3 @@ -385,9 +387,6 @@ jobs: with: python-version: | 3.10 - 3.11 - 3.12 - 3.13 cache: pip - name: Restore dependencies uses: actions/cache@v3 From 9401420b5541623e217fc12a97aa8e2a3a899371 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 13:24:13 +0530 Subject: [PATCH 07/18] caching for different python versions --- .github/workflows/pull-request-management.yml | 195 ++++++++++++++---- 1 file changed, 157 insertions(+), 38 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index dd1fd2a296b..140c348edec 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -320,39 +320,71 @@ jobs: # check_git: true # check_git_enforced: true - install_dependencies: - name: Install and cache dependencies + 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: Set up Python 3 - id: setup-python + + # Set up Python version + - name: Set up Python ${{ matrix.python_version }} uses: actions/setup-python@v5 with: - python-version: | - 3.10 - cache: 'pip' - - name: Cache dependencies + 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 - ~/.cache/ansible-core - key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-${{ steps.setup-python.outputs.python-version }} + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} restore-keys: | - ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- - ${{ runner.os }}-dependencies- - - name: 'Install Python requirements' + ${{ runner.os }}-pip-requirements-ci-${{ 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-keys: | + ${{ runner.os }}-pip-requirements-dev-${{ matrix.python_version }}- + + # Install Python requirements (both requirements files) + - name: Install Python requirements run: | pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade - - name: 'Install Ansible collections' - run: | - ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade + + # Save cache for requirements-ci.txt + - name: Save 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 }} + + # Save cache for requirements-dev.txt + - name: Save 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 }} ansible_test_sanity: name: Run ansible-test sanity validation runs-on: ubuntu-latest - needs: [file-changes, install_dependencies] + needs: [python_requirements, file-changes] steps: - uses: actions/checkout@v4 - name: Set up Python 3 @@ -360,17 +392,22 @@ jobs: with: python-version: | 3.10 - cache: pip - - name: Restore dependencies + 3.11 + 3.12 + 3.13 + - name: Restore cache for requirements-ci.txt uses: actions/cache@v3 with: - path: | - ~/.cache/pip - ~/.cache/ansible-core - key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-3.13 + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} restore-keys: | - ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- - ${{ runner.os }}-dependencies- + ${{ 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: '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/ @@ -379,7 +416,7 @@ jobs: ansible_test_units: name: Run ansible-test units test cases runs-on: ubuntu-latest - needs: [file-changes, install_dependencies] + needs: [python_requirements, file-changes] steps: - uses: actions/checkout@v4 - name: Set up Python 3 @@ -387,24 +424,106 @@ jobs: with: python-version: | 3.10 - cache: pip - - name: Restore dependencies + - name: Restore cache for requirements-ci.txt uses: actions/cache@v3 with: - path: | - ~/.cache/pip - ~/.cache/ansible-core - key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-3.13 + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 restore-keys: | - ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- - ${{ runner.os }}-dependencies- - - name: Install additional requirements + ${{ runner.os }}-pip-requirements-ci-3.10- + - name: 'Install Python requirements' run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml + 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 + + # install_dependencies: + # name: Install and cache dependencies + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # id: setup-python + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # cache: 'pip' + # - name: Cache dependencies + # uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/pip + # ~/.cache/ansible-core + # key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-${{ steps.setup-python.outputs.python-version }} + # restore-keys: | + # ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- + # ${{ runner.os }}-dependencies- + # - name: 'Install Python requirements' + # run: | + # pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + # - name: 'Install Ansible collections' + # run: | + # ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml + + # 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 + # cache: pip + # - name: Restore dependencies + # uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/pip + # ~/.cache/ansible-core + # key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-3.13 + # restore-keys: | + # ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- + # ${{ runner.os }}-dependencies- + # - 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, install_dependencies] + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3 + # uses: actions/setup-python@v5 + # with: + # python-version: | + # 3.10 + # cache: pip + # - name: Restore dependencies + # uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/pip + # ~/.cache/ansible-core + # key: ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible-3.13 + # restore-keys: | + # ${{ runner.os }}-dependencies-${{ hashFiles('.github/requirements-ci.txt') }}-ansible- + # ${{ runner.os }}-dependencies- + # - name: Install additional requirements + # run: | + # pip install mock pytest pytest-mock pytest-xdist pyyaml + # - name: 'Run ansible-test units test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv # ----------------------------------- # # Ansible tests # ----------------------------------- # From b4af63758a753a9fa803ab93d2b0a842841a21e8 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 13:30:06 +0530 Subject: [PATCH 08/18] remove save/restore cache job --- .github/workflows/pull-request-management.yml | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 140c348edec..8ce16e55b9b 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -349,8 +349,6 @@ jobs: 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-${{ matrix.python_version }}- # Restore cache for requirements-dev.txt - name: Restore cache for requirements-dev.txt @@ -358,8 +356,6 @@ jobs: with: path: ~/.cache/pip key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles('ansible_collections/arista/avd/requirements-dev.txt') }}-${{ matrix.python_version }} - restore-keys: | - ${{ runner.os }}-pip-requirements-dev-${{ matrix.python_version }}- # Install Python requirements (both requirements files) - name: Install Python requirements @@ -367,19 +363,19 @@ jobs: pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade - # Save cache for requirements-ci.txt - - name: Save 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 }} - - # Save cache for requirements-dev.txt - - name: Save 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 }} + # # Save cache for requirements-ci.txt + # - name: Save 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 }} + + # # Save cache for requirements-dev.txt + # - name: Save 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 }} ansible_test_sanity: name: Run ansible-test sanity validation From 7ba2a8e91ee276f5ccd36d2c84eaa58673d8442f Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 13:36:46 +0530 Subject: [PATCH 09/18] remove requirements-ci from install --- .github/workflows/pull-request-management.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 8ce16e55b9b..624ea37a8a4 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -403,7 +403,7 @@ jobs: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 - name: 'Install Python requirements' run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + pip install "ansible-core<2.19.0" --upgrade - name: 'Run ansible-test sanity' run: | cd ansible_collections/arista/avd/ @@ -429,7 +429,7 @@ jobs: ${{ runner.os }}-pip-requirements-ci-3.10- - 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 + pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" --upgrade - name: 'Run ansible-test units test cases' run: | cd ansible_collections/arista/avd/ From 4169557441a017e6050da206dc810a993a22bcb9 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 15:17:45 +0530 Subject: [PATCH 10/18] update restore key for unit tests --- .github/workflows/pull-request-management.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 624ea37a8a4..bfed47b3eb7 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -424,9 +424,12 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} restore-keys: | - ${{ runner.os }}-pip-requirements-ci-3.10- + ${{ 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: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" --upgrade From 1e72c924edddf44c1dac4ee8e35fb746c1bdbd89 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 15:31:01 +0530 Subject: [PATCH 11/18] update restore key for unit tests --- .github/workflows/pull-request-management.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index bfed47b3eb7..982a90270b4 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -424,12 +424,9 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 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: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.19.0" --upgrade From 75535af72d5f62271bdb45502851751b4bfacef0 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 15:35:06 +0530 Subject: [PATCH 12/18] update unit test --- .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 982a90270b4..5bb372634ca 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -429,7 +429,7 @@ jobs: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 - 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 '.github/requirements-ci.txt' --upgrade - name: 'Run ansible-test units test cases' run: | cd ansible_collections/arista/avd/ From 2ed1ac055771c123733f625f021d6fdf44434a7d Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 16:02:28 +0530 Subject: [PATCH 13/18] update restore keys for ansible-core --- .github/workflows/pull-request-management.yml | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 5bb372634ca..e514c2df822 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -357,10 +357,21 @@ jobs: 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<2.19.0 + - name: Restore cache for ansible-core + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles("ansible-core<2.19.0") }}-${{ matrix.python_version }} + + - name: Install ansible requirements + run: | + pip install -r "ansible-core<2.19.0" --upgrade + # Install Python requirements (both requirements files) - name: Install Python requirements run: | - pip install "ansible-core<2.19.0" -r .github/requirements-ci.txt --upgrade + pip install -r .github/requirements-ci.txt --upgrade pip install -r ansible_collections/arista/avd/requirements-dev.txt --upgrade # # Save cache for requirements-ci.txt @@ -391,6 +402,7 @@ jobs: 3.11 3.12 3.13 + - name: Restore cache for requirements-ci.txt uses: actions/cache@v3 with: @@ -401,9 +413,18 @@ jobs: ${{ 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: 'Install Python requirements' - run: | - pip install "ansible-core<2.19.0" --upgrade + + - name: Restore cache for ansible-core<2.19.0 + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-${{ matrix.python_version }} + restore-keys: | + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.10 + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.11 + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.12 + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.13 + - name: 'Run ansible-test sanity' run: | cd ansible_collections/arista/avd/ @@ -427,9 +448,17 @@ jobs: key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 restore-keys: | ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 + + - name: Restore cache for ansible-core<2.19.0 + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.10 + restore-keys: | + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.10 - 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 + pip install mock pytest pytest-mock pytest-xdist pyyaml --upgrade - name: 'Run ansible-test units test cases' run: | cd ansible_collections/arista/avd/ From ab9c0d108a1de89cf0b64735fbfd5a3a080bf756 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 16:19:21 +0530 Subject: [PATCH 14/18] add ansible dependency cache --- .github/workflows/pull-request-management.yml | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index e514c2df822..061016a15d7 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -357,16 +357,16 @@ jobs: 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<2.19.0 + # Restore cache for ansible-core - name: Restore cache for ansible-core uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-dev-${{ hashFiles("ansible-core<2.19.0") }}-${{ matrix.python_version }} + path: ~/.cache/ansible + key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - name: Install ansible requirements run: | - pip install -r "ansible-core<2.19.0" --upgrade + pip install "ansible-core<2.19.0" --upgrade # Install Python requirements (both requirements files) - name: Install Python requirements @@ -417,13 +417,13 @@ jobs: - name: Restore cache for ansible-core<2.19.0 uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-${{ matrix.python_version }} + path: ~/.cache/ansible + key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} restore-keys: | - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.10 - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.11 - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.12 - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.13 + ${{ 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: | @@ -452,10 +452,11 @@ jobs: - name: Restore cache for ansible-core<2.19.0 uses: actions/cache@v3 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.10 + path: ~/.cache/ansible + key: ${{ runner.os }}-pip-ansible-core-3.10 restore-keys: | - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('ansible-core<2.19.0') }}-3.10 + ${{ runner.os }}-pip-ansible-core-3.10 + - name: 'Install Python requirements' run: | pip install mock pytest pytest-mock pytest-xdist pyyaml --upgrade From b04b7c48dd6c170240303f8fc2a661d9a54d5ab9 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 17:15:27 +0530 Subject: [PATCH 15/18] Add ansible_test_integration cache --- .github/workflows/pull-request-management.yml | 121 ++++++++++-------- 1 file changed, 70 insertions(+), 51 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 061016a15d7..f11a2fe5a9c 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -430,40 +430,41 @@ jobs: 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: [python_requirements, file-changes] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: | - 3.10 - - 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.10 - restore-keys: | - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 + # ansible_test_units: + # name: Run ansible-test units 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.10 + # - 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.10 + # restore-keys: | + # ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.10 - - name: Restore cache for ansible-core<2.19.0 - uses: actions/cache@v3 - with: - path: ~/.cache/ansible - key: ${{ runner.os }}-pip-ansible-core-3.10 - restore-keys: | - ${{ runner.os }}-pip-ansible-core-3.10 + # - name: Restore cache for ansible-core<2.19.0 + # uses: actions/cache@v3 + # with: + # path: ~/.cache/ansible + # key: ${{ runner.os }}-pip-ansible-core-3.10 + # restore-keys: | + # ${{ runner.os }}-pip-ansible-core-3.10 - - name: 'Install Python requirements' - run: | - pip install mock pytest pytest-mock pytest-xdist pyyaml --upgrade - - 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 --upgrade + + # - name: 'Run ansible-test units test cases' + # run: | + # cd ansible_collections/arista/avd/ + # ansible-test units -vv # install_dependencies: # name: Install and cache dependencies @@ -648,25 +649,43 @@ jobs: # 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 - # with: - # python-version: | - # 3.12 - # 3.13 - # - 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: [ 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') }}-${{ matrix.python_version }} + 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-${{ matrix.python_version }} + restore-keys: | + ${{ runner.os }}-pip-ansible-core-3.12 + ${{ runner.os }}-pip-ansible-core-3.13 + + # - 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 From 1ec6dbd94eb51494f15a5a796069eb6d2cdca9fe Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 17:32:25 +0530 Subject: [PATCH 16/18] print pip list --- .github/workflows/pull-request-management.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index f11a2fe5a9c..856a79e5e91 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -665,7 +665,7 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-${{ matrix.python_version }} + 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 @@ -674,11 +674,15 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/ansible - key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} + key: ${{ runner.os }}-pip-ansible-core-3.13 restore-keys: | ${{ runner.os }}-pip-ansible-core-3.12 ${{ runner.os }}-pip-ansible-core-3.13 + - 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 From 0e6700d0fe5d920c87cad189f601de3410500b63 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 6 Dec 2024 17:36:36 +0530 Subject: [PATCH 17/18] print pip list --- .github/workflows/pull-request-management.yml | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 856a79e5e91..4d2b0a53a91 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -403,27 +403,27 @@ jobs: 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 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: 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: | @@ -683,9 +683,11 @@ jobs: 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/ From 29178d7700224da0a8ef2802d698c35f434b387f Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Sun, 8 Dec 2024 15:00:20 +0530 Subject: [PATCH 18/18] using matrix.python_version while restoring cache --- .github/workflows/pull-request-management.yml | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 4d2b0a53a91..37627303fcd 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -403,27 +403,21 @@ jobs: 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 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') }}-${{ matrix.python_version }} - # - 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: 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-${{ matrix.python_version }} - name: 'Run ansible-test sanity' run: | @@ -665,19 +659,17 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + 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.12 - ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}-3.13 + ${{ runner.os }}-pip-requirements-ci-${{ hashFiles('.github/requirements-ci.txt') }}${{ matrix.python_version }} - 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 + key: ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} restore-keys: | - ${{ runner.os }}-pip-ansible-core-3.12 - ${{ runner.os }}-pip-ansible-core-3.13 + ${{ runner.os }}-pip-ansible-core-${{ matrix.python_version }} - name: Print pip list run: |