Skip to content

Bump mypy from 1.13.0 to 1.14.0 in /ansys-grantami-serverapi-openapi … #354

Bump mypy from 1.13.0 to 1.14.0 in /ansys-grantami-serverapi-openapi …

Bump mypy from 1.13.0 to 1.14.0 in /ansys-grantami-serverapi-openapi … #354

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.12'
LIBRARY_NAME: 'ansys-grantami-serverapi-openapi'
jobs:
tests:
name: "Test Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
fail-fast: false
steps:
- name: "Checkout the project"
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
python -m pip install poetry
poetry install
working-directory: ${{ env.LIBRARY_NAME }}
- name: "Test with pytest"
working-directory: ${{ env.LIBRARY_NAME }}
run: poetry run pytest
- name: "Run mypy"
working-directory: ${{ env.LIBRARY_NAME }}
run: poetry run mypy
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: tests
steps:
- name: "Checkout the project"
uses: actions/checkout@v4
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install requirements"
run: |
python -m pip install build twine
- name: "Create source and wheel artifacts"
working-directory: ${{ env.LIBRARY_NAME }}
run: |
python -m build .
- name: "Validate integrity of artifacts"
working-directory: ${{ env.LIBRARY_NAME }}
run: |
python -m twine check dist/*
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
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@v8
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: "Release to public PyPI"
uses: ansys/actions/release-pypi-public@v8
with:
library-name: ${{ env.LIBRARY_NAME }}
use-trusted-publisher: true
- name: "Release to private PyPI"
uses: ansys/actions/release-pypi-private@v8
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
- name: "Download distribution artifacts"
uses: actions/download-artifact@v4
with:
name: ${{ env.LIBRARY_NAME }}-artifacts
path: ${{ env.LIBRARY_NAME }}-artifacts
- name: "Release to GitHub"
uses: softprops/action-gh-release@v2
with:
files: ${{ env.LIBRARY_NAME }}-artifacts/*.whl
generate_release_notes: true