Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
209 changes: 99 additions & 110 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,60 @@
# check spelling, codestyle
name: GitHub CI

# run only on main branch. This avoids duplicated actions on PRs
on:
workflow_dispatch:
pull_request:
push:
tags:
- "*"
branches:
- main

env:
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'ansys-tools-path'
PACKAGE_NAMESPACE: 'ansys.tools.path'
DOCUMENTATION_CNAME: 'path.tools.docs.pyansys.com'

jobs:
style:
name: Pre-commit Check
name: Code style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- name: PyAnsys code style checks
uses: pyansys/actions/code-style@v4
with:
python-version: 3.8

- name: Install pre-commit requirements
run: |
pip install pre-commit

- name: Run pre-commit
run: |
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
python-version: ${{ env.MAIN_PYTHON_VERSION }}

main:
smoke-tests:
name: "Build and smoke tests"
runs-on: ${{ matrix.os }}
needs: [style]
if: github.ref != 'refs/heads/main'
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# Only perform wheelhouse builds for macOS when releasing
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
- should-release: false
os: macos-latest
steps:
- name: "Build wheelhouse and perform smoke test"
uses: pyansys/actions/build-wheelhouse@v4
with:
library-name: ${{ env.PACKAGE_NAME }}
library-namespace: ${{ env.PACKAGE_NAMESPACE }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

build-tests:
name: Build and Testing
runs-on: ubuntu-latest
needs: [smoke-tests]
timeout-minutes: 20
container:
image: ghcr.io/pyansys/mapdl:v22.2-ubuntu
Expand All @@ -49,124 +71,91 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Create wheel
run: |
python -m pip install build
python -m build --wheel

- name: Validate wheel
run: |
python -m pip install twine
python -m twine check dist/*
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install library, with test extra
run: python -m pip install $(echo dist/*)[test]
run: python -m pip install .[test]

- name: Unit testing
run: |
cd tests # so we're testing the install, not local
python -m pytest -vx --cov=ansys.tools.path --cov-report=html
python -m pytest -vx --cov=${{ env.PACKAGE_NAMESPACE }} --cov-report=term --cov-report=xml:.cov/coverage.xml --cov-report=html:.cov/html

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: ansys-product-library-wheel
path: dist/
retention-days: 7
files: .cov/coverage.xml

docs:
name: Build Documentation
docs-style:
name: PyAnsys documentation style check using Vale
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- name: PyAnsys documentation style checks
uses: pyansys/actions/doc-style@v4
with:
python-version: 3.8
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install library, with docs extra
run: |
pip install .[doc]

- name: Build HTML
run: |
make -C doc html SPHINXOPTS="-W"

# - name: Build PDF Documentation
# run: |
# sudo apt update
# sudo apt-get install -y texlive-latex-extra latexmk
# make -C doc latexpdf

- name: Upload HTML Documentation
uses: actions/upload-artifact@v3
with:
name: Documentation-html
path: doc/_build/html
retention-days: 7

# - name: Upload PDF Documentation
# uses: actions/upload-artifact@v3
# with:
# name: Documentation-pdf
# path: doc/build/latex/*.pdf
# retention-days: 7

Release:
if: contains(github.ref, 'refs/tags')
needs: [main, style, docs]
docs:
name: Documentation
runs-on: ubuntu-latest
needs: [docs-style]
steps:
- name: Set up Python
uses: actions/setup-python@v4
- name: "Run Ansys documentation building action"
uses: pyansys/actions/doc-build@v4
with:
python-version: 3.9

- uses: actions/checkout@v3
python-version: ${{ env.MAIN_PYTHON_VERSION }}
dependencies: "build-essential zip pandoc texlive-latex-extra latexmk texlive-pstricks"

- uses: actions/download-artifact@v3
package:
name: Package library
needs: [build-tests, docs]
runs-on: ubuntu-latest
steps:
- name: Build library source and wheel artifacts
uses: pyansys/actions/build-library@v4
with:
name: ansys-product-library-wheel
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- uses: actions/download-artifact@v3
release:
name: Release project
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
needs: [package]
runs-on: ubuntu-latest
steps:
- name: Release to the public PyPI repository
uses: pyansys/actions/release-pypi-public@v4
with:
name: Documentation-pdf
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}

- uses: actions/download-artifact@v3
- name: Release to GitHub
uses: pyansys/actions/release-github@v4
with:
name: Documentation-html
path: ~/html

# list current directory
- name: List directory structure
run: ls -R
library-name: ${{ env.PACKAGE_NAME }}

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.4
upload_docs_dev:
name: Upload dev documentation
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [package]
steps:
- name: Deploy the latest documentation
uses: pyansys/actions/doc-deploy-dev@v4
with:
BRANCH: gh-pages
FOLDER: ~/html
CLEAN: true

# note how we use the PyPI tokens
- name: Upload to Azure PyPi (disabled)
run: |
pip install twine
# twine upload --skip-existing ./**/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
upload_docs_release:
name: Upload release documentation
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Deploy the stable documentation
uses: pyansys/actions/doc-deploy-stable@v4
with:
files: |
./**/*.whl
./**/*.zip
./**/*.pdf
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ questions or submissions to this repository.

For contributing to this project, please refer to the [PyAnsys Developer's Guide].
Further information about contributing to ansys-tools-path can be found in
[ansys-tools-path github page](hhttps://github.com/pyansys/ansys-tools-path).
[ansys-tools-path github page](https://github.com/pyansys/ansys-tools-path).

[PyAnsys Developer's Guide]: https://dev.docs.pyansys.com/
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ For developers
Installing ``ansys-tools-path`` in developer mode allows
you to modify the source and enhance it.

Before contributing to the project, please refer to the `PyAnsys Developer's guide`_. You will
need to follow these steps:
Before contributing to the project, please refer to the `PyAnsys Developer's guide`_.
You need to follow these steps:

#. Start by cloning this repository:

Expand Down
21 changes: 21 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
comment:
layout: "diff"
behavior: default
require_changes: true # Avoid coverage comment if no files are changed.

coverage:
range: 70..100
round: down
precision: 2
status:
project:
default:
target: 85%
patch:
default:
# basic
target: 90%
if_not_found: success
if_ci_failed: error
if_no_uploads: error
threshold: 4% # Because some tests are flaky.
8 changes: 7 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ help:

.PHONY: help Makefile


# customized pdf due to svg issue
pdf:
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
(test -f $(BUILDDIR)/latex/ansys-tools*.pdf && echo pdf exists) || exit 1

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


# Customized clean due to examples gallery
clean:
rm -rf $(BUILDDIR)/*
Expand Down
2 changes: 1 addition & 1 deletion doc/source/_static/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Static files will be found here (like images and other assets).
Static files are found here (like images and other assets).