From fa745d01f813392be707a0332d9e73fb342a4805 Mon Sep 17 00:00:00 2001 From: Dipin <26918585+dipinknair@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:02:33 -0500 Subject: [PATCH] Feat: add nightly for 242 (#196) --- .github/workflows/ci_cd.yml | 2 - .github/workflows/ci_cd_nightly.yml | 115 ++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci_cd_nightly.yml diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 14ab7bb7..96c08bbc 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -20,8 +20,6 @@ env: DOCKER_MECH_CONTAINER_NAME: mechanical PACKAGE_NAME: ansys-mechanical-core PACKAGE_NAMESPACE: ansys.mechanical.core - RESET_EXAMPLES_CACHE: 0 - RESET_DOC_BUILD_CACHE: 0 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/ci_cd_nightly.yml b/.github/workflows/ci_cd_nightly.yml new file mode 100644 index 00000000..95c83d5e --- /dev/null +++ b/.github/workflows/ci_cd_nightly.yml @@ -0,0 +1,115 @@ +name: CI Nightly + +on: + workflow_dispatch: + schedule: # UTC at 0300 + - cron: "0 3 * * *" + +env: + MAIN_PYTHON_VERSION: '3.10' + PYMECHANICAL_PORT: 10000 # default won't work on GitHub runners + PYMECHANICAL_START_INSTANCE: FALSE + DOCKER_PACKAGE: ghcr.io/ansys/mechanical + DOCKER_IMAGE_VERSION: 24.2.0 + DOCKER_MECH_CONTAINER_NAME: mechanical + PACKAGE_NAME: ansys-mechanical-core + PACKAGE_NAMESPACE: ansys.mechanical.core + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + pull-requests: write + packages: read + +jobs: + + nightly-doc-build: + name: Documentation building + runs-on: public-ubuntu-latest-8-cores + outputs: + docker_info: ${{ steps.capture_info.outputs.docker_info }} + build_info: ${{ steps.capture_info.outputs.build_info }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y nodejs npm graphviz + npm install -g @mermaid-js/mermaid-cli + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip tox + + - 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 }} + MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION }} + id: capture_info + run: | + echo CPU info + lscpu + docker pull ${{ env.MECHANICAL_IMAGE }} + BUILD_DATE=$(docker run --rm --entrypoint head ${{ env.MECHANICAL_IMAGE }} -n 1 /install/ansys_inc/v242/aisol/CommonFiles/builddate.txt) + 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) + PUSHED_AT=$(docker inspect --format='{{.Created}}' ${{ env.MECHANICAL_IMAGE }}) + echo "::group::Docker Info" + echo "docker_info=$PUSHED_AT" >> $GITHUB_OUTPUT + echo "build_info=$BUILD_DATE" >> $GITHUB_OUTPUT + echo "${{ env.DOCKER_IMAGE_VERSION }} pushed at $PUSHED_AT" + echo "Build date : $BUILD_DATE" + echo "::endgroup::" + + - name: Build HTML documentation + run: tox -e doc + + - name: Upload HTML documentation + uses: actions/upload-artifact@v4 + with: + name: HTML-Documentation + path: .tox/doc_out_html/ + retention-days: 7 + + - name: Get Mechanical container logs + if: always() + run: docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_documentation_log.txt 2>&1 + + - name: Upload container logs + uses: actions/upload-artifact@v4 + with: + name: mechanical_documentation_log + path: mechanical_documentation_log.txt + retention-days: 7 + + build-failure: + name: Teams notify on failure + if: failure() + needs: [ 'nightly-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.MECHANICAL_IMAGE }} build at ${{ needs.nightly-doc-build.outputs.build_info }} , pushed at ${{ needs.nightly-doc-build.outputs.docker_info }} (UTC) + notification-color: dc3545 + timezone: America/Chicago diff --git a/.gitignore b/.gitignore index ac3083ec..ee1d2265 100644 --- a/.gitignore +++ b/.gitignore @@ -159,6 +159,7 @@ cython_debug/ doc/source/examples **/examples/**/*.png **/examples/**/*.gif +doc/source/sg_execution_times.rst # VSCode .vscode