Skip to content

Commit

Permalink
maint: Technical review (#18)
Browse files Browse the repository at this point in the history
* fix: Format toml

* Changes from PyAnsys Tech Review

- Format pyproject.toml with proper indents and spaces.
- Add test and doc dependencies.
- Lock doc and test dependencies, add dependency versions where missing.
- Add CONTRIBUTING.md file.

* fix tech review isssues

* Move test_examples to test folder

* fix comments

* revert necessary unused parameters

* Add smoke tests

* Add code style and doc style check

* rework testing in CICD

* update pre-commit

* Update minimum python version

* fix: vale issues

* test python version

* test updating powershell

* test update powershell

* remove python setup

* fix bug

* Add license headers action

* test pytests folder

* remove examples execution, downgrade python setup

* fix bug

* test venv removal

* use ansys action for building docs

* revert changes

* add release actions

* Simplify doc building

* rework cicd

* Get version from toml

* Add missing comments

* Rename job

* fix version in conf.py

* fix bug in doc building

* remove potentially problematic lines

* test revert

* add python setup

* test invert install

* use bat instead of ps1

* fix make pdf

* remove pdf build and upload

* Add PDF building again

* force rerun

* force rerun

* fix comments

* add favicon

* format cicd

* fix: Add landing page instead of using readme

* fix: Add sphinx_design extension

* fix: reorder CICD

* fix: icon

* fix: Documentation linking in examples

* fix: Add missing underscore

* Force workflows

* force workflows

* fix: Add proper name to pdf

* fix: README title

* ferat: add start year to license headers

* fix;: change build system to flit

* feat: Add badges

* feat: Add year to licenses

* fix: Add proper links in badges

* feat: Add contributors file

* feat: Implement and comment out codecov step

* feat: Add autoapi config

* fix: Add missing reference to API

* fix: Add autoAPI extension

* feat: Add card for API reference

* feat: Add API to gitignore

* feat: Add authors file, remove ansys-internal to ansys

* feat: updating contributors (after PR is merged)

* Update src/ansys/rocky/core/client.py

Co-authored-by: Igor T. Ghisi <[email protected]>

* fix: Issue with suggestion

---------

Co-authored-by: Igor T. Ghisi <[email protected]>
Co-authored-by: Roberto Pastor Muela <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2024
1 parent def9bd8 commit 287e97b
Show file tree
Hide file tree
Showing 31 changed files with 859 additions and 151 deletions.
34 changes: 34 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/"
insecure-external-code-execution: allow
schedule:
interval: "weekly"
labels:
- "maintenance"
- "dependencies"
groups:
general-dependencies:
patterns:
- "*"
exclude-patterns:
- "*sphinx*"
- "numpydoc"
- "pyvista*"
- "pytest*"
test-dependencies:
patterns:
- "pytest*"
doc-dependencies:
patterns:
- "*sphinx*"
- "numpydoc"
pyvista:
patterns:
- "pyvista*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
11 changes: 11 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
documentation:
- changed-files:
- any-glob-to-any-file: ['doc/source/**/*', 'README.md']

maintenance:
- changed-files:
- any-glob-to-any-file: ['.github/**/*', '.flake8', 'pyproject.toml', 'tox.ini', '.pre-commit-config.yaml']

testing:
- changed-files:
- any-glob-to-any-file: ['tests/*']
35 changes: 35 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- name: bug
description: Something isn't working
color: d42a34

- name: dependencies
description: Related with project dependencies
color: ffc0cb

- name: documentation
description: Improvements or additions to documentation
color: 0677ba

- name: enhancement
description: New features or code improvements
color: FFD827

- name: good first issue
description: Easy to solve for newcomers
color: 62ca50

- name: maintenance
description: Package and maintenance related
color: f78c37

- name: release
description: Anything related to an incoming release
color: ffffff

- name: testing
description: Anything related to tests
color: BFE4D6

- name: security
description: Anything related to security advisories
color: FF0000
169 changes: 134 additions & 35 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,48 @@ concurrency:
cancel-in-progress: true

jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
vale-config: "doc/.vale.ini"
vale-version: "2.29.6"

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

smoke-tests:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
needs: style
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
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: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.LIBRARY_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}


tests:
name: Tests
Expand All @@ -26,38 +68,36 @@ jobs:
env:
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}


steps:
- uses: actions/checkout@v4

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

