MAINT: Bump ansys/actions from 5 to 6 #1040
Workflow file for this run
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: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
env: | |
MAIN_PYTHON_VERSION: '3.9' | |
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@v6 | |
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@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-build: | |
name: Documentation building | |
runs-on: public-ubuntu-latest-8-cores | |
timeout-minutes: 30 | |
container: | |
image: ghcr.io/ansys/mechanical:24.1.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 -y python3.9 python3-pip | |
ln -s /usr/bin/python3.9 /usr/bin/python | |
python -m pip install --upgrade pip | |
python --version | |
pip3 --version | |
- name: Install system dependencies | |
run: | | |
apt update | |
apt install -y make | |
- name: Install Python requirements | |
run: | | |
pip3 install -r requirements/requirements_doc.txt | |
- name: Retrieve PyMechanial version | |
run: | | |
echo "PYMECHANICAL_VERSION=$(python -c 'from ansys.mechanical.core import __version__; print(__version__)')" >> $GITHUB_ENV | |
echo "PyMechanical version is: $(python -c "from ansys.mechanical.core import __version__; print(__version__)")" | |
id: version | |
- name: Build docs | |
env: | |
SPHINXOPTS: '-j auto' | |
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
ANSYSCL241_DIR: /install/ansys_inc/v241/licensingclient | |
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }} | |
ANSYS_WORKBENCH_LOGGING_FILTER_LEVEL: 0 | |
run: | | |
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: | | |
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 |