Skip to content

[pre-commit.ci] pre-commit autoupdate (#260) #686

[pre-commit.ci] pre-commit autoupdate (#260)

[pre-commit.ci] pre-commit autoupdate (#260) #686

Workflow file for this run

name: CI
on:
workflow_dispatch:
# schedule: # UTC at 0300
# - cron: "0 3 * * *"
pull_request:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.10'
PYMECHANICAL_PORT: 10000 # default won't work on GitHub runners
PYMECHANICAL_START_INSTANCE: FALSE
DOCKER_PACKAGE: ghcr.io/ansys/mechanical
DOCKER_IMAGE_VERSION: 24.2.0
DOCKER_MECH_CONTAINER_NAME: mechanical
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 }}
docs:
name: Documentation
needs: [style, doc-style]
runs-on: public-ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y texlive-latex-extra latexmk nodejs npm graphviz
npm install -g @mermaid-js/mermaid-cli
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip tox
- name: Login in Github Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull, launch, and validate Mechanical service
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
MECHANICAL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION }}
run: |
echo CPU info
lscpu
docker pull ${{ env.MECHANICAL_IMAGE }}
docker run --restart always --name ${{ env.DOCKER_MECH_CONTAINER_NAME }} -e ANSYSLMD_LICENSE_FILE=1055@${{ env.LICENSE_SERVER }} -p ${{ env.PYMECHANICAL_PORT }}:10000 ${{ env.MECHANICAL_IMAGE }} > log.txt &
grep -q 'WB Initialize Done' <(timeout 60 tail -f log.txt)
- name: Build HTML documentation
run: tox -e doc
- name: Upload HTML documentation
uses: actions/upload-artifact@v4
with:
name: HTML-Documentation
path: .tox/doc_out_html/
retention-days: 7
- name: Get Mechanical container logs
if: always()
run: docker logs ${{ env.DOCKER_MECH_CONTAINER_NAME }} > mechanical_documentation_log.txt 2>&1
- name: Upload container logs
uses: actions/upload-artifact@v4
with:
name: mechanical_documentation_log
path: mechanical_documentation_log.txt
retention-days: 7
- name: Deploy to gh-pages
if: contains(github.ref, 'refs/heads/main')
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: .tox/doc_out_html/
clean: true
single-commit: true