-
Notifications
You must be signed in to change notification settings - Fork 121
127 lines (107 loc) · 5 KB
/
nightly-doc-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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.`,
}"