fix: Test fixes #978
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: | |
pull_request: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
- release/* | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
# 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_EXAMPLES_CACHE: 0 | |
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} | |
MAIN_PYTHON_VERSION: '3.9' | |
PYFLUENT_TIMEOUT_FORCE_EXIT: 5 | |
PYFLUENT_LAUNCH_CONTAINER: 1 | |
PYFLUENT_LOGGING: 'DEBUG' | |
PYFLUENT_WATCHDOG_DEBUG: 'OFF' | |
PYFLUENT_HIDE_LOG_SECRETS: 1 | |
jobs: | |
docs-style: | |
name: Documentation Style Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Running Vale | |
uses: errata-ai/vale-action@reviewdog | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
files: doc | |
reporter: github-pr-check | |
level: error | |
filter_mode: nofilter | |
fail_on_error: true | |
vale_flags: "--config=doc/.vale.ini" | |
tests: | |
name: Tests and coverage | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image-tag: v22.2.0 | |
version: 222 | |
- image-tag: v23.1.0 | |
version: 231 | |
- image-tag: v23.2.0 | |
version: 232 | |
- image-tag: v24.1.0 | |
version: 241 | |
- image-tag: v24.2.0 | |
version: 242 | |
- image-tag: v25.1.0 | |
version: 251 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Install pyfluent-parametric | |
run: make install | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.REPO_DOWNLOAD_PAT }} | |
- name: Pull Fluent docker image | |
run: make docker-pull | |
env: | |
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} | |
- name: Test with pytest | |
run: make unittest-${{ matrix.version }} | |
env: | |
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} | |
tests-self-hosted: | |
name: Self-hosted tests and coverage | |
runs-on: [self-hosted, pyfluent] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image-tag: v22.2.0 | |
version: 222 | |
- image-tag: v23.1.0 | |
version: 231 | |
- image-tag: v23.2.0 | |
version: 232 | |
- image-tag: v24.1.0 | |
version: 241 | |
- image-tag: v24.2.0 | |
version: 242 | |
- image-tag: v25.1.0 | |
version: 251 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Install pyfluent-parametric | |
run: make install | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.REPO_DOWNLOAD_PAT }} | |
- name: Pull Fluent docker image | |
run: make docker-pull | |
env: | |
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} | |
- name: Test with pytest | |
run: make unittest-self-hosted-${{ matrix.version }} | |
env: | |
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }} | |
docs: | |
name: Documentation | |
needs: [docs-style] | |
runs-on: [self-hosted, pyfluent] | |
env: | |
DOC_DEPLOYMENT_IMAGE_TAG: v24.2.0 | |
DOCUMENTATION_CNAME: 'parametric.fluent.docs.pyansys.com' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Install pyfluent-parametric | |
run: make install | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.REPO_DOWNLOAD_PAT }} | |
- name: Pull Fluent docker image | |
run: make docker-pull | |
env: | |
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} | |
- name: Retrieve pyfluent-parametric version | |
run: | | |
echo "::set-output name=PYFLUENT_PARAMETRIC_VERSION::$(python -c "from ansys.fluent.parametric import __version__; print(__version__)")" | |
echo "pyfluent-parametric version is: $(python -c "from ansys.fluent.parametric import __version__; print(__version__)")" | |
id: version | |
- name: Cache examples | |
uses: actions/cache@v3 | |
with: | |
path: doc/source/examples | |
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_PARAMETRIC_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**') }}-${{ github.sha }} | |
restore-keys: | | |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_PARAMETRIC_VERSION }}-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}-${{ hashFiles('examples/**') }} | |
- name: Generate the documentation | |
run: make build-doc | |
env: | |
FLUENT_IMAGE_TAG: ${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} | |
- name: Upload HTML Documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }} | |
path: doc/_build/html | |
retention-days: 7 | |
- name: Deploy | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev') | |
uses: ansys/actions/doc-deploy-stable@v5 | |
with: | |
doc-artifact-name: 'HTML-Documentation-tag-${{ env.DOC_DEPLOYMENT_IMAGE_TAG }}' | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build library | |
needs: [tests, tests-self-hosted, docs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- name: Add version information | |
run: make version-info | |
- name: Install dependencies and build the library | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements/requirements_build.txt | |
python -m build | |
python -m twine check dist/* | |
- name: Upload package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PyFluent-packages | |
path: | | |
dist/*.whl | |
dist/*.tar.gz | |
retention-days: 7 | |
release: | |
name: Release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
- uses: actions/download-artifact@v4 | |
- name: Display package file list | |
run: ls -R | |
- name: Upload to Private PyPi | |
run: | | |
pip install twine | |
python -m twine upload --skip-existing ./**/*.whl | |
python -m twine upload --skip-existing ./**/*.tar.gz | |
env: | |
TWINE_USERNAME: PAT | |
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} | |
TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload | |
- name: Upload to Public PyPi | |
run: | | |
pip install twine | |
twine upload --skip-existing ./**/*.whl | |
python -m twine upload --skip-existing ./**/*.tar.gz | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.ANSYS_FLUENT_PARAMETRIC_PYPI_TOKEN }} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./**/*.whl | |
./**/*.tar.gz |