From bdb565a29055a46f4aad40b5594ebd442bb96b17 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Thu, 9 Oct 2025 21:09:24 -0700 Subject: [PATCH 01/23] deploy-pr-doc: add deploy PR documentation label and workflow --- .github/labeler.yml | 8 ++++++++ .github/labels.yml | 4 ++++ .github/workflows/ci_cd_pr.yml | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 42dd074..2ec2b2b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -25,6 +25,14 @@ - changed-files: - any-glob-to-any-file: ['examples/**/*.py', 'doc/source/examples.rst'] +# HACK: the label is declared with the only purpose of avoiding the +# GitHub labeler bot from removing it. This is a known issue reported in the +# official action/labeler repo https://github.com/actions/labeler/issues/763 +'deploy-pr-doc': + - all: + - changed-files: + - all-globs-to-all-files: ['THIS-NEVER-MATCHES-A-FILE'] + ## -- Other labels ------------------------------------------------------------ 'style:code': - any: diff --git a/.github/labels.yml b/.github/labels.yml index c2b5daf..6028619 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -65,6 +65,10 @@ description: Skip documentation runs in CI/CD color: 0677ba +- name: 'deploy-pr-doc' + description: Deploy pull request documentation + color: 0677ba + # -- Dependencies labels ----------------------------------------------------- - name: 'dependencies' diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 50062ff..5d652e1 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -93,6 +93,24 @@ jobs: use-python-cache: false needs-quarto: true + doc-deploy-pr: + name: "Deploy PR documentation" + runs-on: ubuntu-latest + needs: doc-build + if: | + always() && + (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') && + contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc') + steps: + - uses: ansys/actions/doc-deploy-pr@v10 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + # Limit the number of PR documentation deployments to avoid excessive resource usage. + maximum-pr-doc-deployments: 10 + wheelhouse: name: "Wheelhouse / ${{ matrix.os }} / ${{ matrix.python }}" runs-on: ${{ matrix.os }} From cd2fadace19f93fde87e0e094c7ba9e3643bd0fa Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Fri, 10 Oct 2025 04:13:02 +0000 Subject: [PATCH 02/23] chore: adding changelog file 16.documentation.md [dependabot-skip] --- doc/source/changelog/16.documentation.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/source/changelog/16.documentation.md diff --git a/doc/source/changelog/16.documentation.md b/doc/source/changelog/16.documentation.md new file mode 100644 index 0000000..2c4bde7 --- /dev/null +++ b/doc/source/changelog/16.documentation.md @@ -0,0 +1 @@ +Add deploy PR documentation label and workflow From 854d549b0f1693f9850eba6a1f26001981814f08 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Thu, 9 Oct 2025 21:26:31 -0700 Subject: [PATCH 03/23] ci: update deploy PR documentation token to use PYANSYS_CI_BOT_TOKEN and define DOCUMENTATION_CNAME --- .github/workflows/ci_cd_pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 5d652e1..ad5dd07 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -9,6 +9,7 @@ env: DOCKER_IMAGE_LUMERICAL_UNIFIED: 'ghcr.io/ansys-internal/lumerical-unified:latest' DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME: 'lumerical-unified' PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/' + DOCUMENTATION_CNAME: 'lumerical.docs.pyansys.com' permissions: contents: read @@ -105,7 +106,7 @@ jobs: - uses: ansys/actions/doc-deploy-pr@v10 with: cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} # Limit the number of PR documentation deployments to avoid excessive resource usage. From 4232119e1bb69b6b8f92b8187bff66ad2a50383c Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 12:05:48 -0700 Subject: [PATCH 04/23] feat: add deployment for development documentation and update dependencies --- .github/workflows/ci_cd_pr.yml | 42 +++++++++++++++++++++++++++------- pyproject.toml | 3 +++ requirements_build.txt | 2 -- 3 files changed, 37 insertions(+), 10 deletions(-) delete mode 100644 requirements_build.txt diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index ad5dd07..386d8f2 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -94,23 +94,49 @@ jobs: use-python-cache: false needs-quarto: true + doc-deploy-dev: + name: "Deploy development documentation" + # Deploy development only when merging or pushing to the 'main' branch + if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') + runs-on: ubuntu-latest + needs: doc-build + steps: + - name: "Deploy the latest documentation" + uses: ansys/actions/doc-deploy-dev@v10.1 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + + # doc-deploy-stable: + # name: "Deploy stable documentation" + # # Deploy release documentation when creating a new tag + # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + # runs-on: ubuntu-latest + # needs: release + # steps: + # - uses: ansys/actions/doc-deploy-stable@v6 + # with: + # doc-artifact-name: '' + # cname: ${{ env.DOCUMENTATION_CNAME }} + # token: ${{ secrets.GITHUB_TOKEN }} + + doc-deploy-pr: name: "Deploy PR documentation" runs-on: ubuntu-latest needs: doc-build - if: | - always() && - (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') && - contains(github.event.pull_request.labels.*.name, 'deploy-pr-doc') + # Run when the PR is closed i.e. when doc-build job is skipped + if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') steps: - - uses: ansys/actions/doc-deploy-pr@v10 + - uses: ansys/actions/doc-deploy-pr@v10.1 with: cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - # Limit the number of PR documentation deployments to avoid excessive resource usage. - maximum-pr-doc-deployments: 10 + maximum-pr-doc-deployments: 3 wheelhouse: name: "Wheelhouse / ${{ matrix.os }} / ${{ matrix.python }}" diff --git a/pyproject.toml b/pyproject.toml index 9d5ba98..8ed14c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,9 @@ doc = [ "sphinx-copybutton==0.5.2", "sphinx_design==0.6.1", ] +examples = [ + "matplotlib>=3.10.0", +] [tool.flit.module] name = "ansys.lumerical.core" diff --git a/requirements_build.txt b/requirements_build.txt deleted file mode 100644 index d2ccba1..0000000 --- a/requirements_build.txt +++ /dev/null @@ -1,2 +0,0 @@ -build==0.10.0 -twine==4.0.2 From cd23df6a5a1f4bf21b3bc14127bda83086ae1390 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 12:29:08 -0700 Subject: [PATCH 05/23] chore: update doc-build action version to v10.1 and comment out doc-deploy-pr job --- .github/workflows/ci_cd_pr.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 386d8f2..52246ff 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -87,7 +87,7 @@ jobs: runs-on: ubuntu-latest needs: doc-style steps: - - uses: ansys/actions/doc-build@v10 + - uses: ansys/actions/doc-build@v10.1 with: skip-install: true python-version: ${{ env.MAIN_PYTHON_VERSION }} @@ -123,20 +123,20 @@ jobs: # token: ${{ secrets.GITHUB_TOKEN }} - doc-deploy-pr: - name: "Deploy PR documentation" - runs-on: ubuntu-latest - needs: doc-build - # Run when the PR is closed i.e. when doc-build job is skipped - if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') - steps: - - uses: ansys/actions/doc-deploy-pr@v10.1 - with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - maximum-pr-doc-deployments: 3 + # doc-deploy-pr: + # name: "Deploy PR documentation" + # runs-on: ubuntu-latest + # needs: doc-build + # # Run when the PR is closed i.e. when doc-build job is skipped + # if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') + # steps: + # - uses: ansys/actions/doc-deploy-pr@v10.1 + # with: + # cname: ${{ env.DOCUMENTATION_CNAME }} + # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + # bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + # bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + # maximum-pr-doc-deployments: 3 wheelhouse: name: "Wheelhouse / ${{ matrix.os }} / ${{ matrix.python }}" From 86b3ceaab2da639b01daa11e182c6959d70edd57 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 12:50:24 -0700 Subject: [PATCH 06/23] feat: enable deployment of PR documentation with updated configuration --- .github/workflows/ci_cd_pr.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 52246ff..c6578fa 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -84,6 +84,7 @@ jobs: doc-build: name: "Doc build" + if: github.event.action != 'closed' runs-on: ubuntu-latest needs: doc-style steps: @@ -123,20 +124,20 @@ jobs: # token: ${{ secrets.GITHUB_TOKEN }} - # doc-deploy-pr: - # name: "Deploy PR documentation" - # runs-on: ubuntu-latest - # needs: doc-build - # # Run when the PR is closed i.e. when doc-build job is skipped - # if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') - # steps: - # - uses: ansys/actions/doc-deploy-pr@v10.1 - # with: - # cname: ${{ env.DOCUMENTATION_CNAME }} - # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - # bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - # bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - # maximum-pr-doc-deployments: 3 + doc-deploy-pr: + name: "Deploy PR documentation" + runs-on: ubuntu-latest + needs: doc-build + # Run when the PR is closed i.e. when doc-build job is skipped + if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') + steps: + - uses: ansys/actions/doc-deploy-pr@v10.1 + with: + cname: ${{ env.DOCUMENTATION_CNAME }} + token: ${{ secrets.GITHUB_TOKEN }} + bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} + bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} + maximum-pr-doc-deployments: 3 wheelhouse: name: "Wheelhouse / ${{ matrix.os }} / ${{ matrix.python }}" From 0ec058868ab27b0a5aa2cbac50f2ef4e08de743c Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 13:18:38 -0700 Subject: [PATCH 07/23] Seems that the documentation is wrong, need to use the CI_BOT_TOKEN and not the GITHUB one --- .github/workflows/ci_cd_pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index c6578fa..8c2b458 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -106,7 +106,7 @@ jobs: uses: ansys/actions/doc-deploy-dev@v10.1 with: cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} @@ -121,7 +121,7 @@ jobs: # with: # doc-artifact-name: '' # cname: ${{ env.DOCUMENTATION_CNAME }} - # token: ${{ secrets.GITHUB_TOKEN }} + # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} doc-deploy-pr: @@ -134,7 +134,7 @@ jobs: - uses: ansys/actions/doc-deploy-pr@v10.1 with: cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} maximum-pr-doc-deployments: 3 From cea1f249c15a8d8d40e57706237c3d88fce7be3f Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 14:32:10 -0700 Subject: [PATCH 08/23] feat: add codecov configuration for coverage reporting. Added vulnerabilities action but left commented out since repo is private --- .github/workflows/ci_cd_pr.yml | 21 +++++++++++++++++++++ codecov.yml | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 codecov.yml diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 8c2b458..476697f 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -21,6 +21,27 @@ concurrency: jobs: + # vulnerabilities: + # name: Vulnerabilities + # runs-on: ubuntu-latest + # steps: + # - name: PyAnsys Vulnerability check (on main) + # if: github.ref == 'refs/heads/main' + # uses: ansys/actions/check-vulnerabilities@v10.1 + # with: + # python-version: ${{ env.MAIN_PYTHON_VERSION }} + # python-package-name: ${{ env.LIBRARY_NAME }} + # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + + # - name: PyAnsys Vulnerability check (on dev mode) + # if: github.ref != 'refs/heads/main' + # uses: ansys/actions/check-vulnerabilities@v10.1 + # with: + # python-version: ${{ env.MAIN_PYTHON_VERSION }} + # python-package-name: ${{ env.LIBRARY_NAME }} + # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} + # dev-mode: true + labeler: name: "Labels" permissions: diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..f693699 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +coverage: + range: 70..100 + round: down + precision: 2 + status: + project: + default: + target: 80% + +codecov: + notify: + wait_for_ci: yes \ No newline at end of file From df8c341cda643453e340ec3f390171eebe37170a Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 15:33:12 -0700 Subject: [PATCH 09/23] attempt code coverage report --- .github/workflows/ci_cd_pr.yml | 21 ++++++++++++++++++--- pyproject.toml | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 476697f..0476703 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -158,7 +158,7 @@ jobs: token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - maximum-pr-doc-deployments: 3 + maximum-pr-doc-deployments: 10 wheelhouse: name: "Wheelhouse / ${{ matrix.os }} / ${{ matrix.python }}" @@ -212,12 +212,27 @@ jobs: --volume ${PWD}:/home/ansys/pylumerical \ ${{ env.DOCKER_IMAGE_LUMERICAL_UNIFIED }} - - name: "Install project" + - name: "Install Project Dependencies and Run Tests" run: | docker exec \ --workdir /home/ansys/pylumerical \ ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} /bin/bash --login -c \ - "python -m pip install -e .[tests] && pytest tests" + "python -m pip install -e .[tests] && pytest -v tests/ --cov-report=html:coverage_report" + + - name: Upload Coverage Results + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: coverage-html-ubuntu + path: .cov/html + retention-days: 7 + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: .cov/xml - name: "Stop lumerical services" if: always() diff --git a/pyproject.toml b/pyproject.toml index 8ed14c9..bb83930 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ doc = [ "sphinx_design==0.6.1", ] examples = [ - "matplotlib>=3.10.0", + "matplotlib==3.10.0", ] [tool.flit.module] From 4d26379a8096b5773cda4a6255640b6be02213ea Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 16:18:39 -0700 Subject: [PATCH 10/23] feat: enhance test coverage reporting in CI workflow --- .github/workflows/ci_cd_pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 0476703..fdd95ad 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -217,7 +217,9 @@ jobs: docker exec \ --workdir /home/ansys/pylumerical \ ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} /bin/bash --login -c \ - "python -m pip install -e .[tests] && pytest -v tests/ --cov-report=html:coverage_report" + "python -m pip install -e .[tests] && \ + pytest --cov="/home/lumerical/.local/lib/python3.13/site-packages/ansys/api/lumerical/" \ + --cov="./tests/unit" --cov-report=html:coverage_report --verbose" - name: Upload Coverage Results if: always() From 30475ec0aa78ebc2f771831d5a06101ad0761861 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 16:37:44 -0700 Subject: [PATCH 11/23] feat: update coverage reporting format to include XML output --- .github/workflows/ci_cd_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index fdd95ad..6280f47 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -219,7 +219,7 @@ jobs: ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} /bin/bash --login -c \ "python -m pip install -e .[tests] && \ pytest --cov="/home/lumerical/.local/lib/python3.13/site-packages/ansys/api/lumerical/" \ - --cov="./tests/unit" --cov-report=html:coverage_report --verbose" + --cov="./tests/unit" --cov-report=xml:.cov/xml --cov-report=html:.cov/html --verbose" - name: Upload Coverage Results if: always() From 03f8a6c9e34ff81fc5f1b3a159721ed316ff23e6 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Fri, 10 Oct 2025 21:05:21 -0700 Subject: [PATCH 12/23] feat: add user specification to Docker run command to see if this fixes permission errors --- .github/workflows/ci_cd_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 6280f47..9f7df89 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -210,6 +210,7 @@ jobs: --name ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} \ --env ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }} \ --volume ${PWD}:/home/ansys/pylumerical \ + --user "$(id -u):$(id -g)" \ ${{ env.DOCKER_IMAGE_LUMERICAL_UNIFIED }} - name: "Install Project Dependencies and Run Tests" From 42ed146c3484ec1917d0a552171239abd4e09a26 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Date: Tue, 14 Oct 2025 08:52:25 +0200 Subject: [PATCH 13/23] ci(pull): only deploy doc-dev from main --- .github/workflows/ci_cd_pr.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 9f7df89..600a086 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -116,40 +116,10 @@ jobs: use-python-cache: false needs-quarto: true - doc-deploy-dev: - name: "Deploy development documentation" - # Deploy development only when merging or pushing to the 'main' branch - if: github.event_name == 'push' && !contains(github.ref, 'refs/tags') - runs-on: ubuntu-latest - needs: doc-build - steps: - - name: "Deploy the latest documentation" - uses: ansys/actions/doc-deploy-dev@v10.1 - with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - - # doc-deploy-stable: - # name: "Deploy stable documentation" - # # Deploy release documentation when creating a new tag - # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - # runs-on: ubuntu-latest - # needs: release - # steps: - # - uses: ansys/actions/doc-deploy-stable@v6 - # with: - # doc-artifact-name: '' - # cname: ${{ env.DOCUMENTATION_CNAME }} - # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - - doc-deploy-pr: name: "Deploy PR documentation" runs-on: ubuntu-latest needs: doc-build - # Run when the PR is closed i.e. when doc-build job is skipped if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') steps: - uses: ansys/actions/doc-deploy-pr@v10.1 From 63920164d5961c18988263e26f474e02d9178f3c Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Tue, 14 Oct 2025 11:17:04 -0700 Subject: [PATCH 14/23] fix: update Docker image version and adjust coverage report paths in CI workflow --- .github/workflows/ci_cd_pr.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 600a086..fe157bf 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -6,7 +6,7 @@ on: env: MAIN_PYTHON_VERSION: '3.13' LIBRARY_NAME: 'ansys-lumerical-core' - DOCKER_IMAGE_LUMERICAL_UNIFIED: 'ghcr.io/ansys-internal/lumerical-unified:latest' + DOCKER_IMAGE_LUMERICAL_UNIFIED: 'ghcr.io/ansys-internal/lumerical-unified:v252_3' DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME: 'lumerical-unified' PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/' DOCUMENTATION_CNAME: 'lumerical.docs.pyansys.com' @@ -180,7 +180,6 @@ jobs: --name ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} \ --env ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }} \ --volume ${PWD}:/home/ansys/pylumerical \ - --user "$(id -u):$(id -g)" \ ${{ env.DOCKER_IMAGE_LUMERICAL_UNIFIED }} - name: "Install Project Dependencies and Run Tests" @@ -190,14 +189,14 @@ jobs: ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} /bin/bash --login -c \ "python -m pip install -e .[tests] && \ pytest --cov="/home/lumerical/.local/lib/python3.13/site-packages/ansys/api/lumerical/" \ - --cov="./tests/unit" --cov-report=xml:.cov/xml --cov-report=html:.cov/html --verbose" + --cov="./tests/unit" --cov-report=xml:tmp/cov/xml --cov-report=html:tmp/cov/html --verbose" - name: Upload Coverage Results if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: coverage-html-ubuntu - path: .cov/html + path: tmp/cov/html retention-days: 7 - name: Upload coverage to Codecov @@ -205,7 +204,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - files: .cov/xml + files: tmp/cov/xml - name: "Stop lumerical services" if: always() From a73f1810b3051414a11c28138e3fa99316d47ae5 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Tue, 14 Oct 2025 11:33:32 -0700 Subject: [PATCH 15/23] fix path --- .github/workflows/ci_cd_pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index fe157bf..beed15e 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -189,14 +189,14 @@ jobs: ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} /bin/bash --login -c \ "python -m pip install -e .[tests] && \ pytest --cov="/home/lumerical/.local/lib/python3.13/site-packages/ansys/api/lumerical/" \ - --cov="./tests/unit" --cov-report=xml:tmp/cov/xml --cov-report=html:tmp/cov/html --verbose" + --cov="./tests/unit" --cov-report=xml:/tmp/cov/xml --cov-report=html:/tmp/cov/html --verbose" - name: Upload Coverage Results if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: coverage-html-ubuntu - path: tmp/cov/html + path: /tmp/cov/html retention-days: 7 - name: Upload coverage to Codecov @@ -204,7 +204,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - files: tmp/cov/xml + files: /tmp/cov/xml - name: "Stop lumerical services" if: always() From 8f464db7e648027376b0e02b71c11b6ca9c29622 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Tue, 14 Oct 2025 14:58:52 -0700 Subject: [PATCH 16/23] fix: update Docker run command to use bind mount for project directory and adjust coverage report paths --- .github/workflows/ci_cd_pr.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index beed15e..567d209 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -178,25 +178,25 @@ jobs: --detach -it \ --network="host" \ --name ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} \ - --env ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }} \ - --volume ${PWD}:/home/ansys/pylumerical \ - ${{ env.DOCKER_IMAGE_LUMERICAL_UNIFIED }} + --env ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }} \ + --mount type=bind,source=${PWD},target=/home/lumerical/pylumerical \ + ${{ env.DOCKER_IMAGE_LUMERICAL_UNIFIED }} - name: "Install Project Dependencies and Run Tests" run: | docker exec \ - --workdir /home/ansys/pylumerical \ + --workdir /home/lumerical/pylumerical \ ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} /bin/bash --login -c \ "python -m pip install -e .[tests] && \ pytest --cov="/home/lumerical/.local/lib/python3.13/site-packages/ansys/api/lumerical/" \ - --cov="./tests/unit" --cov-report=xml:/tmp/cov/xml --cov-report=html:/tmp/cov/html --verbose" + --cov="./tests/unit" --cov-report=xml:.cov/xml --cov-report=html:.cov/html --verbose" - name: Upload Coverage Results if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: coverage-html-ubuntu - path: /tmp/cov/html + path: .cov/html retention-days: 7 - name: Upload coverage to Codecov @@ -204,7 +204,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - files: /tmp/cov/xml + files: .cov/xml - name: "Stop lumerical services" if: always() From 1ffd6d0867cc64e8ba0a22383b862493acf39e52 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Wed, 15 Oct 2025 09:28:14 -0700 Subject: [PATCH 17/23] fix: add ownership preparation and restoration steps for Docker container user --- .github/workflows/ci_cd_pr.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 567d209..a176ed0 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -172,6 +172,16 @@ jobs: run: | docker pull ${{ env.DOCKER_IMAGE_LUMERICAL_UNIFIED }} + - name: "Prepare ownership for container user (lumerical)" + env: + LUMERICAL_UID: 1000 + LUMERICAL_GID: 1000 + run: | + echo "ORIG_UID=$(id -u)" >> $GITHUB_ENV + echo "ORIG_GID=$(id -g)" >> $GITHUB_ENV + sudo chown -R "$LUMERICAL_UID:$LUMERICAL_GID" . + ls -ld . + - name: "Run Lumerical Unified Container" run: | docker run \ @@ -212,3 +222,22 @@ jobs: docker stop ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} docker logs ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} docker rm ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} + + - name: "Restore original ownership" + if: always() + env: + ORIG_UID: ${{ env.ORIG_UID }} + ORIG_GID: ${{ env.ORIG_GID }} + run: | + if [[ -z "$ORIG_UID" || -z "$ORIG_GID" || ! "$ORIG_UID" =~ ^[0-9]+$ || ! "$ORIG_GID" =~ ^[0-9]+$ ]]; then + if [[ -z "$ORIG_UID" || ! "$ORIG_UID" =~ ^[0-9]+$ ]]; then + echo "Skipping chown: ORIG_UID ('$ORIG_UID') is not set or not a valid integer (expected a numeric UID)." + elif [[ -z "$ORIG_GID" || ! "$ORIG_GID" =~ ^[0-9]+$ ]]; then + echo "Skipping chown: ORIG_GID ('$ORIG_GID') is not set or not a valid integer (expected a numeric GID)." + else + echo "Skipping chown: Unknown error with ORIG_UID ('$ORIG_UID') or ORIG_GID ('$ORIG_GID')." + fi + else + sudo chown -R "$ORIG_UID:$ORIG_GID" . + fi + ls -ld . From ceaab09cc5ff86f595feabb8e5912a3196aa85c1 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Wed, 15 Oct 2025 09:50:01 -0700 Subject: [PATCH 18/23] fix: update paths for ownership change and coverage report in CI workflow --- .github/workflows/ci_cd_pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index a176ed0..78b6cc3 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -179,7 +179,7 @@ jobs: run: | echo "ORIG_UID=$(id -u)" >> $GITHUB_ENV echo "ORIG_GID=$(id -g)" >> $GITHUB_ENV - sudo chown -R "$LUMERICAL_UID:$LUMERICAL_GID" . + sudo chown -R "$LUMERICAL_UID:$LUMERICAL_GID" ./pylumerical ls -ld . - name: "Run Lumerical Unified Container" @@ -206,7 +206,7 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: coverage-html-ubuntu - path: .cov/html + path: ./pylumerical/.cov/html retention-days: 7 - name: Upload coverage to Codecov @@ -214,7 +214,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - files: .cov/xml + files: ./pylumerical/.cov/xml - name: "Stop lumerical services" if: always() From 95bb3b8f39fdc3b43cc4557941ea9832a455a253 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Wed, 15 Oct 2025 11:33:54 -0700 Subject: [PATCH 19/23] fix: enhance ownership restoration logic in CI workflow --- .github/workflows/ci_cd_pr.yml | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index 78b6cc3..a313010 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -179,8 +179,8 @@ jobs: run: | echo "ORIG_UID=$(id -u)" >> $GITHUB_ENV echo "ORIG_GID=$(id -g)" >> $GITHUB_ENV - sudo chown -R "$LUMERICAL_UID:$LUMERICAL_GID" ./pylumerical - ls -ld . + sudo chown -R "$LUMERICAL_UID:$LUMERICAL_GID" . + ls -la - name: "Run Lumerical Unified Container" run: | @@ -201,6 +201,25 @@ jobs: pytest --cov="/home/lumerical/.local/lib/python3.13/site-packages/ansys/api/lumerical/" \ --cov="./tests/unit" --cov-report=xml:.cov/xml --cov-report=html:.cov/html --verbose" + - name: "Restore original ownership" + if: always() + env: + ORIG_UID: ${{ env.ORIG_UID }} + ORIG_GID: ${{ env.ORIG_GID }} + run: | + if [[ -z "$ORIG_UID" || -z "$ORIG_GID" || ! "$ORIG_UID" =~ ^[0-9]+$ || ! "$ORIG_GID" =~ ^[0-9]+$ ]]; then + if [[ -z "$ORIG_UID" || ! "$ORIG_UID" =~ ^[0-9]+$ ]]; then + echo "Skipping chown: ORIG_UID ('$ORIG_UID') is not set or not a valid integer (expected a numeric UID)." + elif [[ -z "$ORIG_GID" || ! "$ORIG_GID" =~ ^[0-9]+$ ]]; then + echo "Skipping chown: ORIG_GID ('$ORIG_GID') is not set or not a valid integer (expected a numeric GID)." + else + echo "Skipping chown: Unknown error with ORIG_UID ('$ORIG_UID') or ORIG_GID ('$ORIG_GID')." + fi + else + sudo chown -R "$ORIG_UID:$ORIG_GID" . + fi + ls -la + - name: Upload Coverage Results if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 @@ -222,22 +241,3 @@ jobs: docker stop ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} docker logs ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} docker rm ${{ env.DOCKER_CONTAINER_LUMERICAL_UNIFIED_NAME }} - - - name: "Restore original ownership" - if: always() - env: - ORIG_UID: ${{ env.ORIG_UID }} - ORIG_GID: ${{ env.ORIG_GID }} - run: | - if [[ -z "$ORIG_UID" || -z "$ORIG_GID" || ! "$ORIG_UID" =~ ^[0-9]+$ || ! "$ORIG_GID" =~ ^[0-9]+$ ]]; then - if [[ -z "$ORIG_UID" || ! "$ORIG_UID" =~ ^[0-9]+$ ]]; then - echo "Skipping chown: ORIG_UID ('$ORIG_UID') is not set or not a valid integer (expected a numeric UID)." - elif [[ -z "$ORIG_GID" || ! "$ORIG_GID" =~ ^[0-9]+$ ]]; then - echo "Skipping chown: ORIG_GID ('$ORIG_GID') is not set or not a valid integer (expected a numeric GID)." - else - echo "Skipping chown: Unknown error with ORIG_UID ('$ORIG_UID') or ORIG_GID ('$ORIG_GID')." - fi - else - sudo chown -R "$ORIG_UID:$ORIG_GID" . - fi - ls -ld . From 734d5c5a1212a78d05e7d867fedc34a5f0968275 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Wed, 15 Oct 2025 11:53:19 -0700 Subject: [PATCH 20/23] do I finally understand what's going on? --- .github/workflows/ci_cd_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index a313010..a6a86df 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -225,7 +225,7 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: coverage-html-ubuntu - path: ./pylumerical/.cov/html + path: .cov/html retention-days: 7 - name: Upload coverage to Codecov @@ -233,7 +233,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - files: ./pylumerical/.cov/xml + files: .cov/xml - name: "Stop lumerical services" if: always() From cb3b75bff157f7b68d4c328f5c3cb13179e09711 Mon Sep 17 00:00:00 2001 From: Luke Queenan Date: Wed, 15 Oct 2025 13:09:21 -0700 Subject: [PATCH 21/23] bump pytest and pytest-cov --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bb83930..8b2f46c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,8 @@ dependencies = [ [project.optional-dependencies] tests = [ - "pytest==7.4.3", - "pytest-cov==4.1.0", + "pytest==8.4.2", + "pytest-cov==7.0.0", ] doc = [ "ansys-sphinx-theme[autoapi]==1.4.2", From 4366611fd72b8af227945056fb63f22de8aae073 Mon Sep 17 00:00:00 2001 From: Adan Wang Date: Mon, 20 Oct 2025 18:34:32 -0600 Subject: [PATCH 22/23] Removed instructions related to build_requirements.txt. There was one section on distribution that depended on the file. Upon examination, it seemed to be legacy instructions, and hence has been removed. --- doc/source/contributing.rst | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 61296ea..d46564d 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -53,11 +53,10 @@ you to modify the source and enhance it. python -m pip install -U pip python -m pip install -e . -#. Install additional requirements as needed for build, documentation, and tests: +#. Install additional requirements as needed for documentation and tests: .. code:: bash - python -m pip install -r requirements_build.txt python -m pip install .[tests] python -m pip install .[doc] @@ -135,20 +134,6 @@ You can also clean the documentation build directory by running: make clean - -Distributing ------------- - -If you would like to create either source or wheel files, start by installing -the building requirements and then executing the build module: - -.. code:: bash - - python -m pip install -r requirements/requirements_build.txt - python -m build - python -m twine check dist/* - - .. LINKS AND REFERENCES .. _pre-commit: https://pre-commit.com/ From be61d88069076952c822cfdaff715f5d21a8ff7e Mon Sep 17 00:00:00 2001 From: Luke Queenan <109314689+lukequeenan-ansys@users.noreply.github.com> Date: Tue, 21 Oct 2025 09:17:50 -0700 Subject: [PATCH 23/23] Update .github/workflows/ci_cd_pr.yml Co-authored-by: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> --- .github/workflows/ci_cd_pr.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/ci_cd_pr.yml b/.github/workflows/ci_cd_pr.yml index a6a86df..3005073 100644 --- a/.github/workflows/ci_cd_pr.yml +++ b/.github/workflows/ci_cd_pr.yml @@ -32,16 +32,7 @@ jobs: # python-version: ${{ env.MAIN_PYTHON_VERSION }} # python-package-name: ${{ env.LIBRARY_NAME }} # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - - # - name: PyAnsys Vulnerability check (on dev mode) - # if: github.ref != 'refs/heads/main' - # uses: ansys/actions/check-vulnerabilities@v10.1 - # with: - # python-version: ${{ env.MAIN_PYTHON_VERSION }} - # python-package-name: ${{ env.LIBRARY_NAME }} - # token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - # dev-mode: true - + # dev-mode: ${{ github.ref != 'refs/heads/main' }} labeler: name: "Labels" permissions: