Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
948fc3a
maint: Complete CICD
AlejandroFernandezLuces Jul 23, 2025
883b4fc
maint: Add doc style action
AlejandroFernandezLuces Jul 23, 2025
93adcce
fix: Doc style fixes
AlejandroFernandezLuces Jul 23, 2025
fe70d64
fix: PyMAPDL container name
AlejandroFernandezLuces Jul 23, 2025
f851095
fix: Ignore rst code blocks
AlejandroFernandezLuces Jul 23, 2025
5e5587b
fix: Vale ini
AlejandroFernandezLuces Jul 23, 2025
4abcd77
fix: Accept words
AlejandroFernandezLuces Jul 23, 2025
87c27f8
Merge branch 'main' into maint/finish-cicd
AlejandroFernandezLuces Jul 23, 2025
45bcf87
fix: Add changelog missing line, add private PyPI
AlejandroFernandezLuces Jul 24, 2025
f1c8947
Merge branch 'maint/finish-cicd' of https://github.com/ansys-internal…
AlejandroFernandezLuces Jul 24, 2025
ecccef0
fix: CICD file
AlejandroFernandezLuces Jul 24, 2025
4ccfef8
fix: Missing changelog config
AlejandroFernandezLuces Jul 24, 2025
142806b
chore: adding changelog file 34.maintenance.md [dependabot-skip]
pyansys-ci-bot Jul 24, 2025
b8c376c
fix: Temporary allow vulnerability logs
AlejandroFernandezLuces Jul 24, 2025
4dc0080
Merge branch 'maint/finish-cicd' of https://github.com/ansys-internal…
AlejandroFernandezLuces Jul 24, 2025
9085730
fix: Remove changelog
AlejandroFernandezLuces Jul 24, 2025
e6da613
fix: Upload reports
AlejandroFernandezLuces Jul 24, 2025
6ddf974
fix: remove vulnerabilites publication
AlejandroFernandezLuces Jul 24, 2025
9c098bd
fix: Vulnerability
AlejandroFernandezLuces Jul 24, 2025
f20eeca
fix: Tests
AlejandroFernandezLuces Jul 28, 2025
043424a
fix: Comment out vuln action until release
AlejandroFernandezLuces Jul 28, 2025
427881a
fix: Add TODOs for release
AlejandroFernandezLuces Jul 28, 2025
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
97 changes: 86 additions & 11 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,36 @@ on:
env:
PACKAGE_NAME: ansys-tools-common
MAIN_PYTHON_VERSION: 3.13
DOCUMENTATION_CNAME: bookish-adventure-16g5prl.pages.github.io
DOCUMENTATION_CNAME: tools.docs.pyansys.com

jobs:

update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@v10
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

# TODO uncomment after the first public release
# check-vulnerabilities:
# name: "Check library vulnerabilities"
# runs-on: ubuntu-latest
# steps:
# - uses: ansys/actions/check-vulnerabilities@v10.0
# with:
# python-version: ${{ env.MAIN_PYTHON_VERSION }}
# token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
# python-package-name: ${{ env.PACKAGE_NAME }}
# dev-mode: ${{ github.ref != 'refs/heads/main' }}

style:
name: Code style
runs-on: ubuntu-latest
Expand All @@ -40,8 +67,8 @@ jobs:
python-version: ${{ matrix.python-version }}
whitelist-license-check: "termcolor" # Has MIT license, but it's not recognized

build-tests:
name: Build and Testing
tests:
name: Testing
runs-on: ubuntu-latest
needs: [smoke-tests]
env:
Expand Down Expand Up @@ -75,8 +102,18 @@ jobs:
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v10
with:
token: ${{ secrets.GITHUB_TOKEN }}

doc-build:
name: Build documentation
needs: [docs-style]
runs-on: ubuntu-latest
steps:
- name: Build documentation
Expand All @@ -88,24 +125,62 @@ jobs:
package:
name: Package library
runs-on: ubuntu-latest
needs: [smoke-tests]
needs: [tests, doc-build]
steps:
- name: Build library source and wheel artifacts
uses: ansys/actions/build-library@v10
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

upload_dev_docs:
name: Upload dev documentation
if: github.ref == 'refs/heads/main'
release:
name: Release project
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
needs: [package]
runs-on: ubuntu-latest
needs: [doc-build]
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v10
- name: "Download the library artifacts from build-library step"
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ env.PACKAGE_NAME }}-artifacts
path: ${{ env.PACKAGE_NAME }}-artifacts

# TODO uncomment after the first public release
# - name: "Upload artifacts to PyPI using trusted publisher"
# uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
# with:
# repository-url: "https://upload.pypi.org/legacy/"
# print-hash: true
# packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
# skip-existing: false

- name: "Release to the private PyPI repository"
uses: ansys/actions/release-pypi-private@v9
with:
library-name: "ansys-api-meshing-maestro"
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}

- name: Release to GitHub
uses: ansys/actions/release-github@v10
with:
token: ${{ secrets.GITHUB_TOKEN }}
library-name: ${{ env.PACKAGE_NAME }}

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: ansys/actions/doc-deploy-stable@v10
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 }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
115 changes: 115 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Labeler
on:
pull_request:
# opened, reopened, and synchronize are default for pull_request
# edited - when PR title or body is changed
# labeled - when labels are added to PR
types: [opened, reopened, synchronize, edited, labeled]
push:
branches: [ main ]
paths:
- '../labels.yml'

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

