diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 9e19c3b8c..088443263 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -42,829 +42,145 @@ concurrency: cancel-in-progress: true jobs: - update-changelog: - name: "Update CHANGELOG for new tag" - 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@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - - style: - name: Code style - runs-on: ubuntu-latest - steps: - - name: PyAnsys code style checks - uses: ansys/actions/code-style@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - doc-style: - name: Documentation Style Check - runs-on: ubuntu-latest - steps: - - name: PyAnsys documentation style checks - uses: ansys/actions/doc-style@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - vulnerabilities: - name: Vulnerabilities - runs-on: ubuntu-latest - steps: - - name: PyAnsys Vulnerability check (on main) - if: github.ref == 'refs/heads/main' - uses: ansys/actions/check-vulnerabilities@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - python-package-name: ${{ env.PACKAGE_NAME }} - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - - - name: PyAnsys Vulnerability check (on dev mode) - if: github.ref != 'refs/heads/main' - uses: ansys/actions/check-vulnerabilities@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - python-package-name: ${{ env.PACKAGE_NAME }} - token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} - dev-mode: true - - smoke-tests: - name: Build and Smoke tests - runs-on: ${{ matrix.os }} - needs: [style] + show-glibc-version: + name: Show glibc Version (Multiple Versions Check) + runs-on: ubuntu-22.04 + steps: + - name: Comprehensive glibc version check + run: | + echo "=== System Information ===" + uname -a + echo "" + echo "=== Distribution info ===" + cat /etc/os-release + echo "" + echo "=== Primary glibc Version ===" + ldd --version + echo "" + echo "=== Alternative glibc check ===" + getconf GNU_LIBC_VERSION 2>/dev/null || echo "getconf not available" + echo "" + echo "=== All glibc libraries in /lib ===" + find /lib* -name "libc.so*" -type f 2>/dev/null | while read lib; do + echo "Found: $lib" + $lib 2>/dev/null | head -3 || echo " Cannot execute directly" + done + echo "" + echo "=== All glibc libraries in /usr/lib ===" + find /usr/lib* -name "libc.so*" -type f 2>/dev/null | while read lib; do + echo "Found: $lib" + $lib 2>/dev/null | head -3 || echo " Cannot execute directly" + done + echo "" + echo "=== Symlinks to glibc ===" + find /lib* /usr/lib* -name "libc.so*" -type l 2>/dev/null | while read link; do + echo "Symlink: $link -> $(readlink -f $link)" + done + echo "" + echo "=== All libc versions using strings ===" + find /lib* /usr/lib* -name "libc.so.*" -type f 2>/dev/null | while read lib; do + echo "=== Checking $lib ===" + strings "$lib" | grep -E "^GLIBC_[0-9]+\.[0-9]+" | sort -V | tail -5 2>/dev/null || echo " No GLIBC version strings found" + done + echo "" + echo "=== Available glibc symbols ===" + objdump -T /lib/x86_64-linux-gnu/libc.so.6 2>/dev/null | grep "GLIBC_" | awk '{print $5}' | sort -u | sort -V | tail -10 || echo "objdump not available" + echo "" + echo "=== Check for multiple glibc installations ===" + dpkg -l | grep libc6 || echo "dpkg not available" + echo "" + echo "=== RPM check (if available) ===" + rpm -qa | grep glibc 2>/dev/null || echo "RPM not available (expected on Ubuntu)" + + setup-python: + name: Setup Python on Ubuntu 22.04 + runs-on: ubuntu-22.04 strategy: - fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.10', '3.11', '3.12', '3.13'] - should-release: - - ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }} - exclude: - - should-release: false - os: macos-latest + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - - name: Build wheelhouse and perform smoke test - uses: ansys/actions/build-wheelhouse@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - library-name: ${{ env.PACKAGE_NAME }} - operating-system: ${{ matrix.os }} python-version: ${{ matrix.python-version }} + cache: 'pip' - revn-variations: - name: Save variations of revn - runs-on: ubuntu-latest - outputs: - stable_container: ${{ steps.save-versions.outputs.stable_container }} - test_revn: '${{ steps.save-versions.outputs.test_revn }}' - test_container: ${{ steps.save-versions.outputs.test_container }} - test_docker_image_version: '${{ steps.save-versions.outputs.test_docker_image_version }}' - steps: - - id: save-versions + - name: Verify Python installation run: | - if ${{ github.event_name == 'schedule' }}; then - echo "test_revn=${{ env.DEV_REVN}}" >> $GITHUB_OUTPUT - test_mech_revn=${{ env.DEV_REVN}} - test_mech_image_version=${test_mech_revn:0:2}.${test_mech_revn:2}_candidate - echo "test_container=${{ env.DOCKER_PACKAGE }}:$test_mech_image_version" >> $GITHUB_OUTPUT - echo "test_docker_image_version=$test_mech_image_version" >> $GITHUB_OUTPUT - else - if [[ -z "${{inputs.revn}}" ]]; then - mech_revn=${{ env.STABLE_REVN }} - else - mech_revn=${{inputs.revn}} - fi - export mech_image_version=${mech_revn:0:2}.${mech_revn:2}.0 - echo "test_revn=$mech_revn" >> $GITHUB_OUTPUT - echo "test_container=${{ env.DOCKER_PACKAGE }}:$mech_image_version" >> $GITHUB_OUTPUT - echo "test_docker_image_version=$mech_image_version" >> $GITHUB_OUTPUT - fi - - stable_mech_revn=${{ env.STABLE_REVN }} - stable_mech_image_version=${mech_revn:0:2}.${mech_revn:2}.0 - echo "stable_container=${{ env.DOCKER_PACKAGE }}:$stable_mech_image_version" >> $GITHUB_OUTPUT - - echo $GITHUB_OUTPUT - - # --- Help ---- - # schedule nightly uses DEV_REVN candidate - # PRs and merges use STABLE_REVN - # Workflow dispatch can use any revision number + python --version + python -c "import sys; print(f'Python executable: {sys.executable}')" + python -c "import sys; print(f'Python version: {sys.version}')" + python -c "import platform; print(f'Platform: {platform.platform()}')" - test-container-info: - name: Get SHA of test container - runs-on: public-ubuntu-latest-8-cores - needs: [revn-variations] - outputs: - sha: ${{ steps.get_sha.outputs.sha }} - strategy: - matrix: - test_container: ['${{ needs.revn-variations.outputs.test_container }}'] - steps: - - name: Login in Github Container registry - uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Pull, launch, and validate Mechanical service - id: get_sha - env: - MECHANICAL_IMAGE: ${{ matrix.test_container }} + - name: Upgrade pip and install build tools run: | - # Install jq for parsing JSON - pip install jq - - # Get docker info - image_info=$(docker manifest inspect -v ${{ env.MECHANICAL_IMAGE }}) # --format ".Descriptor.digest" - - # Get digest SHA - digest=$(echo "$image_info" | jq -r '.Descriptor.digest') + python -m pip install --upgrade pip + python -m pip install build wheel setuptools - # Remove the "sha256:" prefix to get only the SHA - sha="${digest#*:}" - echo "SHA of image ${{ env.MECHANICAL_IMAGE }} is $sha" - echo "sha=$sha" >> $GITHUB_OUTPUT - - config-matrix: - runs-on: ubuntu-latest - needs: [revn-variations] - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - id: set-matrix + - name: Verify pip and installed packages run: | - # if a tag(release) is pushed, test all versions - if ${{ github.event_name == 'push' }} && ${{ contains(github.ref, 'refs/tags') }}; then - echo "matrix={\"mechanical-version\":['24.1.0', '24.2.0', '25.1.0', '25.2.0'],\"experimental\":[false]}" >> $GITHUB_OUTPUT - else - echo "matrix={\"mechanical-version\":['${{ needs.revn-variations.outputs.test_docker_image_version }}'],\"experimental\":[false]}" >> $GITHUB_OUTPUT - fi + pip --version + pip list - container-stability-check: - runs-on: ubuntu-latest - needs: [revn-variations] - outputs: - container_stable_exit: ${{ steps.check_stability.outputs.container_stable_exit }} - steps: - - id: check_stability + - name: Install package dependencies run: | - sudo apt update - sudo apt install bc -y - container_version=$(echo "${{ needs.revn-variations.outputs.test_docker_image_version }}" | grep -o -E '[0-9]+(\.[0-9]+)?' | head -n 1) - if (( $(echo "$container_version > 24.2" | bc -l) )); then - echo "container_stable_exit=true" >> $GITHUB_OUTPUT - else - echo "container_stable_exit=false" >> $GITHUB_OUTPUT + if [ -f requirements.txt ]; then + pip install -r requirements.txt fi - - remote-connect: - name: Remote connect testing and coverage - Mechanical ${{ matrix.mechanical-version }} - runs-on: public-ubuntu-latest-8-cores - needs: [style, revn-variations, config-matrix] - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.config-matrix.outputs.matrix) }} - steps: - - name: Login in Github Container registry - uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Pull, launch, and validate Mechanical service - env: - MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mechanical-version }} - run: | - docker pull ${{ env.MECHANICAL_IMAGE }} - docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ env.MECHANICAL_IMAGE }} > log.txt & - grep -q 'WB Initialize Done' <(timeout 60 tail -f log.txt) - - - name: Display info - if: github.event_name == 'schedule' - id: capture_info - run: | - IMAGE_NAME=${{ env.DOCKER_PACKAGE }}:${{ matrix.mechanical-version }} - BUILD_DATE=$(docker run --rm --entrypoint head $IMAGE_NAME -n 1 /install/ansys_inc/v${{ needs.revn-variations.outputs.test_revn }}/aisol/CommonFiles/builddate.txt) - PUSHED_AT=$(docker inspect --format='{{.Created}}' $IMAGE_NAME) - echo "docker_info=$IMAGE_NAME was pushed at: $PUSHED_AT" >> $GITHUB_OUTPUT - echo "::group::Docker Info" - echo "docker_info=$PUSHED_AT" >> $GITHUB_OUTPUT - echo "build_info=$BUILD_DATE" >> $GITHUB_OUTPUT - echo "$IMAGE_NAME pushed at $PUSHED_AT" - echo "Build date : $BUILD_DATE" - echo "::endgroup::" - - - name: Testing - uses: ansys/actions/tests-pytest@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - pytest-markers: '-m remote_session_connect' - pytest-extra-args: '-s --junitxml remote_results${{ env.MAIN_PYTHON_VERSION}}.xml' - - - name: Publish Test Report - uses: mikepenz/action-junit-report@3585e9575db828022551b4231f165eb59a0e74e3 # v5.6.2 - if: always() - with: - report_paths: '**/remote_results*.xml' - check_name: Remote Connect Test Report ${{ env.MAIN_PYTHON_VERSION}} - detailed_summary: true - include_passed: true - fail_on_failure: true - - - name: Upload coverage results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: matrix.mechanical-version == needs.revn-variations.outputs.test_docker_image_version - with: - include-hidden-files: true - name: coverage-tests - path: .cov - retention-days: 7 - - - name: Upload coverage results (as .coverage) - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: matrix.mechanical-version == needs.revn-variations.outputs.test_docker_image_version - with: - include-hidden-files: true - name: coverage-file-tests - path: .coverage - retention-days: 7 - - - name: Get Mechanical container logs - if: always() - run: | - docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_tests_log-${{ matrix.mechanical-version }}.txt 2>&1 - echo CONTAINER LOGS OUTPUT - cat mechanical_tests_log-${{ matrix.mechanical-version }}.txt - echo CPU info - lscpu - - - name: Upload container logs - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: mechanical_tests_log-${{ matrix.mechanical-version }} - path: mechanical_tests_log-${{ matrix.mechanical-version }}.txt - retention-days: 7 - - embedding-tests: - name: Embedding testing and coverage - runs-on: ubuntu-latest - timeout-minutes: 30 - needs: [revn-variations, test-container-info, container-stability-check, smoke-tests] - container: - image: ${{ needs.revn-variations.outputs.test_container }} - options: --entrypoint /bin/bash - strategy: - fail-fast: false - matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] - - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: "Set up Python and activate virtual environment" - uses: ./.github/workflows/setup-python/ - with: - container-sha: ${{ needs.test-container-info.outputs.sha }} - python-version: ${{ matrix.python-version }} - - - name: "Install packages for testing" - run: | - . /env/bin/activate - pip install --upgrade pip - pip install uv - uv pip install -e .[tests] - - - name: Unit Testing and coverage - env: - ANSYS_WORKBENCH_LOGGING_CONSOLE: 0 - ANSYS_WORKBENCH_LOGGING: 0 - ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 2 - NUM_CORES: 1 - PYTHONUNBUFFERED: 1 - run: | - . /env/bin/activate - if [ "${{ needs.container-stability-check.outputs.container_stable_exit }}" = "true" ]; then - xvfb-run mechanical-env pytest -m embedding -s --junitxml test_results${{ matrix.python-version }}.xml - else - xvfb-run mechanical-env pytest -m embedding -s --junitxml test_results${{ matrix.python-version }}.xml || true + if [ -f pyproject.toml ]; then + pip install -e . fi - - name: Upload coverage results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: env.MAIN_PYTHON_VERSION == matrix.python-version - with: - include-hidden-files: true - name: coverage-tests-embedding - path: .cov - retention-days: 7 - - - name: Upload coverage results (as .coverage) - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: env.MAIN_PYTHON_VERSION == matrix.python-version - with: - include-hidden-files: true - name: coverage-file-tests-embedding - path: .coverage - retention-days: 7 - - - name: Publish Test Report - uses: mikepenz/action-junit-report@3585e9575db828022551b4231f165eb59a0e74e3 # v5.6.2 - if: always() - with: - report_paths: '**/test_results*.xml' - check_name: Test Report ${{ matrix.python-version }} - detailed_summary: true - include_passed: true - fail_on_failure: true + - name: Run basic Python tests + run: | + python -c "import sys; assert sys.version_info >= (3, 9), 'Python version should be 3.9 or higher'" + python -c "print('✅ Python setup verification completed successfully')" embedding-scripts-tests: name: Embedding scripts testing and coverage runs-on: ubuntu-latest - timeout-minutes: 30 - needs: [smoke-tests, revn-variations, test-container-info] container: - image: ${{ needs.revn-variations.outputs.test_container }} - options: --entrypoint /bin/bash + image: ghcr.io/ansys/mechanical:26.1_Dev strategy: - fail-fast: false matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] - - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: "Set up Python and activate virtual environment" - uses: ./.github/workflows/setup-python/ - with: - container-sha: ${{ needs.test-container-info.outputs.sha }} - python-version: ${{ matrix.python-version }} - - - name: "Install packages for testing" - run: | - . /env/bin/activate - pip install --upgrade pip - pip install uv - uv pip install -e .[tests] - - - name: Embedding scripts unit testing and coverage - env: - ANSYS_WORKBENCH_LOGGING_CONSOLE: 0 - ANSYS_WORKBENCH_LOGGING: 0 - ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 2 - NUM_CORES: 1 - PYTHONUNBUFFERED: 1 - run: | - . /env/bin/activate - mechanical-env pytest -m embedding_scripts -s --junitxml test_results_embedding_scripts${{ matrix.python-version }}.xml - pytest -m cli -s --junitxml test_results_cli_scripts${{ matrix.python-version }}.xml - - - name: Upload coverage results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: env.MAIN_PYTHON_VERSION == matrix.python-version - with: - include-hidden-files: true - name: coverage-tests-embedding-scripts - path: .cov - retention-days: 7 - - - name: Upload coverage results (as .coverage) - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: env.MAIN_PYTHON_VERSION == matrix.python-version - with: - include-hidden-files: true - name: coverage-file-tests-embedding-scripts - path: .coverage - retention-days: 7 - - - name: Publish Test Report - uses: mikepenz/action-junit-report@3585e9575db828022551b4231f165eb59a0e74e3 # v5.6.2 - if: always() - with: - report_paths: '**/test_results*.xml' - check_name: Test Report ${{ matrix.python-version }} - detailed_summary: true - include_passed: true - fail_on_failure: true - - launch-tests: - name: Launch testing and coverage - runs-on: public-ubuntu-latest-8-cores - timeout-minutes: 30 - container: - image: ${{ needs.revn-variations.outputs.test_container }} - options: --entrypoint /bin/bash - needs: [ style, revn-variations, container-stability-check, test-container-info] - strategy: - fail-fast: false - matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] - - steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: "Set up Python and activate virtual environment" - uses: ./.github/workflows/setup-python/ - with: - container-sha: ${{ needs.test-container-info.outputs.sha }} - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - apt install -y lsb-release - - - name: "Install packages for testing" - run: | - . /env/bin/activate - pip install --upgrade pip - pip install uv - uv pip install -e .[tests] - - - name: Set environment variable - run: echo "ANSYSCL${{ needs.revn-variations.outputs.test_revn }}_DIR=/install/ansys_inc/v${{ needs.revn-variations.outputs.test_revn }}/licensingclient" >> $GITHUB_ENV - - - name: Unit Testing and coverage - env: - ANSYS_WORKBENCH_LOGGING_CONSOLE: 0 - run: | - unset PYMECHANICAL_PORT - unset PYMECHANICAL_START_INSTANCE - . /env/bin/activate - if [ "${{ needs.container-stability-check.outputs.container_stable_exit }}" = "true" ]; then - pytest -m remote_session_launch -s --junitxml launch_test_results${{ matrix.python-version }}.xml - else - pytest -m remote_session_launch -s --junitxml launch_test_results${{ matrix.python-version }}.xml || true - fi - - - name: Publish Launch Test Report - uses: mikepenz/action-junit-report@3585e9575db828022551b4231f165eb59a0e74e3 # v5.6.2 - if: always() - with: - report_paths: '**/launch_test_results*.xml' - check_name: Launch Test Report ${{ matrix.python-version }} - detailed_summary: true - include_passed: true - fail_on_failure: true - - - name: Upload coverage results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: env.MAIN_PYTHON_VERSION == matrix.python-version - with: - include-hidden-files: true - name: coverage-tests-remote-session-launch - path: .cov - retention-days: 7 - - - name: Upload coverage results (as .coverage) - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: env.MAIN_PYTHON_VERSION == matrix.python-version - with: - include-hidden-files: true - name: coverage-file-tests-remote-session-launch - path: .coverage - retention-days: 7 - - doc-build: - name: Documentation - runs-on: public-ubuntu-latest-8-cores - timeout-minutes: 30 - container: - image: ${{ needs.revn-variations.outputs.test_container }} - options: --entrypoint /bin/bash - needs: [style, doc-style, revn-variations, container-stability-check, test-container-info] - - steps: - - - name: Install Git and checkout project - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: "Set up Python and activate virtual environment" - uses: ./.github/workflows/setup-python/ - with: - container-sha: ${{ needs.test-container-info.outputs.sha }} - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - - name: Install system dependencies - run: | - apt update - apt install make lsb-release xvfb poppler-utils -y - apt install zip pandoc libgl1-mesa-glx mesa-utils texlive-latex-extra latexmk nodejs npm graphviz -y - - - name: Install gh cli - run: | - (type -p wget >/dev/null || (apt update && apt-get install wget -y)) \ - && mkdir -p -m 755 /etc/apt/keyrings \ - && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ - && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ - && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ - && apt update \ - && apt install gh -y - - - name: Install quarto to build cheatsheet - run: | - echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token - gh release download v1.6.43 --repo github.com/quarto-dev/quarto-cli --pattern *linux-amd64.deb - apt install ./quarto*linux-amd64.deb -y - quarto install tool tinytex --log-level warning - - - name: Test quarto installation - run: quarto --version - - - name: Install Python requirements - run: | - . /env/bin/activate - pip install uv - uv pip install -e .[doc] - - - name: Build docs - env: - NUM_CORES: 1 - ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 0 - BUILD_CHEATSHEET: true - run: | - . /env/bin/activate - - apt update - apt install -y libjbig-dev - # Add the /usr/lib/x86_64-linux-gnu/ path to the LD_LIBRARY_PATH (where libjbig-dev .so files are) - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/ - - if [ "${{ needs.container-stability-check.outputs.container_stable_exit }}" = "true" ]; then - xvfb-run mechanical-env make -C doc html - else - xvfb-run mechanical-env make -C doc html > output.txt 2>&1 || true - cat output.txt - if grep -q "build succeeded" output.txt; then - echo "Documentation building succeeded" - else - echo "Documentation building failed" - exit 1 - fi - fi - - name: Check links - run: | - . /env/bin/activate - make -C doc linkcheck - - - name: Upload HTML Documentation - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: documentation-html - path: doc/_build/html - retention-days: 7 - - doc-deploy-pr: - name: "Deploy PR documentation" - runs-on: ubuntu-latest - needs: [doc-build] - if: always() && (needs.doc-build.result == 'success' || needs.doc-build.result == 'skipped') - steps: - - uses: ansys/actions/doc-deploy-pr@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - cname: ${{ env.DOCUMENTATION_CNAME }} - token: ${{ secrets.GITHUB_TOKEN }} - bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} - bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} - maximum-pr-doc-deployments: 10 - - coverage: - name: Merging coverage - needs: [remote-connect, embedding-tests, embedding-scripts-tests, launch-tests] - # needs: [remote-connect, embedding-tests, embedding-scripts-tests, embedding-rpc-tests, launch-tests] - runs-on: ubuntu-latest + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - - name: Set up Python - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - - name: Install coverage - run: | - rm -rf ./env - python -m pip install -U pip - pip install coverage - pip install -e . - - - name: Create common coverage directory - run: mkdir cov-dir - - - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - with: - name: coverage-file-tests-embedding - path: cov-dir/embedding + uses: actions/checkout@v4 - # - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - # with: - # name: coverage-file-tests-embedding-rpc - # path: cov-dir/embedding-rpc - - - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - with: - name: coverage-file-tests-embedding-scripts - path: cov-dir/embedding-scripts - - - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - with: - name: coverage-file-tests-remote-session-launch - path: cov-dir/launch - - - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 - with: - name: coverage-file-tests - path: cov-dir/normal - - - name: Display structure of downloaded files - run: ls -Ra - - - name: Move files to common location - run: | - mv cov-dir/embedding/.coverage .coverage.Embedding - # mv cov-dir/embedding-rpc/.coverage .coverage.EmbeddingRPC - mv cov-dir/embedding-scripts/.coverage .coverage.EmbeddingScripts - mv cov-dir/launch/.coverage .coverage.Launch - mv cov-dir/normal/.coverage .coverage.Normal - rm -rf cov-dir - - - name: Generate .coveragerc file - run: | - cat > .coveragerc << 'EOF' - - # .coveragerc to control coverage.py - [run] - relative_files = True - - [paths] - source = - src/ansys/mechanical - /opt/hostedtoolcache/**/ansys/mechanical - /usr/local/lib/**/ansys/mechanical - .venv/lib/**/ansys/mechanical - /env/lib/**/ansys/mechanical - EOF - - - name: Run coverage merge and show results - run: | - coverage combine --keep --debug=pathmap --rcfile=.coveragerc - coverage report - coverage html -d .coverage-combined/html - coverage xml -o .coverage-combined/xml - - - name: Upload combined coverage results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - include-hidden-files: true - name: combined-coverage-results - path: .coverage-combined - retention-days: 7 - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: .coverage-combined/xml - - - name: Upload coverage to Codacy - uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 # v1.3.0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: '.coverage-combined/xml' - - package: - name: Package library - needs: [smoke-tests, remote-connect, embedding-tests, embedding-scripts-tests, doc-build] - runs-on: ubuntu-latest - permissions: - attestations: write - contents: read - id-token: write - steps: - - name: Build library source and wheel artifacts - uses: ansys/actions/build-library@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - library-name: ${{ env.PACKAGE_NAME }} - python-version: ${{ env.MAIN_PYTHON_VERSION }} - attest-provenance: true - - release: - name: Release project to GitHub - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: [package, update-changelog] - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - steps: - - name: Release to GitHub - uses: ansys/actions/release-github@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - with: - token: ${{ secrets.GITHUB_TOKEN }} - library-name: ${{ env.PACKAGE_NAME }} - only-code: true - - release-pypi: - name: Release project to PyPI - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: [package, update-changelog] - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - steps: - - name: "Download the library artifacts from build-library step" - uses: actions/download-artifact@de96f4613b77ec03b5cf633e7c350c32bd3c5660 # v4.3.0 - with: - name: ${{ env.PACKAGE_NAME }}-artifacts - path: ${{ env.PACKAGE_NAME }}-artifacts - - - name: "Upload artifacts to PyPI using trusted publisher" - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 - with: - repository-url: "https://upload.pypi.org/legacy/" - print-hash: true - packages-dir: ${{ env.PACKAGE_NAME }}-artifacts - skip-existing: false - - upload_dev_docs: - name: Upload dev documentation - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - needs: [package] - steps: - - name: Deploy the latest documentation - uses: ansys/actions/doc-deploy-dev@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - 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 }} - - 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@33399106dc8b62d83c8aad1fb2c333c8055df180 # v10.0.20 - 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 }} - - get-date: - name: Get date - runs-on: ubuntu-latest - outputs: - date: ${{ steps.date.outputs.date }} - steps: - - name: Get current date - id: date - run: | - echo "date=$(date --iso-8601)" >> $GITHUB_OUTPUT - - notify-on-failure: - name: Notify on failure - needs: [get-date, embedding-tests, embedding-scripts-tests, launch-tests, remote-connect, doc-build] - if: github.event_name == 'schedule' && (failure() || cancelled()) - runs-on: ubuntu-latest - steps: - - name: Microsoft Teams Notification - uses: skitionek/notify-microsoft-teams@11e40c38c3a629ae65a985b582eca4897b01e79e # v1.0.9 - with: - webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }} - # Message to send to Teams as a webhook notification in JSON Payload format - raw: >- - { - "type": "message", - "attachments": [ - { - "contentType": "application/vnd.microsoft.card.adaptive", - "content": { - "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", - "type": "AdaptiveCard", - "version": "1.0", - "body": [ - { - "type": "TextBlock", - "text": "**PyMechanical Nightly Run Failed on ${{ needs.get-date.outputs.date }}**\n\n[View details in GitHub Actions](https://github.com/ansys/pymechanical/actions/runs/${{ github.run_id }})", - "wrap": true - } - ] - } - } - ] - } \ No newline at end of file + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Check container and Python environment + run: | + echo "=== Container Environment Information ===" + cat /etc/os-release + echo "" + echo "=== Python Setup Verification ===" + python --version + python -c "import sys; print(f'Python executable: {sys.executable}')" + python -c "import sys; print(f'Python version: {sys.version}')" + python -c "import platform; print(f'Platform: {platform.platform()}')" + echo "" + echo "=== glibc version in container ===" + ldd --version + echo "" + echo "=== Python installation details ===" + which python python3 + ls -la $(which python) + + - name: Upgrade pip and install build tools + run: | + python -m pip install --upgrade pip + python -m pip install build wheel setuptools pytest coverage + + - name: Verify pip and installed packages + run: | + pip --version + pip list diff --git a/doc/changelog.d/1342.test.md b/doc/changelog.d/1342.test.md new file mode 100644 index 000000000..f7eeffebd --- /dev/null +++ b/doc/changelog.d/1342.test.md @@ -0,0 +1 @@ +Python action in ubuntu 22