@@ -65,61 +65,92 @@ jobs:
6565
6666 doc-build :
6767 name : " Doc build"
68- runs-on : ubuntu-latest
68+ runs-on : [self-hosted, pystk]
6969 needs : doc-style
7070 timeout-minutes : 30
7171 steps :
7272
73+ - name : " Checkout the project"
74+ uses : actions/checkout@v4
75+
76+ - name : " Generate the name of the Docker image and the container"
77+ run : |
78+ python_image_name=${{ env.STK_DOCKER_IMAGE }}-python${{ env.MAIN_PYTHON_VERSION }}
79+ container_name=stk-python${{ env.MAIN_PYTHON_VERSION }}
80+ echo "STK_PYTHON_IMAGE=$python_image_name" >> $GITHUB_ENV
81+ echo "STK_CONTAINER=$container_name" >> $GITHUB_ENV
82+
83+ - name : " Start the container from the desired image"
84+ run : |
85+ docker run \
86+ --detach -it \
87+ --network="host" \
88+ --name ${{ env.STK_CONTAINER }} \
89+ --env ANSYSLMD_LICENSE_FILE=${{ env.LICENSE_SERVER_PORT }}@${{ secrets.LICENSE_SERVER }} \
90+ --volume ${PWD}:/home/stk/pystk \
91+ ${{ env.STK_PYTHON_IMAGE }}
92+
93+ - name : " Install Pandoc inside the container"
94+ run : |
95+ docker exec \
96+ --user root \
97+ --workdir ${{ env.PYSTK_DIR }} \
98+ ${{ env.STK_CONTAINER }} /bin/bash -c \
99+ "yum install -y epel-release && yum install -y pandoc --enablerepo=epel"
100+
101+ - name : " Install Tox"
102+ run : |
103+ docker exec \
104+ --workdir ${{ env.PYSTK_DIR }} \
105+ ${{ env.STK_CONTAINER }} /bin/bash -c \
106+ "python -m pip install tox && rm -rf .tox"
107+
73108 # Render the documentation including or excluding different sections
74109 # according to the labels of the pull-request.
75110
76111 - name : " Build docs including the 'Examples' section"
77112 id : build-doc-with-examples
78- uses : ansys/actions/doc-build@v5
79113 if : |
80114 contains(github.event.pull_request.labels.*.name, 'docs:examples') &&
81115 !contains(github.event.pull_request.labels.*.name, 'docs:api')
82- with :
83- python-version : ${{ env.MAIN_PYTHON_VERSION }}
84- env :
85- BUILD_API : false
86- BUILD_EXAMPLES : true
116+ run : |
117+ docker exec \
118+ --workdir ${{ env.PYSTK_DIR }} \
119+ ${{ env.STK_CONTAINER }} /bin/bash -c \
120+ "export BUILD_API=false BUILD_EXAMPLES= true && tox -e doc"
87121
88122 - name : " Build docs including the 'API' section"
89123 id : build-doc-with-api
90- uses : ansys/actions/doc-build@v5
91124 if : |
92125 contains(github.event.pull_request.labels.*.name, 'docs:api') &&
93126 !contains(github.event.pull_request.labels.*.name, 'docs:examples')
94- with :
95- python-version : ${{ env.MAIN_PYTHON_VERSION }}
96- env :
97- BUILD_API : true
98- BUILD_EXAMPLES : false
127+ run : |
128+ docker exec \
129+ --workdir ${{ env.PYSTK_DIR }} \
130+ ${{ env.STK_CONTAINER }} /bin/bash -c \
131+ "export BUILD_API=true BUILD_EXAMPLES= false && tox -e doc"
99132
100133 - name : " Build docs excluding 'API' and 'Examples' sections"
101134 id : build-doc-minimum
102- uses : ansys/actions/doc-build@v5
103135 if : |
104136 !contains(github.event.pull_request.labels.*.name, 'docs:examples') &&
105137 !contains(github.event.pull_request.labels.*.name, 'docs:api')
106- with :
107- python-version : ${{ env.MAIN_PYTHON_VERSION }}
108- env :
109- BUILD_API : false
110- BUILD_EXAMPLES : false
138+ run : |
139+ docker exec \
140+ --workdir ${{ env.PYSTK_DIR }} \
141+ ${{ env.STK_CONTAINER }} /bin/bash -c \
142+ "export BUILD_API= false BUILD_EXAMPLES=false && tox -e doc"
111143
112144 - name : " Build docs including 'API' and 'Examples' sections"
113145 id : build-doc-full
114- uses : ansys/actions/doc-build@v5
115146 if : |
116147 contains(github.event.pull_request.labels.*.name, 'docs:examples') &&
117148 contains(github.event.pull_request.labels.*.name, 'docs:api')
118- with :
119- python-version : ${{ env.MAIN_PYTHON_VERSION }}
120- env :
121- BUILD_API : true
122- BUILD_EXAMPLES : true
149+ run : |
150+ docker exec \
151+ --workdir ${{ env.PYSTK_DIR }} \
152+ ${{ env.STK_CONTAINER }} /bin/bash -c \
153+ "export BUILD_API= true BUILD_EXAMPLES=true && tox -e doc"
123154
124155 # If required, combine partially rendered documentation with the nightly
125156 # build artifacts. Upload the generated documentation as an artifact in
@@ -134,15 +165,15 @@ jobs:
134165
135166 - name : " Include 'API' section from nightly build docs"
136167 if : |
137- steps.build-doc-with-api .outcome == 'success' ||
168+ steps.build-doc-with-examples .outcome == 'success' ||
138169 steps.build-doc-minimum.outcome == 'success'
139170 run : |
140171 cp -r gh-pages/version/dev/api doc/_build/html/api
141172 cp gh-pages/version/dev/index.html doc/_build/html/index.html
142173
143174 - name : " Include 'Examples' section from nightly build docs"
144175 if : |
145- steps.build-doc-with-examples .outcome == 'success' ||
176+ steps.build-doc-with-api .outcome == 'success' ||
146177 steps.build-doc-minimum.outcome == 'success'
147178 run : |
148179 cp gh-pages/version/dev/examples.html doc/_build/html/examples.html
@@ -155,6 +186,13 @@ jobs:
155186 path : doc/_build/html
156187 name : full-documentation-html
157188
189+ - name : " Stop the container"
190+ if : always()
191+ run : |
192+ docker stop ${{ env.STK_CONTAINER }}
193+ docker logs ${{ env.STK_CONTAINER }}
194+ docker rm ${{ env.STK_CONTAINER }}
195+
158196 tests :
159197 name : " Tests Python ${{ matrix.python }}"
160198 runs-on : [self-hosted, pystk]
0 commit comments