Skip to content

Build(deps): Bump ansys/actions from 6.1 to 7.0 (#148) #704

Build(deps): Bump ansys/actions from 6.1 to 7.0 (#148)

Build(deps): Bump ansys/actions from 6.1 to 7.0 (#148) #704

Workflow file for this run

name: GitHub CI
on:
pull_request:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.11'
DOCUMENTATION_CNAME: 'pymeilisearch.docs.ansys.com'
LIBRARY_NAME: 'pymeilisearch'
LIBRARY_NAMESPACE: 'ansys.tools.meilisearch'
MEILISEARCH_API_PUBLIC_KEY: ${{ secrets.MEILISEARCH_API_PUBLIC_KEY }}
MEILISEARCH_HOST_URL: "https://backend.search.pyansys.com"
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
code-style:
name: "Code style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: "Documentation style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/[email protected]
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, 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/[email protected]
with:
library-name: ${{ env.LIBRARY_NAME }}
library-namespace: ${{ env.LIBRARY_NAMESPACE }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
check-licenses: false
tests:
name: "Tests docker image"
runs-on: ubuntu-latest
needs: [smoke-tests]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install the project with testing dependencies
run: pip install .[tests]
- name: Run tests
run: pytest tests -vv
doc-build:
name: "Build documentation"
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- uses: ansys/actions/[email protected]
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: [tests, doc-build]
steps:
- uses: ansys/actions/[email protected]
with:
library-name: ${{ env.LIBRARY_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
release:
name: "Release project to private PyPI, public PyPI and GitHub"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: build-library
runs-on: ubuntu-latest
steps:
- name: "Release to the private PyPI repository"
uses: ansys/actions/[email protected]
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
- name: "Release to the public PyPI repository"
uses: ansys/actions/[email protected]
with:
library-name: ${{ env.LIBRARY_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
- name: "Release to GitHub"
uses: ansys/actions/[email protected]
with:
library-name: ${{ env.LIBRARY_NAME }}
doc-deploy-dev:
name: "Deploy development docs"
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build-library]
steps:
- name: Deploy the latest documentation
uses: ansys/actions/[email protected]
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-index-dev:
name: "Deploy dev index docs"
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: doc-deploy-dev
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Install the package requirements
run: pip install -e .
- name: "Deploy the latest documentation index"
run: pymeilisearch upload --template sphinx_pydata --index "pymeilisearch-vdev" html documentation-html --cname ${{ env.DOCUMENTATION_CNAME }}/version/dev
doc-deploy-stable:
name: "Deploy stable docs"
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/[email protected]
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-index-stable:
name: "Deploy stable docs index"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: doc-deploy-stable
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- uses: actions/checkout@v4
- name: Install the package requirements
run: pip install -e .
- name: Scrape the stable documentation to PyMeilisearch
run: |
VERSION=$(python -c "from ansys.tools.meilisearch import __version__; print('.'.join(__version__.split('.')[:2]))")
VERSION_MEILI=$(python -c "from ansys.tools.meilisearch 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/[email protected]
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }}
index-name: pymeilisearch-${{ env.VERSION_MEILI }}
host-url: ${{ env.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}