Skip to content

Commit

Permalink
Merge branch 'feat/main_commands' into feat/apdl_submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
clatapie committed Jan 8, 2025
2 parents e94c16d + 72f928f commit 759a519
Show file tree
Hide file tree
Showing 172 changed files with 1,720 additions and 891 deletions.
13 changes: 8 additions & 5 deletions .ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ versions=(
# if added more "latest", change "$LATEST"
'latest-ubuntu'
'latest-ubuntu-student'
'v25.2.0'
'v25.1.0'
'v25.1-ubuntu'
'v25.1-ubuntu-student'
'v24.2.0'
'v24.2-ubuntu'
'v24.2-ubuntu-student'
Expand Down Expand Up @@ -95,11 +98,11 @@ for version in "${versions[@]}"; do
fi

# Skipping student versions on auth_user
if [[ "$auth_user" == "true" && "$ON_STUDENT" == "true" ]]; then
echo "Skipping student versions when user is authenticated"
echo ""
continue
fi
# if [[ "$auth_user" == "true" && "$ON_STUDENT" == "true" ]]; then
# echo "Skipping student versions when user is authenticated"
# echo ""
# continue
# fi

# main logic
if [[ "$auth_user" == "true" ]]; then
Expand Down
12 changes: 12 additions & 0 deletions .ci/collect_mapdl_logs_locals.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES"

cp *.log ./"$LOG_NAMES"/ || echo "No log files could be found"
cp *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
cp *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"


ls -la ./"$LOG_NAMES"

echo "Tar files..."
tar cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
File renamed without changes.
19 changes: 19 additions & 0 deletions .ci/display_logs_locals.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

#####
# Displaying files
FILE_PAT=./"$LOG_NAMES"/pymapdl.log
FILE_DESCRIPTION="PyMAPDL log"

if compgen -G "$FILE_PAT" > /dev/null ;then for f in "$FILE_PAT"; do echo "::group:: $FILE_DESCRIPTION: $f" && cat "$f" && echo "::endgroup::" ; done; fi || echo "Failed to show $FILE_DESCRIPTION file"

#####
FILE_PAT=./"$LOG_NAMES"/pymapdl.apdl
FILE_DESCRIPTION="PyMAPDL APDL log"

if compgen -G "$FILE_PAT" > /dev/null ;then for f in "$FILE_PAT"; do echo "::group:: $FILE_DESCRIPTION: $f" && cat "$f" && echo "::endgroup::" ; done; fi || echo "Failed to show $FILE_DESCRIPTION file"

#####
FILE_PAT=./"$LOG_NAMES"/apdl.out
FILE_DESCRIPTION="MAPDL Output"

if compgen -G "$FILE_PAT" > /dev/null ;then for f in "$FILE_PAT"; do echo "::group:: $FILE_DESCRIPTION: $f" && cat "$f" && echo "::endgroup::" ; done; fi || echo "Failed to show $FILE_DESCRIPTION file"
File renamed without changes.
6 changes: 6 additions & 0 deletions .ci/requirements_minimal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pyfakefs==5.7.2
pytest-cov==6.0.0
pytest-random-order==1.1.1
pytest-rerunfailures==15.0
pytest-timeout==2.3.1
pytest==8.3.4
193 changes: 184 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
PACKAGE_NAME: 'ansys-mapdl-core'
PACKAGE_NAMESPACE: 'ansys.mapdl.core'
DOCUMENTATION_CNAME: 'mapdl.docs.pyansys.com'
LATEST_VERSION: "242"
LATEST_VERSION: "252"
MAPDL_IMAGE_VERSION_DOCS_BUILD: v24.2-ubuntu-student
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
Expand All @@ -33,9 +33,11 @@ env:
DPF_PORT: 21004
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
ON_CI: True
PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=10 --random-order --random-order-bucket=class --maxfail=100 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html'
PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=10 --random-order --random-order-bucket=class --maxfail=100 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180'


BUILD_CHEATSHEET: True
PYMAPDL_DEBUG_TESTING: True

# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
Expand All @@ -62,7 +64,6 @@ permissions:

jobs:


update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
Expand Down Expand Up @@ -128,6 +129,7 @@ jobs:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
whitelist-license-check: "attrs" # This has MIT license but fails the check

- name: "Importing library"
run: |
Expand All @@ -149,6 +151,8 @@ jobs:
python-package-name: ${{ env.PACKAGE_NAME }}
dev-mode: ${{ github.ref != 'refs/heads/main' }}
upload-reports: True
hide-log: false


docs-build:
name: "Build documentation"
Expand Down Expand Up @@ -336,7 +340,7 @@ jobs:
MAPDL_INSTANCE: MAPDL_0
LOG_NAMES: logs-build-docs
run: |
.ci/collect_mapdl_logs.sh
.ci/collect_mapdl_logs_remote.sh
- name: "Upload logs to GitHub"
if: always()
Expand All @@ -351,7 +355,7 @@ jobs:
MAPDL_INSTANCE: MAPDL_0
LOG_NAMES: logs-build-docs
run: |
.ci/display_logs.sh
.ci/display_logs_remote.sh
build-test-remote-matrix:
name: "Build remote test matrix"
Expand Down Expand Up @@ -576,7 +580,7 @@ jobs:
MAPDL_INSTANCE: MAPDL_0
LOG_NAMES: logs-remote-${{ matrix.mapdl-version }}
run: |
.ci/collect_mapdl_logs.sh
.ci/collect_mapdl_logs_remote.sh
- name: "Upload logs to GitHub"
if: always()
Expand All @@ -591,7 +595,7 @@ jobs:
MAPDL_INSTANCE: MAPDL_0
LOG_NAMES: logs-remote-${{ matrix.mapdl-version }}
run: |
.ci/display_logs.sh
.ci/display_logs_remote.sh
build-test-local-minimal-matrix:
name: "Build test matrix for minimal and local"
Expand All @@ -615,7 +619,7 @@ jobs:
- id: set-matrix
env:
ONLY_UBUNTU: true
LIMIT_VERSIONS: 3
LIMIT_VERSIONS: 2
ON_SCHEDULE: ${{ github.event_name == 'schedule' }}
ON_WORKFLOW_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
RUN_ALL_TEST: ${{ inputs.run_all_tests }}
Expand Down Expand Up @@ -713,6 +717,27 @@ jobs:
--reset_only_failed --add_missing_images \
--cov-report=xml:${{ matrix.mapdl-version }}-local.xml
- name: "Collect logs on failure"
if: always()
env:
LOG_NAMES: logs-local-${{ matrix.mapdl-version }}
run: |
.ci/collect_mapdl_logs_locals.sh
- name: "Upload logs to GitHub"
if: always()
uses: actions/upload-artifact@master
with:
name: logs-local-${{ matrix.mapdl-version }}.tgz
path: ./logs-local-${{ matrix.mapdl-version }}.tgz

- name: "Display files structure"
if: always()
env:
LOG_NAMES: logs-local-${{ matrix.mapdl-version }}
run: |
.ci/display_logs_locals.sh
- name: "Adding the directory as safe directory for later step"
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
Expand Down Expand Up @@ -821,7 +846,7 @@ jobs:
- name: "Unit testing requirements installation"
run: |
python -m pip install pytest pytest-rerunfailures pytest-cov pytest-random-order
python -m pip install -r .ci/requirements_minimal.txt
- name: "Unit testing"
env:
Expand Down Expand Up @@ -850,6 +875,27 @@ jobs:
${{ env.PYTEST_ARGUMENTS }} \
--cov-report=xml:${{ matrix.mapdl-version }}-minimal.xml
- name: "Collect logs on failure"
if: always()
env:
LOG_NAMES: logs-minimal-${{ matrix.mapdl-version }}
run: |
.ci/collect_mapdl_logs_locals.sh
- name: "Upload logs to GitHub"
if: always()
uses: actions/upload-artifact@master
with:
name: logs-minimal-${{ matrix.mapdl-version }}.tgz
path: ./logs-minimal-${{ matrix.mapdl-version }}.tgz

- name: "Display files structure"
if: always()
env:
LOG_NAMES: logs-minimal-${{ matrix.mapdl-version }}
run: |
.ci/display_logs_locals.sh
- uses: codecov/codecov-action@v5
name: "Upload coverage to Codecov"
with:
Expand All @@ -865,6 +911,135 @@ jobs:
path: ./${{ matrix.mapdl-version }}-minimal.xml


build-test-ubuntu-console:
name: "Local-min-console: ${{ matrix.mapdl-version }}"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [smoke-tests, build-test-local-minimal-matrix]
timeout-minutes: 75
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build-test-local-minimal-matrix.outputs.matrix)}}
container:
image: ghcr.io/ansys/mapdl:${{ matrix.mapdl-version }}
options: -u=0:0 --oom-kill-disable --memory=6656MB --memory-swap=16896MB --shm-size=1gb --entrypoint /bin/bash
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
ON_LOCAL: true
ON_UBUNTU: true
TESTING_MINIMAL: true
ON_CONSOLE: true

