Skip to content

MAINT: Bump ansys/actions from 7 to 8 (#226) #1138

MAINT: Bump ansys/actions from 7 to 8 (#226)

MAINT: Bump ansys/actions from 7 to 8 (#226) #1138

Workflow file for this run

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@v8
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@v8
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
- 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