diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f9785e16d..da423fb57 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -28,7 +28,7 @@ env: LATEST_STABLE_DOCKER_IMAGE_VERSION: '24.1.0' # DEV_REVN & its Docker image are used in scheduled or registry package runs DEV_REVN: '242' - DEV_DOCKER_IMAGE_VERSION: '24.2.0' + DEV_DOCKER_IMAGE_VERSION: '24.2_candidate' MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} MEILISEARCH_HOST_URL: ${{ vars.MEILISEARCH_HOST_URL }} MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} @@ -107,12 +107,12 @@ jobs: steps: - id: save-versions run: | - if ${{ github.event_name == 'schedule' }}; then # || ${{ github.event.registry_package.package_version.container_metadata.tag.name == 'mechanical:24.2.0' }}; then + if ${{ github.event_name == 'schedule' }}; then # 242 echo "test_revn=${{ env.DEV_REVN }}" >> $GITHUB_OUTPUT - # ghcr.io/ansys/mechanical:24.2.0 + # ghcr.io/ansys/mechanical:24.2_candidate echo "test_container=${{ env.DOCKER_PACKAGE }}:${{ env.DEV_DOCKER_IMAGE_VERSION }}" >> $GITHUB_OUTPUT - # 24.2.0 + # 24.2_candidate echo "test_docker_image_version=${{ env.DEV_DOCKER_IMAGE_VERSION }}" >> $GITHUB_OUTPUT else # 241 @@ -133,10 +133,11 @@ jobs: steps: - id: set-matrix run: | - # Configure matrix for "tests" job - # Run all mechanical versions for tags and nightly scheduled runs, otherwise run the test docker image version only - if ${{ github.event_name == 'push' }} && ${{ contains(github.ref, 'refs/tags') }} || ${{ github.event_name == 'schedule' }}; then - echo "matrix={\"mechanical-version\":['23.1.0', '23.2.0', '24.1.0', '24.2.0'],\"experimental\":[false]}" >> $GITHUB_OUTPUT + # Run all stable mechanical versions release tags + # For nightly scheduled runs use pre-release (242_candidate) + # For pull requests and merges use latest stable version (241) + if ${{ github.event_name == 'push' }} && ${{ contains(github.ref, 'refs/tags') }}; then + echo "matrix={\"mechanical-version\":['23.1.0', '23.2.0', '24.1.0'],\"experimental\":[false]}" >> $GITHUB_OUTPUT else echo "matrix={\"mechanical-version\":['${{ needs.revn-variations.outputs.test_docker_image_version }}'],\"experimental\":[false]}" >> $GITHUB_OUTPUT fi diff --git a/.github/workflows/ci_cd_nightly.yml b/.github/workflows/ci_cd_nightly.yml deleted file mode 100644 index 5d5272ade..000000000 --- a/.github/workflows/ci_cd_nightly.yml +++ /dev/null @@ -1,409 +0,0 @@ -name: GitHub CI Nightly - -on: - pull_request: - workflow_dispatch: - schedule: - - cron: '00 22 * * *' # UTC time, may start 5-15 mins later than scheduled time - # registry_package: - # Run workflow when package is published or updated - # types: [published] - # push: - # tags: - # - "*" - # branches: - # - main - # - release/* - -env: - PYMECHANICAL_PORT: 10000 # default won't work on GitHub runners - PYMECHANICAL_START_INSTANCE: false - DOCKER_PACKAGE: ghcr.io/ansys/mechanical - DOCKER_MECH_CONTAINER_NAME: mechanical - PACKAGE_NAME: ansys-mechanical-core - DOCUMENTATION_CNAME: mechanical.docs.pyansys.com - MAIN_PYTHON_VERSION: '3.10' - DEV_REVN: 242 - DEV_MAJOR_REV: 24 - DEV_MINOR_REV: 2 - DEV_DOCKER_IMAGE_VERSION: '24.2_candidate' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - saving-image-versions: - name: Save variations of revn - runs-on: ubuntu-latest - outputs: - major: ${{ steps.save-versions.outputs.major }} # 24 - minor: ${{ steps.save-versions.outputs.minor }} # 2 - dev_docker_image_version: ${{ steps.save-versions.outputs.dev_docker_image_version }} # ghcr.io/ansys/mechanical:24.2_candidate - docker_info: ${{ steps.capture_info.outputs.docker_info }} - build-info: ${{ steps.capture_info.outputs.build_info }} - steps: - - id: save-versions - run: | - echo "major=${{ env.DEV_MAJOR_REV }}" >> $GITHUB_OUTPUT - echo "minor=${{ env.DEV_MINOR_REV }}" >> $GITHUB_OUTPUT - echo "dev_docker_image_version=ghcr.io/ansys/mechanical:${{ env.DEV_DOCKER_IMAGE_VERSION }}" >> $GITHUB_OUTPUT - - - name: Login in Github Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Pull, launch & display info - id: capture_info - run: | - IMAGE_NAME=${{ steps.save-versions.outputs.dev_docker_image_version }} - docker pull $IMAGE_NAME - BUILD_DATE=$(docker run --rm --entrypoint head $IMAGE_NAME -n 1 /install/ansys_inc/v${{ env.DEV_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 "${{ env.DEV_DOCKER_IMAGE_VERSION }} pushed at $PUSHED_AT" - echo "Build date : $BUILD_DATE" - echo "::endgroup::" - - remote-connect: - name: Remote connect testing - runs-on: ubuntu-latest - needs: saving-image-versions - strategy: - fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - steps: - - name: Login in Github Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Pull, launch, and validate Mechanical service - env: - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - run: | - docker pull ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} - docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} > log.txt & - grep -q 'WB Initialize Done' <(timeout 60 tail -f log.txt) - - - name: Testing - uses: ansys/actions/tests-pytest@v6 - with: - python-version: ${{ matrix.python-version }} - pytest-markers: '-m remote_session_connect' - pytest-extra-args: '-s --junitxml remote_results${{ matrix.python-version}}.xml' - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v4 - if: always() - with: - report_paths: '**/remote_results*.xml' - check_name: Remote Connect Test Report ${{ matrix.python-version}} - detailed_summary: true - include_passed: true - fail_on_failure: true - - - name: Get Mechanical container logs - if: always() - run: | - docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_tests_log.txt 2>&1 - echo CONTAINER LOGS OUTPUT - cat mechanical_tests_log.txt - echo CPU info - lscpu - - - name: Upload container logs - uses: actions/upload-artifact@v4 - with: - name: mechanical_tests_log - path: mechanical_tests_log.txt - retention-days: 7 - - embedding-tests: - name: Embedding and embed scripting testing - runs-on: ubuntu-latest - needs: saving-image-versions - timeout-minutes: 10 - container: - image: ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} - options: --entrypoint /bin/bash - strategy: - fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - - 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 python${{ matrix.python-version }} python${{ matrix.python-version }}-venv - python${{ matrix.python-version }} -m venv /env - - - name: Install dependencies - run: | - . /env/bin/activate - pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip setuptools - pip install --upgrade pip flit - - - name: Install packages for testing - run: | - . /env/bin/activate - pip install -e .[tests] - - - name: Emnbedding Testing - env: - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} - ANSYS_WORKBENCH_LOGGING_CONSOLE: 0 - ANSYS_WORKBENCH_LOGGING: 0 - ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 2 - NUM_CORES: 1 - PYTHONUNBUFFERED: 1 - run: | - . /env/bin/activate - xvfb-run mechanical-env pytest -m embedding -s --junitxml embedding_results${{ matrix.python-version }}.xml || true - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v4 - if: always() - with: - report_paths: '**/embedding_results*.xml' - check_name: Embedding Test Report ${{ matrix.python-version }} - detailed_summary: true - include_passed: true - fail_on_failure: true - - embedding-scripts-tests: - name: Embedding scripts testing - runs-on: ubuntu-latest - timeout-minutes: 10 - needs: saving-image-versions - container: - image: ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} - options: --entrypoint /bin/bash - strategy: - fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - - 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 python${{ matrix.python-version }} python${{ matrix.python-version }}-venv - python${{ matrix.python-version }} -m venv /env - - - name: Install dependencies - run: | - . /env/bin/activate - pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip setuptools - pip install --upgrade pip flit - - - name: Install packages for testing - run: | - . /env/bin/activate - pip install -e .[tests] - - - name: Embedding scripts unit testing and coverage - env: - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} - 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 results_embedding_scripts${{ matrix.python-version }}.xml - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v4 - if: always() - with: - report_paths: '**/results_embedding_scripts*.xml' - check_name: Test Report ${{ matrix.python-version }} - detailed_summary: true - include_passed: true - fail_on_failure: true - - launch-tests: - name: Launch testing - runs-on: public-ubuntu-latest-8-cores - timeout-minutes: 15 - container: - image: ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} - options: --entrypoint /bin/bash - needs: saving-image-versions - strategy: - fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - - 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 python${{ matrix.python-version }} python${{ matrix.python-version }}-venv - python${{ matrix.python-version }} -m venv /env - - - name: Install dependencies - run: | - . /env/bin/activate - pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip setuptools - pip install --upgrade pip flit - - - name: Install packages for testing - run: | - . /env/bin/activate - pip install -e .[tests] - - - name: Unit Testing and coverage - env: - ANSYSCL${{ env.DEV_REVN }}_DIR: /install/ansys_inc/v${{ env.DEV_REVN }}/licensingclient - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} - ANSYS_WORKBENCH_LOGGING_CONSOLE: 0 - run: | - unset PYMECHANICAL_PORT - unset PYMECHANICAL_START_INSTANCE - pytest -m remote_session_launch -s --junitxml launch_test_results${{ matrix.python-version }}.xml || true - - - name: Publish Launch Test Report - uses: mikepenz/action-junit-report@v4 - 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 - - doc-build: - name: Documentation - runs-on: ubuntu-latest - container: - image: ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} - options: --entrypoint /bin/bash - needs: saving-image-versions - steps: - - name: Install Git and checkout project - uses: actions/checkout@v4 - - - name: Set up Python - run: | - apt update - apt install --reinstall ca-certificates - apt install software-properties-common -y - add-apt-repository ppa:deadsnakes/ppa -y - apt install -y python${{ env.MAIN_PYTHON_VERSION }} python${{ env.MAIN_PYTHON_VERSION }}-venv - python${{ env.MAIN_PYTHON_VERSION }} -m venv /env - - - name: Install system dependencies - run: | - apt update - apt install -y sudo curl lsb-release - apt install -y zip pandoc libgl1-mesa-glx mesa-utils xvfb texlive-latex-extra latexmk nodejs npm graphviz - apt install -y tini - npm install -g @mermaid-js/mermaid-cli - - - name: Install Python requirements - run: | - . /env/bin/activate - pip install -e .[doc] - - - name: Build docs - env: - NUM_CORES: 1 - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} - ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 0 - run: | - . /env/bin/activate - # Make html or pdf doc - make_doc() { - # $1 is the type of file we are creating (html or pdf) - - # Need to unset PYMECHANICAL_PORT and PYMECHANICAL_START_INSTANCE when running code containing remote sessions - unset PYMECHANICAL_PORT - 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 - } - - # Validate that the html or pdf build succeeded - validate_output() { - echo "validating output of build" - # $1 is the file we are checking - # cat $1 - # - # Check if "build succeeded" string is present in doc_build_output.txt - # - if grep -q "build succeeded" $1; then - echo "Documentation building succeeded" - else - echo "Documentation building failed" - exit 1 - fi - } - - # Make the html doc & validate results - make_doc html - - # Make the pdf doc & validate results - make_doc pdf - - - name: Upload HTML Documentation - uses: actions/upload-artifact@v4 - with: - name: documentation-html - path: doc/_build/html - retention-days: 7 - - - name: Upload PDF Documentation - uses: actions/upload-artifact@v4 - with: - name: documentation-pdf - path: doc/_build/latex/*.pdf - retention-days: 7 - - build-failure: - name: Teams notify on failure - if: failure() - needs: [saving-image-versions, remote-connect, embedding-tests, embedding-scripts-tests, launch-tests, doc-build] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Microsoft Teams Notification - uses: jdcargile/ms-teams-notification@v1.4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} - notification-summary: Nightly build failure on ${{ env.DEV_DOCKER_IMAGE_VERSION }} build at ${{ needs.saving-image-versions.outputs.build-info }} , pushed at ${{ needs.saving-image-versions.outputs.docker_info }} (UTC) - notification-color: dc3545 - timezone: America/Chicago \ No newline at end of file