- name: Create Python venv
run: |
python -m venv .venv
.venv/Scripts/activate.bat
pip install -e .[dev]
- name: "Test"
- name: Install packages for tests
run: |
.venv/Scripts/activate.bat
pre-commit run --all-files --show-diff-on-failure
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install .[test]
pytest tests --junitxml=build/tests.xml
- name: "Check Examples"
- name: "Run unit tests"
run: |
.venv/Scripts/activate.bat
pytest test_examples.py --junitxml=build/tests-examples.xml
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Pytest Report
path: build/tests.xml # Path to test results
reporter: java-junit
.\.venv\Scripts\Activate.ps1
pytest tests
# - uses: codecov/codecov-action@v3
# name: 'Upload coverage to CodeCov'
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# files: .cov/xml

docs_build:
name: Build Documentation
Expand All @@ -68,33 +108,79 @@ jobs:
steps:
- uses: actions/checkout@v4

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

- name: Create Python venv
run: |
python -m venv .venv
.venv/Scripts/activate.bat
pip install -e .[dev]
- name: Install packages for documentation build
run: |
.\.venv\Scripts\Activate.bat
pip install msvc-runtime
pip install .[doc]
- name: Build Source Documentation
- name: Build Source Documentation (HTML)
run: |
.venv/Scripts/activate.bat
.\.venv\Scripts\Activate.bat
doc\make.bat html
- name: Zip HTML Documentation before upload
run: python doc\compress_doc.py HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}

- name: Upload HTML Documentation
uses: actions/upload-artifact@v3
with:
name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}
path: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}.zip
name: documentation-html
path: doc/_build/html
retention-days: 7

- name: Build Source Documentation (PDF)
run: |
.\.venv\Scripts\Activate.bat
doc\make.bat pdf
- name: Upload PDF documentation
uses: actions/upload-artifact@v4
with:
name: documentation-pdf
path: doc/_build/latex/*.pdf
retention-days: 7

package:
name: Package library
needs: [tests, docs_build]
runs-on: ubuntu-latest
steps:
- name: Build library source and wheel artifacts
uses: ansys/actions/build-library@v5
with:
library-name: ${{ env.LIBRARY_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

# Uncomment when ready to release
release:
name: Release project
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [package]
runs-on: ubuntu-latest
steps:
# - name: Release to the public PyPI repository
# uses: ansys/actions/release-pypi-public@v5
# with:
# library-name: ${{ env.LIBRARY_NAME }}
# twine-username: "__token__"
# twine-token: ${{ secrets.PYPI_TOKEN }}

- name: Release to GitHub
uses: ansys/actions/release-github@v5
with:
library-name: ${{ env.LIBRARY_NAME }}

doc-deploy-dev:
upload_docs_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')
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: docs_build
steps:
Expand All @@ -103,4 +189,17 @@ jobs:
doc-artifact-name: 'HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}'
decompress-artifact: true
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

upload_docs_release:
name: "Deploy stable documentation"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev')
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ instance/

# Sphinx documentation
doc/_build/

doc/source/examples
doc/source/api
# PyBuilder
.pybuilder/
target/
Expand Down
19 changes: 13 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
repos:

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.12.1
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8

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

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.22.0
rev: 0.27.3
hooks:
- id: check-github-workflows

- repo: https://github.com/ansys/pre-commit-hooks
rev: v0.2.8
hooks:
- id: add-license-headers
args:
- --start_year=2023
12 changes: 12 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is the list of PyRocky's significant contributors.
#
# This file does not necessarily list everyone who has contributed code.
#
# For contributions made under a Corporate CLA, the organization is
# added to this file.
#
# If you have contributed to the repository and wish to be added to this file
# please submit a request.
#
#
ANSYS, Inc.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contributing

For contributing to this project, please refer to the [PyAnsys Developer's Guide].

[PyAnsys Developer's Guide]: https://dev.docs.pyansys.com/how-to/contributing.html
12 changes: 12 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Contributors

## Project Lead

* [Igor Ghisi](https://github.com/igortg)

## Individual Contributors

* [Alejandro Fernández Luces](https://github.com/AlejandroFernandezLuces)
* [Gustavo Corrêa Martins](https://github.com/gcmartins)
* [Jorge Martínez Garrido](https://github.com/jorgepiloto)
* [Roberto Pastor Muela](https://github.com/RobPasMue)
Loading

0 comments on commit 287e97b

Please sign in to comment.