steps:
- name: "Install Git and checkout project"
uses: actions/checkout@v4.2.2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: "Get if running student version"
id: student_check
run: |
if [[ "${{ matrix.mapdl-version }}" == *"student"* ]];
then export ON_STUDENT=true; export TAG_STUDENT="student";
else export ON_STUDENT=false; export TAG_STUDENT="non-student";
fi
echo "ON_STUDENT: $ON_STUDENT"
echo "TAG_STUDENT: $TAG_STUDENT"
echo "ON_STUDENT=$(echo $ON_STUDENT)" >> $GITHUB_OUTPUT
echo "TAG_STUDENT=$(echo $TAG_STUDENT)" >> $GITHUB_OUTPUT
- name: "Installing missing package"
run: |
sudo apt-get update
sudo apt-get install -y libgomp1
- name: "Setup Python"
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Checking Python"
run: |
python --version
python -m pip install --upgrade pip
- name: "Install ansys-mapdl-core"
run: |
python -m pip install . --no-deps
python -m pip install -r minimum_requirements.txt
python -c "from ansys.mapdl import core as pymapdl; print('Import successfull')"
- name: "Unit testing requirements installation"
run: |
python -m pip install -r .ci/requirements_minimal.txt
- name: "Unit testing"
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
ON_STUDENT: ${{ steps.student_check.outputs.ON_STUDENT }}
run: |
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"
# Because there is no 'ansys-tools-path' we need to input the
# executable path with the env var: PYMAPDL_MAPDL_EXEC.
if [[ "${{ matrix.mapdl-version }}" == *"latest-ubuntu"* ]] ; then
version=${{ env.LATEST_VERSION }}
else
version=$(echo "${{ matrix.mapdl-version }}" | head -c 5 | tail -c 4 | tr -d '.')
fi;
echo "Version: $version"
export PYMAPDL_MAPDL_EXEC=/ansys_inc/v"$version"/ansys/bin/ansys"$version"
echo "$PYMAPDL_MAPDL_EXEC"
unset PYMAPDL_START_INSTANCE
pytest -k "console" \
${{ env.PYTEST_ARGUMENTS }} \
--cov-report=xml:${{ matrix.mapdl-version }}-minimal-console.xml
- name: "Collect logs on failure"
if: always()
env:
LOG_NAMES: logs-minimal-console-${{ matrix.mapdl-version }}
run: |
.ci/collect_mapdl_logs_locals.sh
- name: "Upload logs to GitHub"
if: always()
uses: actions/upload-artifact@master
with:
name: logs-minimal-console-${{ matrix.mapdl-version }}.tgz
path: ./logs-minimal-console-${{ matrix.mapdl-version }}.tgz

- name: "Display files structure"
if: always()
env:
LOG_NAMES: logs-minimal-console-${{ matrix.mapdl-version }}
run: |
.ci/display_logs_locals.sh
- uses: codecov/codecov-action@v5
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
root_dir: ${{ github.workspace }}
name: ${{ matrix.mapdl-version }}-minimal-console.xml
flags: ubuntu,local,${{ matrix.mapdl-version }},minimal,console,${{ steps.student_check.outputs.TAG_STUDENT }},dmp

- name: "Upload coverage artifacts"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.mapdl-version }}-minimal-console.xml
path: ./${{ matrix.mapdl-version }}-minimal-console.xml


test-windows:
# Skipped
if: github.repository == ''
Expand Down
1 change: 0 additions & 1 deletion doc/changelog.d/3183.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3186.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3188.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3191.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3194.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3197.dependencies.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3201.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3204.fixed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3206.miscellaneous.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3210.miscellaneous.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3211.changed.md

This file was deleted.

1 change: 0 additions & 1 deletion doc/changelog.d/3212.dependencies.md

This file was deleted.

Loading

0 comments on commit 759a519

Please sign in to comment.