diff options
author | Gaige B Paulsen <gaige@cluetrust.com> | 2025-01-25 12:03:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-25 12:03:03 -0500 |
commit | f6121663c8d945747107a63b85b9416da9ab6ddc (patch) | |
tree | 44de93cf1ad67fd50593248fde42764fa7e95bfd | |
parent | bda4131c76197aa7b6b23ef6c2d17359b81d5c5a (diff) | |
download | vyos.vyos-f6121663c8d945747107a63b85b9416da9ab6ddc.tar.gz vyos.vyos-f6121663c8d945747107a63b85b9416da9ab6ddc.zip |
fix: branch codecoverage
-rw-r--r-- | .github/workflows/codecoverage.yml | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml index 458878cd..fad42e6c 100644 --- a/.github/workflows/codecoverage.yml +++ b/.github/workflows/codecoverage.yml @@ -5,12 +5,82 @@ on: # yamllint disable-line rule:truthy push: pull_request: branches: [main] +#jobs: +# codecoverage: +# uses: ansible-network/github_actions/.github/workflows/coverage_network_devices.yml@main +# with: +# collection_pre_install: >- +# git+https://github.com/ansible-collections/ansible.utils.git +# git+https://github.com/ansible-collections/ansible.netcommon.git +# secrets: +# token: ${{ secrets.CODECOV_TOKEN }} +# +#name: CodeCoverage +#on: +# workflow_call: +# inputs: +# collection_pre_install: +# required: true +# type: string + jobs: codecoverage: - uses: ansible-network/github_actions/.github/workflows/coverage_network_devices.yml@main - with: + env: + PY_COLORS: "1" + source_directory: "./source" + python_version: "3.10" + ansible_version: "latest" + os: "ubuntu-latest" collection_pre_install: >- git+https://github.com/ansible-collections/ansible.utils.git git+https://github.com/ansible-collections/ansible.netcommon.git - secrets: - token: ${{ secrets.CODECOV_TOKEN }} + runs-on: ubuntu-latest + name: "Code Coverage | Python 3.10" + steps: + - name: Checkout the collection repository + uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + with: + path: ${{ env.source_directory }} + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: "0" + + - name: Set up Python ${{ env.python_version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ env.python_version }} + + - name: Install ansible-core (${{ env.ansible-version }}) + run: python3 -m pip install ansible-core pytest pytest-cov pytest-ansible-units pytest-forked pytest-xdist + + - name: Read collection metadata from galaxy.yml + id: identify + uses: ansible-network/github_actions/.github/actions/identify_collection@main + with: + source_path: ${{ env.source_directory }} + + - name: Build and install the collection + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.source_directory }} + collection_path: ${{ steps.identify.outputs.collection_path }} + tar_file: ${{ steps.identify.outputs.tar_file }} + + - name: Print the ansible version + run: ansible --version + + - name: Print the python dependencies + run: python3 -m pip list + + - name: Run Coverage tests + run: | + pytest tests/unit -v --cov-report xml --cov=./ + working-directory: ${{ steps.identify.outputs.collection_path }} + + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v3 + with: + directory: ${{ steps.identify.outputs.collection_path }} + fail_ci_if_error: false + secrets: + token: ${{ secrets.CODECOV_TOKEN }} |