Skip to content

Update API spec 24.2 dev 720.1 #111

Update API spec 24.2 dev 720.1

Update API spec 24.2 dev 720.1 #111

name: 'CI'
# Update the paths once you have created a client library build
on:
workflow_dispatch:
push:
tags:
- "*"
paths:
- "ansys-grantami-serverapi-openapi/**"
pull_request:
paths:
- "ansys-grantami-serverapi-openapi/**"
env:
MAIN_PYTHON_VERSION: '3.10'
jobs:
tests:
name: "Test Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
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: ansys-grantami-serverapi-openapi
- name: "Test with pytest"
working-directory: ansys-grantami-serverapi-openapi
run: poetry run -- pytest
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: ansys-grantami-serverapi-openapi
run: |
python -m build .
- name: "Validate integrity of artifacts"
working-directory: ansys-grantami-serverapi-openapi
run: |
python -m twine check dist/*
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: ansys-grantami-serverapi-openapi-wheel
path: ansys-grantami-serverapi-openapi/dist/
retention-days: 7
release:
name: "Release"
if: contains(github.ref, 'refs/tags') && github.event_name == 'push'
needs: build-library
runs-on: ubuntu-latest
steps:
- name: "Checkout the project"
uses: actions/checkout@v4
- name: "Set up Python ${{ env.MAIN_PYTHON_VERSION }}"
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Download distribution artifacts"
uses: actions/download-artifact@v4
with:
name: ansys-grantami-serverapi-openapi-wheel
path: ~/dist
- name: "Install Python dependencies"
run: |
python -m pip install --upgrade pip twine
- name: "Release to private PyPI"
run: |
python -m twine upload --verbose --skip-existing --non-interactive ~/dist/*.whl
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
TWINE_REPOSITORY_URL: "https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload"
- name: "Release to public PyPI"
run: |
python -m twine upload --verbose --skip-existing --non-interactive ~/dist/*.whl
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
- name: "Release to GitHub"
uses: softprops/action-gh-release@v1
with:
files: ~/dist/ansys-grantami-serverapi-openapi-wheel/*.whl