Skip to content

Commit

Permalink
CI: Modify how job success is verified for CI/CD (#965)
Browse files Browse the repository at this point in the history
Co-authored-by: pyansys-ci-bot <[email protected]>
Co-authored-by: klmcadams <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2024
1 parent 66e8dd8 commit 647d4d2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ jobs:
else
echo "matrix={\"mechanical-version\":['${{ needs.revn-variations.outputs.test_docker_image_version }}'],\"experimental\":[false]}" >> $GITHUB_OUTPUT
fi
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
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
fi
remote-connect:
name: Remote connect testing and coverage - Mechanical ${{ matrix.mechanical-version }}
Expand Down Expand Up @@ -269,7 +285,7 @@ jobs:
name: Embedding testing and coverage
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [smoke-tests, revn-variations]
needs: [smoke-tests, revn-variations, container-stability-check]
container:
image: ${{ needs.revn-variations.outputs.test_container }}
options: --entrypoint /bin/bash
Expand Down Expand Up @@ -304,7 +320,11 @@ jobs:
PYTHONUNBUFFERED: 1
run: |
. /env/bin/activate
xvfb-run mechanical-env pytest -m embedding -s --junitxml test_results${{ matrix.python-version }}.xml || true
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
fi
- name: Upload coverage results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -411,7 +431,7 @@ jobs:
container:
image: ${{ needs.revn-variations.outputs.test_container }}
options: --entrypoint /bin/bash
needs: [ style, revn-variations]
needs: [ style, revn-variations, container-stability-check]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -447,7 +467,11 @@ jobs:
unset PYMECHANICAL_PORT
unset PYMECHANICAL_START_INSTANCE
. /env/bin/activate
pytest -m remote_session_launch -s --junitxml launch_test_results${{ matrix.python-version }}.xml || true
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@v5
Expand Down Expand Up @@ -483,7 +507,7 @@ jobs:
container:
image: ${{ needs.revn-variations.outputs.test_container }}
options: --entrypoint /bin/bash
needs: [style, doc-style, revn-variations]
needs: [style, doc-style, revn-variations, container-stability-check]

steps:

Expand Down Expand Up @@ -545,10 +569,14 @@ jobs:
unset PYMECHANICAL_START_INSTANCE
output_file=doc_$1_output.txt
xvfb-run mechanical-env make -C doc $1 > $output_file 2>&1 || true
cat $output_file
echo done running make
validate_output $output_file
if [ "${{ needs.container-stability-check.outputs.container_stable_exit }}" = "true" ]; then
xvfb-run mechanical-env make -C doc $1
else
xvfb-run mechanical-env make -C doc $1 > $output_file 2>&1 || true
cat $output_file
echo done running make
validate_output $output_file
fi
}
# Validate that the html or pdf build succeeded
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/965.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modify how job success is verified for CI/CD

0 comments on commit 647d4d2

Please sign in to comment.