Skip to content

fix: Process return code #5216

fix: Process return code

fix: Process return code #5216

Workflow file for this run

name: GitHub CI
on:
pull_request:
workflow_dispatch:
inputs:
revn:
type: choice
options:
- '251'
- '242'
- '241'
description: 'The Mechanical revision number to run tests on.'
default: '251' #stable version is 242, must match $stable_container
env:
DOCKER_PACKAGE: ghcr.io/ansys/mechanical
# DEV_REVN & its Docker image are used in scheduled or registry package runs
DEV_REVN: '251'
DEV_DOCKER_IMAGE_VERSION: '25.1_candidate'
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
revn-variations:
name: Save variations of revn
runs-on: ubuntu-latest
outputs:
# ghcr.io/ansys/mechanical:24.2.0
stable_container: ${{ steps.save-versions.outputs.stable_container }}
# '242' or '251'
test_revn: '${{ steps.save-versions.outputs.test_revn }}'
# ghcr.io/ansys/mechanical:24.2.0 or ghcr.io/ansys/mechanical:25.1.0
test_container: ${{ steps.save-versions.outputs.test_container }}
# '24.2.0' or '25.1.0'
test_docker_image_version: '${{ steps.save-versions.outputs.test_docker_image_version }}'
steps:
- id: save-versions
run: |
if ${{ github.event_name == 'schedule' }}; then
# 251
echo "test_revn=${{ env.DEV_REVN}}" >> $GITHUB_OUTPUT
# ghcr.io/ansys/mechanical:24.2_candidate
echo "test_container=${{ env.DOCKER_PACKAGE }}:${{ env.DEV_DOCKER_IMAGE_VERSION }}" >> $GITHUB_OUTPUT
# 25.1_candidate
echo "test_docker_image_version=${{ env.DEV_DOCKER_IMAGE_VERSION }}" >> $GITHUB_OUTPUT
else
if [[ -z "${{inputs.revn}}" ]]; then
export mech_revn=242
else
export mech_revn=${{inputs.revn}}
fi
export mech_image_version=${mech_revn:0:2}.${mech_revn:2}.0
echo "test_revn=$mech_revn" >> $GITHUB_OUTPUT
# ghcr.io/ansys/mechanical:24.2.0
echo "test_container=${{ env.DOCKER_PACKAGE }}:$mech_image_version" >> $GITHUB_OUTPUT
# 24.2.0
echo "test_docker_image_version=$mech_image_version" >> $GITHUB_OUTPUT
fi
echo "stable_container=${{ env.DOCKER_PACKAGE }}:24.2.0" >> $GITHUB_OUTPUT
embedding-scripts-tests:
name: Embedding scripts testing and coverage
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [revn-variations]
container:
image: ${{ needs.revn-variations.outputs.test_container }}
options: --entrypoint /bin/bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up python and pip
run: |
apt update
apt install --reinstall ca-certificates
apt install lsb-release xvfb software-properties-common -y
add-apt-repository ppa:deadsnakes/ppa -y
apt install -y python3.12 python3.12-venv
python3.12 -m venv /env
- name: Install packages for testing
run: |
. /env/bin/activate
pip install --upgrade pip
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.xml
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: '**/test_results.xml'
check_name: Test Report
detailed_summary: true
include_passed: true
fail_on_failure: true