Bump notebook from 7.2.1 to 7.2.2 (#192) #763
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GitHub CI | |
# 'on' controls when this script is run. | |
on: | |
pull_request: # This means every time a PR is made, the script runs. | |
workflow_dispatch: # This means when looking at the repo, you can click 'actions' then 'GitHub CI', and select 'Run Workflow' on any targets branch . | |
push: # This means after a push (to main branch) This script also runs, just to be sure everything is fine. | |
tags: | |
- "v*" | |
branches: | |
- main | |
# Environment Variables | |
env: | |
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} | |
MAIN_PYTHON_VERSION: '3.10' # We need 3.9 for building sphinx | |
LIBRARY_NAME: 'ansys-turbogrid-core' # The repo name | |
LIBRARY_NAMESPACE: 'ansys.turbogrid.core' | |
DOCUMENTATION_CNAME: 'turbogrid.docs.pyansys.com' | |
#PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/' | |
# This deals with concurrent runs of this script. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true # This means multiple runs of the same script on the same branch will cancel the oldest ones. | |
# Under here we have the scheduler graph of all the jobs, each being a vertex, directed by the 'needs:' fields (needs describes a child node). | |
jobs: | |
# The style job will fail if any changes are needed by any styler. | |
# The best way to avoid these failures is to install the styler on your vscode, with format-on-save. | |
# There are numerous internet tutorials to follow for all the installation and settings configurations. | |
code-style: | |
name: "Code Style Checks" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Ansys code style checks" | |
uses: ansys/actions/code-style@v7 # This action looks in .pre-commit-config.yaml for code check tasks. | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
docs-style: | |
name: "Documentation Style Checks" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Ansys documentation style checks | |
uses: ansys/actions/doc-style@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prereqs: | |
name: "Pre-requisites for docs and tests" | |
runs-on: ubuntu-latest | |
needs: [code-style, docs-style] | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull TurboGrid Linux Image | |
run: | | |
docker network ls | |
docker pull ghcr.io/ansys/ansys-api-turbogrid/tglin_reduced_ndf:242 | |
- name: Save Docker image to a file | |
run: docker save -o image.tar ghcr.io/ansys/ansys-api-turbogrid/tglin_reduced_ndf:242 | |
- name: Cache Docker image file | |
uses: actions/cache@v4 | |
with: | |
path: image.tar | |
key: myimage-${{ github.sha }} | |
restore-keys: myimage- | |
docs-build: | |
name: "Build documentation" | |
runs-on: ubuntu-latest | |
needs: [prereqs] | |
env: | |
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} | |
PYTURBOGRID_DOC_VERSION: 242 | |
PYTURBOGRID_DOC_ENGINE_CONNECTION: 6000 | |
steps: | |
- name: Restore Cached Docker image file | |
uses: actions/cache@v4 | |
with: | |
path: image.tar | |
key: myimage-${{ github.sha }} | |
restore-keys: myimage- | |
- name: Load Docker image from file | |
run: docker load -i image.tar | |
- uses: ansys/actions/doc-build@v7 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
wheelhouse: | |
name: "Build wheelhouse for ${{ matrix.os }} and Python ${{ matrix.python-version }}" | |
runs-on: ${{ matrix.os }} | |
needs: [code-style] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: ansys/actions/build-wheelhouse@v7 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
operating-system: ${{ matrix.os }} | |
python-version: ${{ matrix.python-version }} | |
smoke-tests: | |
name: "Build wheelhouse and Test for ${{ matrix.os }} and Python ${{ matrix.python-version }}" | |
runs-on: ${{ matrix.os }} | |
needs: [prereqs] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: ansys/actions/build-wheelhouse@v7 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
operating-system: ${{ matrix.os }} | |
python-version: ${{ matrix.python-version }} | |
- name: Restore Cached Docker image file | |
uses: actions/cache@v4 | |
with: | |
path: image.tar | |
key: myimage-${{ github.sha }} | |
restore-keys: myimage- | |
- name: Load Docker image from file | |
run: docker load -i image.tar | |
- name: Create Key | |
run: base64 -d <<< ${{ secrets.CONTAINER_ACCESS_KEY }} > tg_container_key | |
# uses: mobiledevops/secret-to-file-action@v1 | |
# with: | |
# base64-encoded-secret: ${{ secrets.CONTAINER_ACCESS_KEY }} | |
# filename: "tg_container_key" | |
# working-directory: "." | |
- name: Check if file exists | |
id: check_file | |
run: | | |
if [ -f "tg_container_key" ]; then | |
echo "File 'tg_container_key' exists and its size is $(stat -c%s tg_container_key) bytes" | |
else | |
echo "File tg_container_key does not exist" | |
exit 1 | |
fi | |
- name: Run Unit Tests | |
run: | | |
docker image ls | |
pip install pytest | |
pip install pytest-cov | |
pip install fabric | |
pip install . | |
python3 -u -m pytest -vs --execution_mode=CONTAINERIZED --license_file=${{ env.ANSYSLMD_LICENSE_FILE }} --image_name=ghcr.io/ansys/ansys-api-turbogrid/tglin_reduced_ndf:242 --cfxtg_command_name=cfxtgpynoviewer --cfx_version=242 --ssh_key_filename=./tg_container_key --local_cfxtg_path="/" --container_env_dict='{"CUE_DEBUG_PY_COMMS":"1"}' | |
# The build job is responsible for creating the build artifact and uploading it to PYPI using twine. | |
build-library: | |
name: Build library | |
needs: [wheelhouse, smoke-tests, docs-build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Build library source and wheel artifacts" | |
uses: ansys/actions/build-library@v7 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
# Only a tagged commit that begins with 'v' will get pushed to the index. | |
# The developer MUST make sure that: | |
# 1. The commit has this tag. The actual package version is taken from __init__.py's __version__. | |
# 2. The commit is done within a matching branch release/v* | |
# 3. The file src\ansys\turbogrid\core\__init__.py's __version__ is updated to match the above 2. | |
release: | |
name: Release project | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [build-library] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Release to the private PyPI repository" | |
uses: ansys/actions/release-pypi-private@v7 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
twine-username: "__token__" | |
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} | |
- name: Release to the public PyPI repository | |
uses: ansys/actions/release-pypi-public@v7 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
twine-username: "__token__" | |
twine-token: ${{ secrets.PYPI_TOKEN }} | |
- name: "Release to GitHub" | |
uses: ansys/actions/release-github@v7 | |
with: | |
library-name: ${{ env.LIBRARY_NAME }} | |
doc-deploy-dev: | |
name: "Deploy development documentation" | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: [build-library] | |
steps: | |
- uses: ansys/actions/doc-deploy-dev@v7 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-deploy-stable: | |
name: "Deploy stable documentation" | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
needs: [release] | |
steps: | |
- uses: ansys/actions/doc-deploy-stable@v7 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} |