-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (129 loc) · 4.1 KB
/
ci_cd.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on:
workflow_dispatch:
pull_request:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.10'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
packages: read
jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v7
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-python-cache: false
doc-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc-build:
name: Documentation building
runs-on: public-ubuntu-latest-8-cores
timeout-minutes: 60
container:
image: ghcr.io/ansys/mechanical:24.2.0
options: --entrypoint /bin/bash
needs: [style, doc-style]
steps:
- name: Install Git and checkout project
uses: actions/checkout@v4
- name: Set up Python
run: |
apt update
apt install --reinstall ca-certificates
apt install lsb-release xvfb software-properties-common make -y
add-apt-repository ppa:deadsnakes/ppa -y
apt install -y python${{ env.MAIN_PYTHON_VERSION }} python${{ env.MAIN_PYTHON_VERSION }}-venv
python${{ env.MAIN_PYTHON_VERSION }} -m venv /env
apt install --reinstall ca-certificates
apt install lsb-release xvfb software-properties-common make -y
add-apt-repository ppa:deadsnakes/ppa -y
apt install -y python${{ env.MAIN_PYTHON_VERSION }} python${{ env.MAIN_PYTHON_VERSION }}-venv
python${{ env.MAIN_PYTHON_VERSION }} -m venv /env
- name: Install Python requirements
run: |
. /env/bin/activate
pip install --upgrade pip
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
. /env/bin/activate
xvfb-run mechanical-env make -C doc html > doc_build_output.txt 2>&1 || true
cat doc_build_output.txt
#
# Check if "build succeeded" string is present in doc_build_output.txt
#
if grep -q "build succeeded" doc_build_output.txt; then
echo "Documentation building succeeded"
exit 0
else
echo "Documentation building failed"
exit 1
fi
- name: Link check
env:
SPHINXOPTS: '-j auto -W --keep-going'
run: |
. /env/bin/activate
xvfb-run make -C doc linkcheck > doc_linkcheck_output.txt 2>&1 || true
cat doc_linkcheck_output.txt
if grep -q "build succeeded" doc_build_output.txt; then
echo "LinkCheck succeeded"
exit 0
else
echo "LinkCheck failed"
exit 1
fi
- name: Upload HTML Documentation
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
doc-deploy:
name: Documentation deploy
runs-on: ubuntu-latest
needs: [doc-build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: documentation-html
path: documentation-html
- name: List all files
run: ls -R .
- name: Deploy to GitHub Pages
if: contains(github.ref, 'refs/heads/main')
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: documentation-html/
clean: true
single-commit: true