Nightly doc build for candidate image #779
This file contains hidden or 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: Nightly doc build for candidate image | |
| on: | |
| workflow_dispatch: | |
| schedule: # UTC at 0300 | |
| - cron: "0 3 * * *" | |
| env: | |
| MAIN_PYTHON_VERSION: '3.12' | |
| DEV_MAJOR_REV: '26' | |
| DEV_MINOR_REV: '1' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| packages: read | |
| jobs: | |
| saving-image-versions: | |
| name: Save variations of revn | |
| runs-on: ubuntu-latest | |
| outputs: | |
| major: ${{ steps.save-versions.outputs.major }} | |
| minor: ${{ steps.save-versions.outputs.minor }} | |
| dev_docker_image_version: ${{ steps.save-versions.outputs.dev_docker_image_version }} | |
| 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_MAJOR_REV }}.${{ env.DEV_MINOR_REV }}_candidate" >> $GITHUB_OUTPUT | |
| cat $GITHUB_OUTPUT | |
| display-docker-info: | |
| name: Display Mechanical Image info | |
| runs-on: public-ubuntu-latest-8-cores | |
| needs: ['saving-image-versions'] | |
| outputs: | |
| docker_info: ${{ steps.capture_info.outputs.docker_info }} | |
| build-info: ${{ steps.capture_info.outputs.build_info }} | |
| steps: | |
| - name: Login in Github Container registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull, launch & display info | |
| id: capture_info | |
| run: | | |
| IMAGE_NAME=${{ needs.saving-image-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${{ needs.saving-image-versions.outputs.major }}${{ needs.saving-image-versions.outputs.minor }}/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_MAJOR_REV }}.${{ env.DEV_MINOR_REV }}_candidate pushed at $PUSHED_AT" | |
| echo "Build date : $BUILD_DATE" | |
| echo "::endgroup::" | |
| nightly-doc-build: | |
| name: Documentation building | |
| runs-on: public-ubuntu-latest-8-cores | |
| needs: ['saving-image-versions'] | |
| timeout-minutes: 60 | |
| container: | |
| image: ${{ needs.saving-image-versions.outputs.dev_docker_image_version }} | |
| options: --entrypoint /bin/bash | |
| steps: | |
| - name: Install Git and checkout project | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| shell: bash | |
| run: | | |
| apt update | |
| apt install lsb-release xvfb git curl make -y | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv python install python${{ env.MAIN_PYTHON_VERSION }} | |
| uv venv /env | |
| - name: Install Python requirements | |
| run: | | |
| . /env/bin/activate | |
| uv pip install --upgrade pip | |
| uv pip install -r requirements/requirements_doc.txt | |
| - name: Build docs | |
| env: | |
| SPHINXOPTS: '-j auto' | |
| LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
| ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} | |
| ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 0 | |
| run: | | |
| . /env/bin/activate | |
| xvfb-run mechanical-env make -C doc html | |
| - name: Upload HTML Documentation | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: documentation-html | |
| path: doc/_build/html | |
| retention-days: 7 | |
| build-failure: | |
| name: Teams notify on failure | |
| if: failure() | |
| needs: [ 'nightly-doc-build', 'display-docker-info'] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - 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_MAJOR_REV }}.${{ env.DEV_MINOR_REV }}_candidate build at ${{ needs.display-docker-info.outputs.build_info }} , pushed at ${{ needs.display-docker-info.outputs.docker_info }} (UTC) | |
| notification-color: dc3545 | |
| timezone: America/Chicago |