CI Nightly #230
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 25.1.0 | |
MECH_VERSION: 251 | |
DOCKER_MECH_CONTAINER_NAME: mechanical | |
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/v${{ env.MECH_VERSION }}/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 |