Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cd0cbd2
fix: add codecove
Revathyvenugopal162 Sep 17, 2025
e17ab22
fix: add codecov secrets
Revathyvenugopal162 Sep 17, 2025
64513b5
fix: combine coverage
Revathyvenugopal162 Sep 18, 2025
f1083cc
fix: combine coverage
Revathyvenugopal162 Sep 18, 2025
b934919
fix: cicd
Revathyvenugopal162 Sep 18, 2025
d13f88d
chore: adding changelog file 909.added.md [dependabot-skip]
pyansys-ci-bot Sep 18, 2025
a2093d0
fix: comment preline now
Revathyvenugopal162 Sep 18, 2025
cde942e
Merge branch 'feat/codecov' of https://github.com/ansys/pydyna into f…
Revathyvenugopal162 Sep 18, 2025
09a23fb
fix: update the python
Revathyvenugopal162 Sep 18, 2025
bf24bda
fix: update the python
Revathyvenugopal162 Sep 18, 2025
608f277
fix: update the image
Revathyvenugopal162 Sep 18, 2025
8657c42
fix: update the actions
Revathyvenugopal162 Sep 18, 2025
5e129d5
fix: update the actions
Revathyvenugopal162 Sep 18, 2025
60f143a
fix: update the cicd
Revathyvenugopal162 Sep 18, 2025
4698cf2
fix: update the cicd
Revathyvenugopal162 Sep 18, 2025
0af52f0
fix: update the cicd
Revathyvenugopal162 Sep 18, 2025
c8650b0
fix: update the cicd for keyword matrix
Revathyvenugopal162 Sep 18, 2025
99c9c05
fix: update the cicd for keyword matrix
Revathyvenugopal162 Sep 18, 2025
c86bb99
fix: update the cicd for keyword matrix
Revathyvenugopal162 Sep 18, 2025
7b3151a
fix: update the cicd for al tests
Revathyvenugopal162 Sep 18, 2025
2a30856
Merge branch 'main' into feat/codecov
Revathyvenugopal162 Sep 18, 2025
670caf0
fix: test viz
Revathyvenugopal162 Sep 19, 2025
5b73796
fix: coverage results
Revathyvenugopal162 Sep 19, 2025
8d72371
fix: test early
Revathyvenugopal162 Sep 19, 2025
671272f
fix: test early
Revathyvenugopal162 Sep 19, 2025
f163bfb
fix: test early
Revathyvenugopal162 Sep 19, 2025
a61671d
fix: coverage files
Revathyvenugopal162 Sep 19, 2025
19b6970
fix: coverage files
Revathyvenugopal162 Sep 19, 2025
7e894d1
fix: coverage files
Revathyvenugopal162 Sep 19, 2025
7cffe17
fix: coverage files
Revathyvenugopal162 Sep 19, 2025
e5705ed
fix: coverage files and results
Revathyvenugopal162 Sep 19, 2025
af1ff53
fix: coverage files and results
Revathyvenugopal162 Sep 19, 2025
4c626a5
fix: coverage files and results
Revathyvenugopal162 Sep 19, 2025
fcfc2ef
fix: coverage files without keywords
Revathyvenugopal162 Sep 19, 2025
09f1956
fix: coverage files without keywords
Revathyvenugopal162 Sep 19, 2025
75d5706
fix: coverage files without keywords
Revathyvenugopal162 Sep 19, 2025
9e5b6f9
fix: coverage files without keywords
Revathyvenugopal162 Sep 19, 2025
c1589b0
fix: coverage files without keywords
Revathyvenugopal162 Sep 19, 2025
92bd673
fix: coverage files
Revathyvenugopal162 Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions .github/actions/unit-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ inputs:
default: ""
type: string

codecov-token:
description: Token for Codecov upload
required: false
default: ""
type: string

coverage-file:
description: Coverage file path
required: false
default: ""
type: string

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -71,11 +83,11 @@ runs:

