Skip to content

Commit

Permalink
Merge branch 'main' into release/0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
RobPasMue committed Apr 5, 2023
2 parents 4235395 + 06dd45d commit b374f8c
Show file tree
Hide file tree
Showing 41 changed files with 2,042 additions and 526 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Build Docker images
on:
workflow_dispatch:
pull_request:
paths:
- 'docker/**'
- '.github/workflows/build_docker_image.yml'
push:
branches:
- main
paths:
- 'docker/**'
- '.github/workflows/build_docker_image.yml'
release:
types: [published]

env:
MAIN_PYTHON_VERSION: '3.10'
ANSRV_GEO_IMAGE_WINDOWS_TAG: ghcr.io/pyansys/geometry:windows-latest-tmp
ANSRV_GEO_IMAGE_LINUX_TAG: ghcr.io/pyansys/geometry:linux-latest-tmp
ANSRV_GEO_PORT: 700
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
GEO_CONT_NAME: ans_geo

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================

build-windows:
name: Building Geometry Service - Windows
runs-on: [self-hosted, pygeometry-ci-1]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # use python3.9, self-hosted has an issue with 3.10

- name: Download Windows binaries
uses: dsaltares/fetch-gh-release-asset@master
with:
version: 'latest'
file: 'windows-binaries.zip'
token: ${{ secrets.GITHUB_TOKEN }}
target: 'docker/windows-binaries.zip'

- name: Build Docker image
working-directory: docker
run: |
docker build -f Dockerfile.windows -t ${{ env.ANSRV_GEO_IMAGE_WINDOWS_TAG }} .
- name: Launch Geometry service
run: |
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE_WINDOWS_TAG }}
- name: Validate connection using PyGeometry
run: |
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install .
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
- name: Stop the Geometry service
if: always()
run: |
docker stop ${{ env.GEO_CONT_NAME }}
docker logs ${{ env.GEO_CONT_NAME }}
docker rm ${{ env.GEO_CONT_NAME }}
- name: Delete the Docker images (and untagged ones)
if: always()
run: |
docker image rm ${{ env.ANSRV_GEO_IMAGE_WINDOWS_TAG }}
docker system prune -f
# =================================================================================================
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# =================================================================================================

build-linux:
name: Building Geometry Service - Linux
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Download Linux binaries
uses: dsaltares/fetch-gh-release-asset@master
with:
version: 'latest'
file: 'linux-binaries.zip'
token: ${{ secrets.GITHUB_TOKEN }}
target: 'docker/linux-binaries.zip'

- name: Build Docker image
working-directory: docker
run: |
docker build -f Dockerfile.linux -t ${{ env.ANSRV_GEO_IMAGE_LINUX_TAG }} .
- name: Launch Geometry service
run: |
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE_LINUX_TAG }}
- name: Validate connection using PyGeometry
run: |
python -m pip install --upgrade pip
pip install .
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
- name: Stop the Geometry service
if: always()
run: |
docker stop ${{ env.GEO_CONT_NAME }}
docker logs ${{ env.GEO_CONT_NAME }}
docker rm ${{ env.GEO_CONT_NAME }}
42 changes: 38 additions & 4 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
python-version: '3.9' # use python3.9, self-hosted has an issue with 3.10

- name: Set up headless display
uses: pyvista/setup-headless-display-action@v1
uses: pyvista/setup-headless-display-action@v2

- name: Create Python venv
run: |
Expand Down Expand Up @@ -142,20 +142,23 @@ jobs:
pytest -v
- name: Upload integration test logs
if: always()
uses: actions/upload-artifact@v3
with:
name: integration-test-logs-${{ runner.os }}
path: tests/integration/logs
retention-days: 7

- name: Upload PyVista generated images (cache and results)
if: always()
uses: actions/upload-artifact@v3
with:
name: pytest-pyvista-images-${{ runner.os }}
path: tests/integration/image_cache
retention-days: 7

- name: Upload Coverage Results
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-html
Expand Down Expand Up @@ -185,7 +188,7 @@ jobs:
python-version: '3.9' # use python3.9, self-hosted has an issue with 3.10

- name: Set up headless display
uses: pyvista/setup-headless-display-action@v1
uses: pyvista/setup-headless-display-action@v2

- name: Create Python venv
run: |
Expand Down Expand Up @@ -304,13 +307,15 @@ jobs:
requires-xvfb: true

- name: Upload integration test logs
if: always()
uses: actions/upload-artifact@v3
with:
name: integration-test-logs-${{ runner.os }}
path: tests/integration/logs
retention-days: 7

- name: Upload PyVista generated images (cache and results)
if: always()
uses: actions/upload-artifact@v3
with:
name: pytest-pyvista-images-${{ runner.os }}
Expand All @@ -326,7 +331,7 @@ jobs:
package:
name: Package library
needs: [testing-windows, docs]
needs: [testing-windows, testing-linux, docs]
runs-on: ubuntu-latest
steps:
- name: Build library source and wheel artifacts
Expand All @@ -335,10 +340,38 @@ jobs:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

fetch-release-artifacts:
name: Fetch release artifacts
needs: [testing-windows, testing-linux, docs]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on:
group: ansys-internal
labels: [self-hosted, Windows, signtool]

steps:
- name: Download binaries
run: |
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/DockerWindows.zip --output windows-binaries.zip
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/DockerLinux.zip --output linux-binaries.zip
- name: Upload Windows binaries as workflow artifacts
uses: actions/upload-artifact@v3
with:
name: windows-binaries.zip
path: windows-binaries.zip
retention-days: 7

- name: Upload Linux binaries as workflow artifacts
uses: actions/upload-artifact@v3
with:
name: linux-binaries.zip
path: linux-binaries.zip
retention-days: 7

