Skip to content

fix: version switcher #384

fix: version switcher

fix: version switcher #384

Workflow file for this run

name: GitHub CI
on:
pull_request:
push:
tags:
- "*"
branches:
- main
workflow_dispatch:
env:
MAIN_PYTHON_VERSION: '3.12'
DOCUMENTATION_CNAME: 'local-product-launcher.tools.docs.pyansys.com'
PACKAGE_NAME: 'ansys-tools-local-product-launcher'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
style:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry tox
- name: Test with tox
run: tox -e style
doc-style:
name: "Documentation style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-style@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
build-wheelhouse:
name: "Build wheelhouse"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
- should-release: false
os: macos-latest
steps:
- name: "Build wheelhouse and perform smoke test"
uses: ansys/actions/build-wheelhouse@v6
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
tests:
name: Tests and coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry tox tox-gh-actions
- name: Test with tox
# Only the tox environment specified in the tox.ini gh-actions is run
run: tox
- name: "Upload coverage report (HTML)"
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == env.MAIN_PYTHON_VERSION
with:
name: coverage-report-html
path: htmlcov
retention-days: 7
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == env.MAIN_PYTHON_VERSION
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: coverage.xml
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry tox
- name: Generate the HTML documentation with tox
run: tox -e doc
- name: "Upload HTML Documentation"
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: .tox/doc_out/html/
retention-days: 7
- name: "Install OS packages for PDF"
run: |
sudo apt-get update
sudo apt-get install latexmk texlive-latex-extra
- name: Generate the PDF documentation with tox
run: tox -e doc-linux-pdf
- name: "Upload PDF Documentation"
uses: actions/upload-artifact@v4
with:
name: documentation-pdf
path: .tox/doc_out/latex/ansys-tools-local-product-launcher.pdf
retention-days: 7
build:
name: Build library
runs-on: ubuntu-latest
needs: [style, tests, doc-style, docs, build-wheelhouse]
steps:
- name: "Build library source and wheel artifacts"
uses: ansys/actions/build-library@v6
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Release to the public PyPI repository
uses: ansys/actions/release-pypi-public@v6
with:
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
- name: Release to GitHub
uses: ansys/actions/release-github@v6
with:
library-name: ${{ env.PACKAGE_NAME }}
upload_docs_dev:
name: "Upload dev documentation"
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
upload_docs_release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}