From 9c7d104b55b77978c2b152199c021dc1d80064ba Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Fri, 5 Apr 2024 12:43:05 -0500 Subject: [PATCH 1/5] modify test --- .github/workflows/ci_cd.yml | 65 ++++++++++++++++++++++++++----------- pyproject.toml | 2 +- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 6588764cd..2fcabef4e 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -129,14 +129,17 @@ jobs: echo "matrix={\"mechanical-version\":['${{ needs.revn-variations.outputs.test_docker_image_version }}'],\"experimental\":[false]}" >> $GITHUB_OUTPUT fi - tests: - name: Testing and coverage - Mechanical ${{ matrix.mechanical-version }} + remote-connect: + name: Remote connect test and coverage - Mechanical ${{ matrix.mech-version.mechanical-version }} runs-on: public-ubuntu-latest-8-cores needs: [smoke-tests, revn-variations, config-matrix] - continue-on-error: ${{ matrix.experimental }} + continue-on-error: ${{ matrix.mech-version.experimental }} strategy: fail-fast: false - matrix: ${{ fromJSON(needs.config-matrix.outputs.matrix) }} + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + mech-version: ${{ fromJSON(needs.config-matrix.outputs.matrix) }} + steps: - name: Login in Github Container registry uses: docker/login-action@v3 @@ -148,23 +151,47 @@ jobs: - name: Pull, launch, and validate Mechanical service env: LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mechanical-version }} + MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mech-version.mechanical-version }} run: | docker pull ${{ env.MECHANICAL_IMAGE }} docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ env.MECHANICAL_IMAGE }} > log.txt & grep -q 'WB Initialize Done' <(timeout 60 tail -f log.txt) - - name: Testing - uses: ansys/actions/tests-pytest@v5 + - uses: actions/checkout@v4 + + - name: "Set up Python" + uses: ansys/actions/_setup-python@v5.1 with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} + python-version: ${{ matrix.python-version }} + use-cache: ${{ matrix.python-version }} + + - name: Create and activate virtual environment + run: | + python -m venv venv + . .venv/bin/activate + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[tests] + + - name: Remote connect test + run: | + pytest -m remote_session_connect -s --junitxml remote_results${{ matrix.python-version }}.xml --cov=ansys.mechanical --cov-report html:.cov/html|| true - # - name: Upload coverage to Codecov - # uses: codecov/codecov-action@v3 + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() + with: + report_paths: '**/remote_results*.xml' + check_name: Remote Connect Report ${{ matrix.python-version }} + detailed_summary: true + include_passed: true + fail_on_failure: true - name: Upload coverage results uses: actions/upload-artifact@v4 - if: matrix.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION + if: matrix.mech-version.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION with: name: coverage-tests path: .cov @@ -172,7 +199,7 @@ jobs: - name: Upload coverage results (as .coverage) uses: actions/upload-artifact@v4 - if: matrix.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION + if: matrix.mech-version.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION with: name: coverage-file-tests @@ -182,17 +209,17 @@ jobs: - name: Get Mechanical container logs if: always() run: | - docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_tests_log-${{ matrix.mechanical-version }}.txt 2>&1 + docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_tests_log-${{ matrix.mech-version.mechanical-version }}.txt 2>&1 echo CONTAINER LOGS OUTPUT - cat mechanical_tests_log-${{ matrix.mechanical-version }}.txt + cat mechanical_tests_log-${{ matrix.mech-version.mechanical-version }}.txt echo CPU info lscpu - name: Upload container logs uses: actions/upload-artifact@v4 with: - name: mechanical_tests_log-${{ matrix.mechanical-version }} - path: mechanical_tests_log-${{ matrix.mechanical-version }}.txt + name: mechanical_tests_log-${{ matrix.mech-version.mechanical-version }} + path: mechanical_tests_log-${{ matrix.mech-version.mechanical-version }}.txt retention-days: 7 embedding-tests: @@ -241,7 +268,7 @@ jobs: PYTHONUNBUFFERED: 1 run: | . /env/bin/activate - xvfb-run mechanical-env pytest -m embedding -s --junitxml test_results${{ matrix.python-version }}.xml || true + xvfb-run mechanical-env pytest -m embedding -s --junitxml test_results${{ matrix.python-version }}.xml --cov=ansys.mechanical --cov-report html:.cov/html|| true - name: Upload coverage results uses: actions/upload-artifact@v4 @@ -443,7 +470,7 @@ jobs: coverage: name: Merging coverage - needs: [tests, embedding-tests, launch-tests] + needs: [remote-connect, embedding-tests, launch-tests] runs-on: ubuntu-latest steps: - name: Checkout repository @@ -520,7 +547,7 @@ jobs: package: name: Package library - needs: [tests, embedding-tests, doc-build] + needs: [remote-connect, embedding-tests, doc-build] runs-on: ubuntu-latest steps: - name: Build library source and wheel artifacts diff --git a/pyproject.toml b/pyproject.toml index 11f68d746..34f6e5ec9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,7 +116,7 @@ output = ".cov/coverage.xml" [tool.pytest.ini_options] minversion = "7.1" -addopts = """-ra -s -m remote_session_connect --durations=0 --cov=ansys.mechanical --cov-report html:.cov/html \ +addopts = """-ra -s --durations=0 --cov=ansys.mechanical --cov-report html:.cov/html \ --cov-report xml:.cov/xml --cov-report term -vv --print --print-relative-time""" # addopts = """-ra -s -m remote_session_launch --durations=0 --cov=ansys.mechanical --cov-report html:.cov/html \ # --cov-report xml:.cov/xml --cov-report term -vv --print --print-relative-time""" From e24ea88e36201fb19cee51f630389c317d1f7f6f Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot Date: Fri, 5 Apr 2024 19:06:13 +0000 Subject: [PATCH 2/5] Adding changelog entry: 685.dependencies.md --- doc/changelog.d/685.dependencies.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/685.dependencies.md diff --git a/doc/changelog.d/685.dependencies.md b/doc/changelog.d/685.dependencies.md new file mode 100644 index 000000000..c9930983f --- /dev/null +++ b/doc/changelog.d/685.dependencies.md @@ -0,0 +1 @@ +Test: Coverage modification \ No newline at end of file From cbfb67f5a92cdbf048ff5e0963066eb9be726d17 Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Fri, 5 Apr 2024 14:27:09 -0500 Subject: [PATCH 3/5] modify pipeline --- .github/workflows/ci_cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 2fcabef4e..7fe255307 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -132,7 +132,7 @@ jobs: remote-connect: name: Remote connect test and coverage - Mechanical ${{ matrix.mech-version.mechanical-version }} runs-on: public-ubuntu-latest-8-cores - needs: [smoke-tests, revn-variations, config-matrix] + needs: [revn-variations, config-matrix] continue-on-error: ${{ matrix.mech-version.experimental }} strategy: fail-fast: false @@ -226,7 +226,7 @@ jobs: name: Embedding testing and coverage runs-on: ubuntu-latest timeout-minutes: 10 - needs: [style, revn-variations] + needs: [revn-variations, config-matrix] container: image: ${{ needs.revn-variations.outputs.test_container }} options: --entrypoint /bin/bash @@ -303,7 +303,7 @@ jobs: container: image: ${{ needs.revn-variations.outputs.test_container }} options: --entrypoint /bin/bash - needs: [ smoke-tests, revn-variations] + needs: [revn-variations, config-matrix] strategy: fail-fast: false matrix: From 1c0de2a5bd20cc5e1d12930a91aab2d6307b436f Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Mon, 8 Apr 2024 12:34:08 -0500 Subject: [PATCH 4/5] revert to use of matrix --- .github/workflows/ci_cd.yml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 58ad7d260..3ceabbb2f 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -130,15 +130,13 @@ jobs: fi remote-connect: - name: Remote connect test and coverage - Mechanical ${{ matrix.mech-version.mechanical-version }} + name: Remote connect testing and coverage - Mechanical ${{ matrix.mechanical-version }} runs-on: public-ubuntu-latest-8-cores - needs: [revn-variations, config-matrix] - continue-on-error: ${{ matrix.mech-version.experimental }} + needs: [smoke-tests, revn-variations, config-matrix] + continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - mech-version: ${{ fromJSON(needs.config-matrix.outputs.matrix) }} + matrix: ${{ fromJSON(needs.config-matrix.outputs.matrix) }} steps: - name: Login in Github Container registry @@ -151,7 +149,7 @@ jobs: - name: Pull, launch, and validate Mechanical service env: LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mech-version.mechanical-version }} + MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mechanical-version }} run: | docker pull ${{ env.MECHANICAL_IMAGE }} docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ env.MECHANICAL_IMAGE }} > log.txt & @@ -162,8 +160,8 @@ jobs: - name: "Set up Python" uses: ansys/actions/_setup-python@v5.1 with: - python-version: ${{ matrix.python-version }} - use-cache: ${{ matrix.python-version }} + python-version: ${{ env.MAIN_PYTHON_VERSION}} + use-cache: false - name: Create and activate virtual environment run: | @@ -177,21 +175,21 @@ jobs: - name: Remote connect test run: | - pytest -m remote_session_connect -s --junitxml remote_results${{ matrix.python-version }}.xml --cov=ansys.mechanical --cov-report html:.cov/html|| true + pytest -m remote_session_connect -s --junitxml remote_results${{ env.MAIN_PYTHON_VERSION}}.xml --cov=ansys.mechanical --cov-report html:.cov/html|| true - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/remote_results*.xml' - check_name: Remote Connect Report ${{ matrix.python-version }} + check_name: Remote Connect Report ${{ env.MAIN_PYTHON_VERSION}} detailed_summary: true include_passed: true fail_on_failure: true - name: Upload coverage results uses: actions/upload-artifact@v4 - if: matrix.mech-version.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION + if: matrix.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION with: name: coverage-tests path: .cov @@ -199,7 +197,7 @@ jobs: - name: Upload coverage results (as .coverage) uses: actions/upload-artifact@v4 - if: matrix.mech-version.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION + if: matrix.mechanical-version == env.LATEST_STABLE_DOCKER_IMAGE_VERSION with: name: coverage-file-tests @@ -209,17 +207,17 @@ jobs: - name: Get Mechanical container logs if: always() run: | - docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_tests_log-${{ matrix.mech-version.mechanical-version }}.txt 2>&1 + docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_tests_log-${{ matrix.mechanical-version }}.txt 2>&1 echo CONTAINER LOGS OUTPUT - cat mechanical_tests_log-${{ matrix.mech-version.mechanical-version }}.txt + cat mechanical_tests_log-${{ matrix.mechanical-version }}.txt echo CPU info lscpu - name: Upload container logs uses: actions/upload-artifact@v4 with: - name: mechanical_tests_log-${{ matrix.mech-version.mechanical-version }} - path: mechanical_tests_log-${{ matrix.mech-version.mechanical-version }}.txt + name: mechanical_tests_log-${{ matrix.mechanical-version }} + path: mechanical_tests_log-${{ matrix.mechanical-version }}.txt retention-days: 7 embedding-tests: From f615410285138cdd506949b036fe5e152eb7c60e Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Mon, 8 Apr 2024 12:45:50 -0500 Subject: [PATCH 5/5] clean pipeline --- .github/workflows/ci_cd.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 3ceabbb2f..e88a51b78 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -132,7 +132,7 @@ jobs: remote-connect: name: Remote connect testing and coverage - Mechanical ${{ matrix.mechanical-version }} runs-on: public-ubuntu-latest-8-cores - needs: [smoke-tests, revn-variations, config-matrix] + needs: [revn-variations, config-matrix] continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false @@ -165,8 +165,8 @@ jobs: - name: Create and activate virtual environment run: | - python -m venv venv - . .venv/bin/activate + python -m venv .venv + source .venv/bin/activate - name: Install dependencies run: | @@ -224,7 +224,7 @@ jobs: name: Embedding testing and coverage runs-on: ubuntu-latest timeout-minutes: 10 - needs: [revn-variations, config-matrix] + needs: [revn-variations] container: image: ${{ needs.revn-variations.outputs.test_container }} options: --entrypoint /bin/bash @@ -301,7 +301,7 @@ jobs: container: image: ${{ needs.revn-variations.outputs.test_container }} options: --entrypoint /bin/bash - needs: [revn-variations, config-matrix] + needs: [revn-variations] strategy: fail-fast: false matrix: