Update repo for PyAnsys compatibility #1391
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check spelling, codestyle | ||
name: Build and Test Package | ||
# run only on main branch. This avoids duplicated actions on PRs | ||
on: | ||
pull_request: | ||
merge_group: | ||
push: | ||
tags: | ||
- "*" | ||
branches: | ||
- main | ||
jobs: | ||
code-style: | ||
name: "Code style" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ansys/actions/[email protected] | ||
with: | ||
skip-install: false | ||
docs-style: | ||
name: Documentation Style Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: PyAnsys documentation style checks | ||
uses: pyansys/actions/doc-style@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
test: | ||
name: Unit test on supported platforms | ||
runs-on: ubuntu-latest | ||
services: | ||
# Label used to access the service container | ||
kdc-server: | ||
# Github container registry address | ||
image: ghcr.io/ansys/kdc-container:v0.2 | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
volumes: | ||
# This is needed otherwise there won't be enough entropy to generate a new kerberos realm | ||
- /dev/urandom:/dev/random | ||
- /tmp/keytabs:/tmp/keytabs | ||
ports: | ||
- 749:749 | ||
- 88:88/udp | ||
container: | ||
image: python:${{ matrix.python-version }} | ||
volumes: | ||
- /tmp/keytabs:/tmp/keytabs | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Configure host kerberos | ||
run: | | ||
apt update | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt install -yq krb5-user | ||
cp ./tests/integration/krb5.conf /etc/krb5.conf | ||
./tests/integration/configure_keytab.sh | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install 'tox<4' poetry | ||
- name: Test with tox | ||
run: tox -- --with-kerberos | ||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v3 | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
with: | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Install kerberos headers | ||
run: | | ||
sudo apt-get update | ||
sudo apt install libkrb5-dev | ||
- name: Create wheel | ||
run: | | ||
pip install poetry | ||
poetry build | ||
- name: Validate wheel | ||
run: | | ||
pip install twine | ||
twine check dist/* | ||
- name: Upload wheel | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ansys-grantami-common-wheel | ||
path: dist/ | ||
retention-days: 7 | ||
docs: | ||
name: Build Documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Install kerberos headers | ||
run: | | ||
sudo apt-get update | ||
sudo apt install libkrb5-dev | ||
- name: Install library | ||
run: | | ||
pip install poetry | ||
poetry config installer.modern-installation false | ||
poetry install --with docs --extras "oidc linux-kerberos" | ||
- name: Build HTML | ||
run: make -C doc html SPHINXOPTS="-W" | ||
- name: Build PDF Documentation | ||
run: | | ||
sudo apt update | ||
sudo apt-get install -y texlive-latex-extra latexmk texlive-xetex fonts-freefont-otf xindy | ||
make -C doc latexpdf | ||
- name: Upload HTML Documentation | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Documentation-html | ||
path: doc/build/html | ||
retention-days: 7 | ||
- name: Upload PDF Documentation | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Documentation-pdf | ||
path: doc/build/latex/*.pdf | ||
retention-days: 7 | ||
Release: | ||
if: contains(github.ref, 'refs/tags') | ||
needs: [build, test, style, docs] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/checkout@v4 | ||
# used for documentation deployment | ||
- name: Get Bot Application Token | ||
id: get_workflow_token | ||
uses: peter-murray/workflow-application-token-action@v1 | ||
with: | ||
application_id: ${{ secrets.BOT_APPLICATION_ID }} | ||
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: ansys-grantami-common-wheel | ||
path: ~/dist | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Documentation-pdf | ||
path: ~/pdf | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Documentation-html | ||
path: ~/html | ||
- name: Deploy | ||
uses: JamesIves/[email protected] | ||
with: | ||
repository-name: pyansys/openapi-common-docs | ||
token: ${{ steps.get_workflow_token.outputs.token }} | ||
BRANCH: gh-pages | ||
FOLDER: ~/html | ||
CLEAN: true | ||
# note how we use the PyPI tokens | ||
- name: Upload to PyPi | ||
run: | | ||
pip install twine | ||
twine upload --non-interactive --skip-existing ~/**/*.whl | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
generate_release_notes: true | ||
files: | | ||
./**/*.whl | ||
./**/*.zip | ||