Skip to content

Commit

Permalink
Feat: add nightly for 242 (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
dipinknair authored Mar 29, 2024
1 parent fc321ec commit fa745d0
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/ci_cd_nightly.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ cython_debug/
doc/source/examples
**/examples/**/*.png
**/examples/**/*.gif
doc/source/sg_execution_times.rst

# VSCode
.vscode
Expand Down

0 comments on commit fa745d0

Please sign in to comment.