Skip to content

CHORE: Second pass of oss code review #134

CHORE: Second pass of oss code review

CHORE: Second pass of oss code review #134

Workflow file for this run

name: CI
on:
pull_request:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.11'
PACKAGE_NAME: 'ansys-conceptev-core'
DOCUMENTATION_CNAME: 'conceptev.core.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_HOST_URL: ${{ vars.MEILISEARCH_HOST_URL }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
# LIBRARY_NAME: 'ansys-conceptev-core'
# LIBRARY_NAMESPACE: 'ansys.conceptev.core'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-changelog:
name: "Update CHANGELOG for new tag"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@v6
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
# vulnerabilities:
# name: Vulnerabilities
# runs-on: ubuntu-latest
# steps:
# - name: PyAnsys vulnerability check (on main)
# if: github.ref == 'refs/heads/main'
# uses: ansys/actions/check-vulnerabilities@v6
# with:
# python-version: ${{ env.MAIN_PYTHON_VERSION }}
# python-package-name: ${{ env.PACKAGE_NAME }}
# token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
# - name: PyAnsys vulnerability check (on dev mode)
# if: github.ref != 'refs/heads/main'
# uses: ansys/actions/check-vulnerabilities@v6
# with:
# python-version: ${{ env.MAIN_PYTHON_VERSION }}
# python-package-name: ${{ env.PACKAGE_NAME }}
# token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
# dev-mode: true
code-style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: Documentation style
runs-on: ubuntu-latest
steps:
- name: PyAnsys documentation style checks
uses: ansys/actions/doc-style@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
smoke-tests:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
needs: [code-style]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
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 }}
needs: [smoke-tests]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9","3.10","3.11"]
fail-fast: false
steps:
- uses: ansys/actions/tests-pytest@v6
env:
CONCEPTEV_PASSWORD: ${{ secrets.CONCEPTEV_PASSWORD }}
CONCEPTEV_URL: ${{ vars.CONCEPTEV_URL }}
CONCEPTEV_USERNAME: ${{ vars.CONCEPTEV_USERNAME }}
OCM_URL: ${{ vars.OCM_URL }}
POETRY_VIRTUALENVS_CREATE: ${{ vars.POETRY_VIRTUALENVS_CREATE }}
with:
pytest-extra-args: "-m 'not integration' --cov=ansys --cov-report=term --cov-report=html:.cov/html"
- name: Upload coverage results
uses: actions/upload-artifact@v4
if: env.MAIN_PYTHON_VERSION == matrix.python-version
with:
name: coverage-tests-{{ '${{ matrix.os }}' }}
path: .cov
retention-days: 7
- name: Upload coverage results (as .coverage)
uses: actions/upload-artifact@v4
if: env.MAIN_PYTHON_VERSION == matrix.python-version
with:
name: coverage-file-tests-{{ '${{ matrix.os }}' }}
path: .coverage
retention-days: 7
doc-build:
name: Build documentation
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- uses: ansys/actions/doc-build@v6
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
check-links: false
package:
name: Package library
runs-on: ubuntu-latest
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 }}
doc-deploy-dev:
name: Deploy development documentation
runs-on: ubuntu-latest
needs: [doc-build, package]
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-index-dev:
name: Deploy development index documentation
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [doc-deploy-dev]
steps:
- name: Deploy the latest documentation index
uses: ansys/actions/doc-deploy-index@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/dev
index-name: pyconceptev-core-vdev
host-url: ${{ env.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-deploy-stable:
name: Deploy stable documentation
runs-on: ubuntu-latest
needs: [doc-build, package]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-index-stable:
name: Deploy stable index documentation
runs-on: ubuntu-latest
needs: doc-deploy-stable
steps:
- name: Install Git and clone project
uses: actions/checkout@v4
- name: Install the package requirements
run: pip install -e .
- name: Get the version to PyMeilisearch
run: |
VERSION=$(python -c "from ansys.conceptev.core import __version__; print('.'.join(__version__.split('.')[:2]))")
VERSION_MEILI=$(python -c "from ansys.conceptev.core import __version__; print('-'.join(__version__.split('.')[:2]))")
echo "Calculated VERSION: $VERSION"
echo "Calculated VERSION_MEILI: $VERSION_MEILI"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV
- name: "Deploy the latest documentation index"
uses: ansys/actions/doc-deploy-index@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }}
index-name: pyconceptev-core-v${{ env.VERSION_MEILI }}
host-url: ${{ env.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
# release-pypi-public:
# name: Release to the public PyPI repository
# runs-on: ubuntu-latest
# needs: [package, update-changelog]
# steps:
# - name: "Release to the public PyPI repository"
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
# uses: ansys/actions/release-pypi-public@v6
# with:
# library-name: {{ '${{ env.DOCUMENTATION_CNAME }}' }}
# twine-username: "__token__"
# twine-token: {{ '${{ secrets.PYPI_TOKEN }}' }}
release-github:
name: Release to GitHub
runs-on: ubuntu-latest
needs: [doc-build, package, update-changelog]
steps:
- name: "Release to GitHub"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
uses: ansys/actions/release-github@v6
with:
library-name: ${{ env.DOCUMENTATION_CNAME }}