Skip to content

[pre-commit.ci] pre-commit autoupdate #679

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #679

Workflow file for this run

name: CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: "3.9"
DOCUMENTATION_CNAME: 'twin.docs.pyansys.com'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
doc-style:
name: "Running documentation style checks"
runs-on: ubuntu-latest
steps:
- name: "Running documentation style checks"
uses: ansys/actions/doc-style@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc-build:
name: "Building library documentation"
runs-on: pytwin-win10
needs: doc-style
steps:
- name: "Install Git and clone project"
uses: actions/checkout@v4
- name: "Set up Python"
uses: ansys/actions/_setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
use-cache: true
- name: "Update pip"
shell: bash
run: python -m pip install -U pip
- name: "Install Python library"
shell: bash
run: python -m pip install .
- name: "Install documentation dependencies from requirements file"
shell: bash
run: python -m pip install -r requirements/requirements_doc.txt
- name: "Clean documentation build folder"
shell: bash
run: doc/make.bat clean
- name: "Build HTML documentation"
shell: bash
run: doc/make.bat html
- name: "Upload HTML documentation artifact"
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
build-library:
name: "Smoke test and building"
runs-on: ubuntu-latest
steps:
- name: "Build library source and wheel artifacts"
uses: ansys/actions/build-library@v5
with:
library-name: "pytwin"
python-version: ${{ env.MAIN_PYTHON_VERSION }}
tests:
name: Test library
needs: build-library
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [pytwin-win10, ubuntu-20.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Install Ubuntu dependencies for RomViewerSharedLib.so
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libosmesa6
- name: Run pytest
uses: ansys/actions/tests-pytest@v5
with:
python-version: ${{ matrix.python-version }}
pytest-extra-args: "--cov=pytwin --cov-report=term --cov-report=xml:.cov/coverage.xml --cov-report=html:.cov/html"
env:
ANSYSLMD_LICENSE_FILE: 1055@${{ secrets.LICENSE_SERVER }}
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python-version }}_${{ matrix.os }}_pytest.html
path: .cov/html
retention-days: 7
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
check-licenses:
name: "Check library dependencies ship with valid licenses"
runs-on: ubuntu-latest
steps:
- name: "Validate third party licenses"
uses: ansys/actions/check-licenses@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
release-pypi-public:
name: "Release to public PyPI"
runs-on: ubuntu-latest
needs: [tests, doc-build]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the public PyPI repository"
uses: ansys/actions/release-pypi-public@v5
with:
library-name: "pytwin"
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
doc-deploy-dev:
name: "Deploy developers documentation"
runs-on: ubuntu-latest
needs: doc-build
if: github.ref == 'refs/heads/main'
steps:
- name: "Deploy the latest documentation"
uses: ansys/actions/doc-deploy-dev@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: doc-build
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Deploy the stable documentation"
uses: ansys/actions/doc-deploy-stable@v5
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}