Skip to content

Commit

Permalink
Merge branch 'main' into doc/jupyter_examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys committed Feb 6, 2024
2 parents facd169 + 7fe1146 commit dfcc18b
Show file tree
Hide file tree
Showing 84 changed files with 86,112 additions and 608 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/cpython_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Linux_CPython_UnitTests

env:
python.version: '3.10'
python.venv: 'testvenv'
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_PIP_CACHE: 0
PACKAGE_NAME: PyAEDT


on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Linux CPython daily'
schedule: # UTC at 0100
- cron: '0 1 * * *'

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

jobs:
test:
runs-on: [Linux, pyaedt]
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x86'

- name: 'Install pyaedt'
run: |
python -m venv .pyaedt_test_env
export ANSYSEM_ROOT232=/apps/AnsysEM/v232/Linux64
export LD_LIBRARY_PATH=$ANSYSEM_ROOT232/common/mono/Linux64/lib64:$LD_LIBRARY_PATH
source .pyaedt_test_env/bin/activate
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U
python -c "import sys; print(sys.executable)"
pip install .[tests]
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pytest-azurepipelines
python -c "import pyaedt; print('Imported pyaedt')"
- name: 'Unit testing'
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 60
command: |
export ANS_NODEPCHECK=1
export ANSYSEM_ROOT232=/apps/AnsysEM/v232/Linux64
export LD_LIBRARY_PATH=$ANSYSEM_ROOT232/common/mono/Linux64/lib64:$LD_LIBRARY_PATH
source .pyaedt_test_env/bin/activate
pytest --tx 6*popen --durations=50 --dist loadfile -v _unittest
- name: 'Unit testing Solvers'
continue-on-error: true
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 60
command: |
export ANS_NODEPCHECK=1
export ANSYSEM_ROOT232=/apps/AnsysEM/v232/Linux64
export LD_LIBRARY_PATH=$ANSYSEM_ROOT232/common/mono/Linux64/lib64:$LD_LIBRARY_PATH
source .pyaedt_test_env/bin/activate
pytest --tx 2*popen --durations=50 --dist loadfile -v _unittest_solvers
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: junit/test-results.xml
if: ${{ always() }}
89 changes: 89 additions & 0 deletions .github/workflows/unit_test_prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI_PreRelease

env:
python.version: '3.8'
python.venv: 'testvenv'
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_PIP_CACHE: 0
PACKAGE_NAME: PyAEDT
# Controls when the workflow will run
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Linux CPython daily'
schedule: # UTC at 0300
- cron: '0 3 * * *'

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

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: [pre_release]
strategy:
matrix:
python-version: ['3.8']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: 'Create virtual env'
run: |
python -m venv testenv
testenv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: 'Install pyaedt'
run: |
testenv\Scripts\Activate.ps1
pip install .[tests]
pip install pytest-azurepipelines
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
Copy-Item -Path "C:\actions-runner\local_config.json" -Destination "_unittest" -Force
mkdir tmp
cd tmp
python -c "import pyaedt; print('Imported pyaedt')"
# - name: "Check licences of packages"
# uses: pyansys/pydpf-actions/[email protected]

- name: 'Unit testing'
timeout-minutes: 60
run: |
testenv\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest --tx 6*popen --durations=50 --dist loadfile -v --cov=pyaedt --cov-report=xml --junitxml=junit/test-results.xml --cov-report=html _unittest
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.python-version == '3.8'
name: 'Upload coverage to Codecov'

- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: junit/test-results.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

172 changes: 172 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: CI

env:
python.version: '3.10'
python.venv: 'testvenv'
# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it hasn't been deleted already.
# It applies 7 days retention policy by default.
RESET_PIP_CACHE: 0
PACKAGE_NAME: PyAEDT
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags:
- 'v*'
branches:
- main
pull_request:
branches: [ main ]

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

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build_solvers:
# The type of runner that the job will run on
runs-on: [ windows-latest, pyaedt ]
strategy:
matrix:
python-version: [ '3.10' ]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: 'Create virtual env'
run: |
Remove-Item D:\Temp\* -Recurse -Force -ErrorAction SilentlyContinue
python -m venv testenv_s
testenv_s\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: 'Install pyaedt'
run: |
testenv_s\Scripts\Activate.ps1
pip install .
pip install .[tests]
pip install pytest-azurepipelines
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv_s\Lib\site-packages\vtkmodules" -Force
mkdir tmp
cd tmp
python -c "import pyaedt; print('Imported pyaedt')"
# - name: "Check licences of packages"
# uses: pyansys/pydpf-actions/[email protected]

- name: 'Unit testing'
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 40
command: |
testenv_s\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest --durations=50 -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
name: 'Upload coverage to Codecov'

- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-solver-results
path: junit/test-results.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}


build:
# The type of runner that the job will run on
runs-on: [windows-latest, pyaedt]
strategy:
matrix:
python-version: ['3.10']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: 'Create virtual env'
run: |
Remove-Item D:\Temp\* -Recurse -Force -ErrorAction SilentlyContinue
python -m venv testenv
testenv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: 'Install pyaedt'
run: |
testenv\Scripts\Activate.ps1
pip install .
pip install .[tests]
pip install pytest-azurepipelines
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
mkdir tmp
cd tmp
python -c "import pyaedt; print('Imported pyaedt')"
# - name: "Check licences of packages"
# uses: pyansys/pydpf-actions/[email protected]

- name: 'Unit testing'
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 50
command: |
testenv\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest -n 6 --dist loadfile --durations=50 -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
name: 'Upload coverage to Codecov'

- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: junit/test-results.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

- name: 'Build and validate source distribution'
run: |
testenv\Scripts\Activate.ps1
python -m pip install build twine
python -m build
python -m twine check dist/*
- name: "Builds and uploads to PyPI"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
testenv\Scripts\Activate.ps1
python setup.py sdist
python -m pip install twine
python -m twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
11 changes: 4 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
files: |
(?x)(
^pyaedt/|
_unittest/|
requirements/requirements_docs.txt|
requirements/requirements_test.txt
_unittest/
)
exclude: |
(?x)(
Expand All @@ -17,7 +15,7 @@ exclude: |
repos:
- repo: https://github.com/psf/black
rev: 23.12.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
rev: 24.1.1 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
hooks:
- id: black
args:
Expand Down Expand Up @@ -47,21 +45,20 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: requirements-txt-fixer
- id: debug-statements
- id: trailing-whitespace

# validate GitHub workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.3
rev: 0.27.4
hooks:
- id: check-github-workflows

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.12.1]
additional_dependencies: [black==24.1.1]


# - repo: https://github.com/numpy/numpydoc
Expand Down
Loading

0 comments on commit dfcc18b

Please sign in to comment.