- name: Run pytest
run: |
if [ "${{ inputs.pytest-markers }}" = "" ]; then
pytest
else
pytest -m "${{ inputs.pytest-markers }}"
fi
if [ "${{ inputs.pytest-markers }}" = "" ]; then
export COVERAGE_FILE=.cov/${{ inputs.coverage-file }} && pytest --cov --cov-report=xml:.cov/xml --cov-report=html:.cov/html
else
export COVERAGE_FILE=.cov/${{ inputs.coverage-file }} && pytest -m "${{ inputs.pytest-markers }}" --cov --cov-report=xml:.cov/xml --cov-report=html:.cov/html
fi
shell: bash
env:
PYDYNA_RUN_CONTAINER: ${{ inputs.docker-image }}
Expand All @@ -96,10 +108,16 @@ runs:
name: server_output_tests.txt
path: server_output.txt

- name: Upload coverage results
if: ${{ inputs.server-logs == 'true' }}
- name: Upload coverage files
if: ${{ inputs.coverage-file }}
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: .cov/html
retention-days: 7
name: coverage-${{ inputs.coverage-file }}-${{ inputs.python-version }}
path: coverage.xml

- name: Stop container
if: ${{ inputs.docker-image != '' && inputs.pytest-markers != 'keywords' }}
run: |
docker stop kw_server
docker rm kw_server
shell: bash
85 changes: 64 additions & 21 deletions .github/workflows/ci_cd_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
PACKAGE_NAMESPACE: 'ansys.dyna.core'
DOCUMENTATION_CNAME: "dyna.docs.pyansys.com"
PYDYNA_RUN_CONTAINER: ${{ github.event.inputs.PyDynaRunContainer || 'ghcr.io/ansys/pydyna-run:latest'}}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -148,12 +149,32 @@ jobs:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}


keyword-testing:
name: "Keyword testing for matrix"
# needs: [smoke-tests]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Run test with "keywords" marker
uses: ./.github/actions/unit-test
with:
python-version: ${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
pytest-markers: keywords
coverage-file: keywords

run-testing:
name: Test the "run" subpackage
runs-on: ubuntu-latest
needs: [smoke-tests]
# needs: [smoke-tests]

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand All @@ -166,36 +187,58 @@ jobs:
docker-image: ${{ env.PYDYNA_RUN_CONTAINER }}
pytest-markers: run
license-server: ${{ secrets.LICENSE_SERVER }}

keyword-testing:
name: "Keyword testing"
runs-on: ${{ matrix.os }}
needs: [smoke-tests]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- uses: ./.github/actions/unit-test
with:
python-version: ${{ matrix.python-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
pytest-markers: keywords
coverage-file: run

unit-tests:
name: "Testing"
runs-on: ubuntu-latest
needs: [run-testing, keyword-testing]
# needs: [keyword-testing, run-testing, codegen-testing]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: ./.github/actions/unit-test
- name: Run test without marker
uses: ./.github/actions/unit-test
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
server-logs: true
codecov-token: ${{ secrets.CODECOV_TOKEN }}
coverage-file: unittests

upload-coverage:
name: "Combine coverage"
runs-on: ubuntu-latest
needs: [run-testing, unit-tests]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Download coverage files
uses: actions/download-artifact@v4
with:
pattern: "coverage-*"
path: .cov

- name: Combine coverage files
run: |
ls -la
pip install coverage codecov
coverage combine .cov/*/coverage.xml
coverage xml -o .cov/coverage.xml
coverage html -d .cov/html
codecov -f .cov/coverage.xml -t ${{ env.CODECOV_TOKEN }} || echo "Codecov did not collect coverage reports"

- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: .cov/html
retention-days: 7

- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
env:
CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }}
with:
files: .cov/xml

build-library:
name: "Build library"
Expand Down
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage:
range: 75..100
round: down
precision: 2
status:
project:
default:
target: 90%
patch: off


codecov:
notify:
wait_for_ci: yes
1 change: 1 addition & 0 deletions doc/changelog/909.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add coverage
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,17 @@ src_paths = ["doc", "src", "tests"]

[tool.coverage.run]
source = ["ansys.dyna.core"]
omit = [
"src/ansys/dyna/core/keywords/keyword_classes/auto/*"
]

[tool.coverage.report]
show_missing = true


[tool.pytest.ini_options]
minversion = "7.1"
addopts = "-ra --cov=ansys.dyna.core --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv"
addopts = "-ra --cov=ansys.dyna.core"
testpaths = ["tests"]
markers = """
run: tests that exercise the `run` subpackage
Expand Down
Loading