release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [package]
needs: [package, fetch-release-artifacts]
runs-on: ubuntu-latest
steps:
- name: Release to the private PyPI repository
Expand All @@ -352,6 +385,7 @@ jobs:
uses: pyansys/actions/release-github@v4
with:
library-name: ${{ env.PACKAGE_NAME }}
additional-artifacts: windows-binaries.zip linux-binaries.zip

upload_dev_docs:
name: Upload dev documentation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_docker_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
cache-dependency-path: 'pyproject.toml'

- name: Set up headless display
uses: pyvista/setup-headless-display-action@v1
uses: pyvista/setup-headless-display-action@v2

- name: Create Python venv
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ cython_debug/
# vscode
.vscode

# docker
docker/*-binaries.zip

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: flake8

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell

Expand All @@ -43,6 +43,6 @@ repos:

# this validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
rev: 0.22.0
hooks:
- id: check-github-workflows
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
* [Alexander Kaszynski](https://github.com/akaszynski)
* [Jorge Martínez](https://github.com/jorgepiloto)
* [Alejandro Fernández](https://github.com/AlejandroFernandezLuces)
* [Lance Lance](https://github.com/LanceX2214)
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Then, install PyGeometry with:

* Index URL: ``https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/``

If access to this package registry is needed, email `pyansys.support@ansys.com <mailto:pyansys.support@ansys.com>`_
If access to this package registry is needed, email `pyansys.core@ansys.com <mailto:pyansys.core@ansys.com>`_
to request access. The PyAnsys team can provide you a read-only token to be inserted in ``${PRIVATE_PYPI_ACCESS_TOKEN}``.
Once you have it, run the following command:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ should use these issue templates:

If your issue does not fit into these categories, create your own issue.

To reach the PyAnsys team, email `pyansys.support@ansys.com <pyansys.support@ansys.com>`_.
To reach the PyAnsys team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.

View documentation
------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/source/examples/01_getting_started/01_math.mystnb
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ print(eval.parameter.v)

```{code-cell} ipython3
print("Point on the sphere:")
eval.position()
eval.position
```

```{code-cell} ipython3
print("Normal to the surface of the sphere at the evaluation position:")
eval.normal()
eval.normal
```
6 changes: 3 additions & 3 deletions doc/source/getting_started/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ please install `Docker Engine <https://docs.docker.com/engine/install/>`_ from t
At the moment, the Geometry service backend is only delivered as a Windows Docker container.
As such, this container only runs on a Windows machine. Furthermore, it has also been observed
that certain Docker Desktop versions for Windows are not properly configured for running Windows
Docker containers. Refer to our section
Docker containers. Refer to
:ref:`Running the Geometry service Windows Docker container <ref_docker_windows>` for further details.

.. _ref_docker_windows:
Expand All @@ -33,10 +33,10 @@ you follow the upcoming steps when installing Docker:

#. On ``Settings >> Software updates``, deselect ``Automatically check for updates``. Then, ``Apply & restart``.

#. On the Windows taskbar, go to the ``Show hidden icons`` section, right click on the Docker Desktop app and
#. On the Windows taskbar, go to the ``Show hidden icons`` section, right click in the Docker Desktop app and
select ``Switch to Windows containers...``.

At this point, your Docker engine will support running Windows Docker containers. Next step will involve downloading
At this point, your Docker engine supports running Windows Docker containers. Next step involves downloading
the Geometry service Windows Docker image.

Install the PyGeometry image
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Then, install PyGeometry with:

``https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/``

If access to this package registry is needed, email `pyansys.support@ansys.com <mailto:pyansys.support@ansys.com>`_
If access to this package registry is needed, email `pyansys.core@ansys.com <mailto:pyansys.core@ansys.com>`_
to request access. The PyAnsys team can provide you a read-only token to be inserted in ``${PRIVATE_PYPI_ACCESS_TOKEN}``.
Once you have obtained this token, run this command:

Expand Down
4 changes: 2 additions & 2 deletions doc/source/user_guide/shapes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ The sketch can be constructed using different approaches.
Functional-style API
====================

This is sometimes termed a 'fluent functional-style api, or fluent API' in the developer community. We avoid
that term in the context of Ansys APIs to avoid confusion with the Ansys Fluent product.
This is sometimes termed a 'fluent functional-style api, or fluent API' in the developer community. The latter
term is avoided in the context of Ansys APIs to avoid confusion with the Ansys Fluent product.

One of the key features of this approach is keeping an active context based upon the previously created
edges to use as a reference start point for additional objects.
Expand Down
27 changes: 27 additions & 0 deletions docker/Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Geometry service Linux-based Dockerfile
#
# Based on mcr.microsoft.com/dotnet/aspnet:6.0
FROM mcr.microsoft.com/dotnet/aspnet:6.0

# Define the working directory - /app
WORKDIR /app

# Install unzip
RUN apt-get update && apt-get install -y unzip

# Add the binary files from the latest release
COPY linux-binaries.zip .
RUN unzip -qqju linux-binaries.zip -d . && rm linux-binaries.zip

# Let the dynamic link loader where to search for shared libraries
ENV LD_LIBRARY_PATH="/app"

# Add container labels
LABEL org.opencontainers.image.authors="ANSYS Inc."
LABEL org.opencontainers.image.vendor="ANSYS Inc."

# Expose the Geometry service port
EXPOSE 50051

# Define the entrypoint for the Geometry service
ENTRYPOINT ["dotnet", "/app/Presentation.ApiServerLinux.dll"]
Loading

0 comments on commit b374f8c

Please sign in to comment.