Nightly Documentation Build #902
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: Nightly Documentation Build | |
on: | |
schedule: # UTC at 0400 | |
- cron: '0 4 * * *' | |
workflow_dispatch: | |
permissions: | |
packages: read | |
jobs: | |
nightly_docs_build: | |
runs-on: ubuntu-20.04 | |
env: | |
DISPLAY: ':99.0' | |
MAPDL_IMAGE: 'ghcr.io/ansys/pymapdl/mapdl:v23.1.0' | |
PYMAPDL_START_INSTANCE: FALSE | |
PYMAPDL_PORT: 21000 # default won't work on azure | |
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners | |
PYANSYS_OFF_SCREEN: True | |
DPF_START_SERVER: False | |
DPF_PORT: 21002 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: 3.9 | |
- name: Install OS packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install libgl1-mesa-glx xvfb pandoc graphviz -qy | |
- name: Install ansys-mapdl-core | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[doc] | |
xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())" | |
- name: Login in Github Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull, launch, and validate MAPDL service | |
run: | | |
docker pull $MAPDL_IMAGE | |
docker run -e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER -e ANSYS_LOCK="OFF" --restart always --name mapdl -p $PYMAPDL_PORT:50052 $MAPDL_IMAGE -smp > log.txt & | |
grep -q 'Server listening on' <(timeout 60 tail -f log.txt) | |
python -c "from ansys.mapdl.core import launch_mapdl; print(launch_mapdl())" | |
env: | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
- name: DPF Server Activation | |
run: | | |
docker run -d -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev | |
- name: Build Documentation | |
run: | | |
pip install .[doc] | |
xvfb-run make -C doc html | |
- name: Display files structure | |
if: always() | |
run: | | |
mkdir logs-nightly-docs | |
echo "::group:: Display files structure" && ls -R && echo "::endgroup::" | |
ls -R > ./logs-nightly-docs/files_structure.txt | |
- name: Display docker files structures | |
if: always() | |
run: | | |
echo "::group:: Display files structure" && docker exec mapdl /bin/bash -c "ls -R" && echo "::endgroup::" | |
docker exec mapdl /bin/bash -c "ls -R" > ./logs-nightly-docs/docker_files_structure.txt | |
- name: Collect MAPDL logs on failure | |
if: always() | |
run: | | |
docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G 'file*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" | |
docker exec mapdl /bin/bash -c "if compgen -G '*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" | |
docker cp mapdl:/mapdl_logs/. ./logs-nightly-docs/. | |
- name: Tar logs | |
if: always() | |
run: | | |
cp log.txt ./logs-nightly-docs/ | |
tar cvzf ./logs-nightly-docs.tgz ./logs-nightly-docs | |
- name: Upload logs to GitHub | |
if: always() | |
uses: actions/upload-artifact@master | |
with: | |
name: logs-nightly-docs.tgz | |
path: ./logs-nightly-docs.tgz | |
- name: Display MAPDL Logs | |
if: always() | |
run: cat log.txt | |
- name: List main files | |
if: always() | |
run: | | |
if compgen -G 'doc/build/latex/*.log' > /dev/null ;then for f in doc/build/latex/*.log; do echo "::group:: Output latex log file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-nightly-docs/*.err' > /dev/null ;then for f in ./logs-nightly-docs/*.err; do echo "::group:: Error file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-nightly-docs/*.log' > /dev/null ;then for f in ./logs-nightly-docs/*.log; do echo "::group:: Log file $f" && cat $f && echo "::endgroup::" ; done; fi | |
if compgen -G './logs-nightly-docs/*.out' > /dev/null ;then for f in ./logs-nightly-docs/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi | |
- name: Notify if fail | |
uses: skitionek/notify-microsoft-teams@master | |
if: ${{ failure() }} | |
with: | |
webhook_url: ${{ secrets.TEAM_HOOK }} | |
needs: ${{ toJson(needs) }} | |
job: ${{ toJson(job) }} | |
steps: ${{ toJson(steps) }} | |
overwrite: "{ | |
title: `${workflow} failed.`, | |
}" |