jobs:

label-syncer:
name: Syncer
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

labeler:
name: Set labels
needs: [label-syncer]
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:

# Label based on modified files
- name: Label based on changed files
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true

# Label based on branch name
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
if: |
startsWith(github.event.pull_request.head.ref, 'doc') ||
startsWith(github.event.pull_request.head.ref, 'docs')
with:
labels: documentation
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
if: |
startsWith(github.event.pull_request.head.ref, 'maint') ||
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
startsWith(github.event.pull_request.head.ref, 'ci')
with:
labels: maintenance
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
if: startsWith(github.event.pull_request.head.ref, 'feat')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: |
enhancement

- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
if: |
startsWith(github.event.pull_request.head.ref, 'fix') ||
startsWith(github.event.pull_request.head.ref, 'patch')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: bug

commenter:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Suggest to add labels
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
# Execute only when no labels have been applied to the pull request
if: toJSON(github.event.pull_request.labels.*.name) == '{}'
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Please add one of the following labels to add this contribution to the Release Notes :point_down:
- [bug](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Abug+)
- [documentation](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Adocumentation+)
- [enhancement](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Aenhancement+)
- [good first issue](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Agood+first+issue)
- [maintenance](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Amaintenance+)
- [release](https://github.com/ansys-internal/ansys-tools-common/pulls?q=label%3Arelease+)

changelog-fragment:
name: "Create changelog fragment"
needs: [labeler]
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-changelog@v10
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
use-conventional-commits: true
use-default-towncrier-config: true
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
2 changes: 1 addition & 1 deletion .github/workflows/run_mapdl_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
build-tests:
runs-on: ubuntu-22.04
container:
image: ghcr.io/ansys/pymapdl/mapdl:v22.2-ubuntu
image: ghcr.io/ansys/mapdl:v22.2-ubuntu
options: "-u=0:0 --entrypoint /bin/bash"
credentials:
username: ${{ secrets.GH_USERNAME }}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This document contains the release notes for the project. See release notes for v{latest-version} and earlier
in `CHANGELOG.md <https://github.com/ansys-internal/ansys-tools-common/blob/main/CHANGELOG.md>`_.
<!-- towncrier release notes start -->
4 changes: 3 additions & 1 deletion doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ Vocab = ANSYS
[*.{rst}]
BasedOnStyles = Vale, Google
Vale.Terms = NO
Google.Headings = NO
Google.Headings = NO
SkippedScopes = script, style, pre, figure, code-block, literal-block

1 change: 1 addition & 0 deletions doc/changelog.d/34.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Finish cicd
5 changes: 5 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
},
}

linkcheck_ignore = []

if switcher_version != "dev":
linkcheck_ignore.append(f"https://github.com/ansys-internal/ansys-tools-common/releases/tag/v{__version__}")

# Sphinx extensions
extensions = [
"sphinx.ext.intersphinx",
Expand Down
2 changes: 1 addition & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contribute
Overall guidance on contributing to a PyAnsys library appears in the
`Contributing <https://dev.docs.pyansys.com/how-to/contributing.html>`_ topic
in the *PyAnsys developer's guide*. Ensure that you are thoroughly familiar
with this guide before attempting to contribute to the Ansys tools common repo.
with this guide before attempting to contribute to the Ansys tools common repository.

The following contribution information is specific to the Ansys tools common.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ The Ansys tools project is a collection of tools for the PyAnsys ecosystem.
getting_started/index
user_guide/index
api/index
contributing
contributing
14 changes: 12 additions & 2 deletions doc/styles/config/vocabularies/ANSYS/accept.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
(?i)Ansys
pytest
ANS
astroid
astroid
downloader
mypy
pytest
pathing
subprocess


s.P
e.M
terminate
kill
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies = [
"scooby>=0.5.12",
"appdirs>=1.4.4",
"typing-extensions>=4.5.0",
"requests>=2.32.4",
]

[project.optional-dependencies]
Expand Down
31 changes: 19 additions & 12 deletions src/ansys/tools/common/example_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
import tempfile
from threading import Lock
from typing import Optional
from urllib.parse import urljoin
import urllib.request
from urllib.parse import urljoin, urlparse

import requests

__all__ = ["DownloadManager"]

Expand Down Expand Up @@ -186,17 +187,23 @@ def _retrieve_data(self, url: str, filename: str, dest: str = None, force: bool
str
The local path where the file was saved.
"""
local_path = ""
if dest is None:
dest = tempfile.gettempdir() # Use system temp directory if no destination is provided
local_path = Path(dest) / Path(filename).name
if not force and Path(local_path).is_file():
return local_path
try:
local_path, _ = urllib.request.urlretrieve(url, filename=local_path)
except urllib.error.HTTPError:
raise FileNotFoundError(f"Failed to download {filename} from {url}, file does not exist.")
return local_path
dest = tempfile.gettempdir()
local_path = Path(dest) / Path(filename).name

if not force and local_path.is_file():
return str(local_path)

parsed_url = urlparse(url)
if parsed_url.scheme not in ("http", "https"):
raise ValueError(f"Unsafe URL scheme: {parsed_url.scheme}")

response = requests.get(url, timeout=60)
response.raise_for_status()

Path(local_path).write_bytes(response.content)

return str(local_path)


# Create a singleton instance of DownloadManager
Expand Down
Loading
Loading