Skip to content

Update Swagger.json (22162373275) #1046

Update Swagger.json (22162373275)

Update Swagger.json (22162373275) #1046

name: 'CI'
# Update the paths once you have created a client library build
on:
workflow_dispatch:
inputs:
publish-to-private-pypi:
description: Whether to publish the build to the private PyPI
type: choice
options:
- 'true'
- 'false'
default: 'false'
push:
tags:
- "*"
branches:
- main
pull_request:
paths:
- "ansys-grantami-serverapi-openapi/**"
- ".github/workflows/build_and_test_library.yml"
env:
MAIN_PYTHON_VERSION: '3.13'
LIBRARY_NAME: 'ansys-grantami-serverapi-openapi'
jobs:
check-style:
name: "Check code style"
runs-on: ubuntu-latest
steps:
- name: "Checkout the project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install pre-commit"
run: |
uv tool install pre-commit
- name: "Run pre-commit"
run: |
pre-commit run --all-files
tests:
name: "Test Python ${{ matrix.python-version }} - ${{ matrix.platform }}"
runs-on: ${{ matrix.platform }}
needs: check-style
strategy:
matrix:
platform: [ 'ubuntu-latest', 'windows-latest' ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
fail-fast: false
steps:
- name: "Enable long paths on Windows"
if: runner.os == 'Windows'
run: |
git config --system core.longpaths true
- name: "Checkout the project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
python-version: ${{ matrix.python-version }}
- name: "Test with pytest"
working-directory: ${{ env.LIBRARY_NAME }}
run: uv run pytest
- name: "Run mypy"
working-directory: ${{ env.LIBRARY_NAME }}
run: uv run mypy
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: tests
permissions:
id-token: write
attestations: write
steps:
- name: "Checkout the project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
python-version: ${{ matrix.python-version }}
enable-cache: false
- name: "Install requirements"
run: |
uv tool install twine
- name: "Create source and wheel artifacts"
working-directory: ${{ env.LIBRARY_NAME }}
run: |
uv build
- name: "Validate integrity of artifacts"
working-directory: ${{ env.LIBRARY_NAME }}
run: |
twine check dist/*
- name: Generate build provenance attestation
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
with:
subject-path: ${{ env.LIBRARY_NAME }}/dist/
- name: "Upload artifacts"
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
with:
name: ${{ env.LIBRARY_NAME }}-artifacts
path: ${{ env.LIBRARY_NAME }}/dist/
retention-days: 7
publish:
name: "Publish"
runs-on: ubuntu-latest
needs: [build-library]
if: (github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/main') && (inputs.publish-to-private-pypi == 'true')
steps:
- name: "Release to private PyPI"
uses: ansys/actions/release-pypi-private@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
release:
name: "Release"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
environment: release
permissions:
id-token: write
contents: write
steps:
- name: "Download the library artifacts from build-library step"
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: ${{ env.LIBRARY_NAME }}-artifacts
path: ${{ env.LIBRARY_NAME }}-artifacts
- name: "Upload artifacts to PyPI using trusted publisher"
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: "https://upload.pypi.org/legacy/"
print-hash: true
packages-dir: ${{ env.LIBRARY_NAME }}-artifacts
skip-existing: false
- name: "Release to private PyPI"
uses: ansys/actions/release-pypi-private@3931ac9351b13ae11b1203c2ef6b51e5c75502ea # v10.2.5
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
- name: "Release to GitHub"
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b #v2.5.0
with:
files: ${{ env.LIBRARY_NAME }}-artifacts/*.whl
generate_release_notes: true