Skip to content

Exposure of Stackup #886

Exposure of Stackup

Exposure of Stackup #886

Workflow file for this run

# check spelling, codestyle
name: GitHub CI
# run only on main branch. This avoids duplicated actions on PRs
on:
pull_request:
push:
tags:
- "*"
branches:
- main
workflow_dispatch:
inputs:
api_branch:
description: "Branch of the 'ansys-api-acp' repository used during the build."
required: false
docker_image_suffix:
description: "Suffix of the 'pyacp' docker image used for testing. For example, ':latest', or '@sha256:<hash>' (without quotes)."
required: false
env:
MAIN_PYTHON_VERSION: "3.8"
PACKAGE_NAME: "ansys-acp-core"
DOCUMENTATION_CNAME: "acp.docs.pyansys.com"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
code-style:
name: "Pre-commit Check"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('poetry.lock') }}-precommit
restore-keys: |
pip-${{ runner.os }}
# pre-commit needs all dev dependencies, since it also checks the test and example files
# TODO: remove 'poetry config installer.modern-installation false' once we use a pydata-sphinx-theme
# version where https://github.com/pydata/pydata-sphinx-theme/issues/1253 is resolved.
# The same needs to be removed in the README.
- name: Install library, with all optional groups
run: |
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-acp".insteadOf "https://github.com/ansys-internal/ansys-api-acp"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-filetransfer".insteadOf "https://github.com/ansys-internal/ansys-tools-filetransfer"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-tools-filetransfer".insteadOf "https://github.com/ansys-internal/ansys-api-tools-filetransfer"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-local-product-launcher".insteadOf "https://github.com/ansys-internal/ansys-tools-local-product-launcher"
pip install poetry
poetry config installer.modern-installation false
poetry install --with dev,test
- name: Install custom API branch if needed
if: "${{ github.event.inputs.api_branch != '' }}"
run: |
poetry run pip install --force-reinstall git+https://github.com/ansys-internal/ansys-api-acp.git@${{ github.event.inputs.api_branch }}
- name: Run pre-commit
run: |
poetry run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
doc-style:
name: "Documentation style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-style@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build packages
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('poetry.lock') }}-precommit
restore-keys: |
pip-${{ runner.os }}
- name: Build packages
run: |
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-acp".insteadOf "https://github.com/ansys-internal/ansys-api-acp"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-local-product-launcher".insteadOf "https://github.com/ansys-internal/ansys-tools-local-product-launcher"
pip install poetry
poetry build
- name: Validate packages
run: |
pip install twine
twine check dist/*
- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: Packages
path: dist/
retention-days: 7
testing:
name: Testing
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.8", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}-testing
restore-keys: |
pip-${{ runner.os }}-${{ matrix.python-version }}
- name: Install library, with test group
run: |
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-acp".insteadOf "https://github.com/ansys-internal/ansys-api-acp"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-filetransfer".insteadOf "https://github.com/ansys-internal/ansys-tools-filetransfer"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-tools-filetransfer".insteadOf "https://github.com/ansys-internal/ansys-api-tools-filetransfer"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-local-product-launcher".insteadOf "https://github.com/ansys-internal/ansys-tools-local-product-launcher"
pip install poetry
poetry install --with test
- name: Install custom API branch if needed
if: "${{ github.event.inputs.api_branch != '' }}"
run: |
poetry run pip install --force-reinstall git+https://github.com/ansys-internal/ansys-api-acp.git@${{ github.event.inputs.api_branch }}
- name: Login in Github Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Unit testing
working-directory: tests/unittests
run: |
docker pull $IMAGE_NAME
poetry run pytest -v --license-server=1055@$LICENSE_SERVER --no-server-log-files --docker-image=$IMAGE_NAME
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
IMAGE_NAME: "ghcr.io/ansys-internal/pyacp${{ github.event.inputs.docker_image_suffix }}"
- name: Benchmarks
working-directory: tests/benchmarks
run: |
poetry run pytest -v --license-server=1055@$LICENSE_SERVER --no-server-log-files --docker-image=$IMAGE_NAME --build-benchmark-image --benchmark-json benchmark_output.json --benchmark-group-by=fullname ${{ (matrix.python-version == '3.8' && github.ref == 'refs/heads/main') && ' ' || '--validate-benchmarks-only' }}
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
IMAGE_NAME: "ghcr.io/ansys-internal/pyacp${{ github.event.inputs.docker_image_suffix }}"
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: 'PyACP benchmarks'
tool: 'pytest'
output-file-path: tests/benchmarks/benchmark_output.json
benchmark-data-dir-path: benchmarks
auto-push: true
github-token: ${{ secrets.GITHUB_TOKEN }}
if: matrix.python-version == '3.8' && github.ref == 'refs/heads/main'
docs:
name: Build Documentation
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('poetry.lock') }}-docs
restore-keys: |
pip-${{ runner.os }}
- name: Login in Github Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: pyansys-ci-bot
password: ${{ secrets.PYANSYS_CI_BOT_PACKAGE_TOKEN }}
- name: Install OS packages
run: |
sudo apt update
sudo apt-get install pandoc xvfb
- name: Install library, with dev group
run: |
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-acp".insteadOf "https://github.com/ansys-internal/ansys-api-acp"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-filetransfer".insteadOf "https://github.com/ansys-internal/ansys-tools-filetransfer"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-api-tools-filetransfer".insteadOf "https://github.com/ansys-internal/ansys-api-tools-filetransfer"
git config --global url."https://${{ secrets.PYANSYS_CI_BOT_TOKEN }}@github.com/ansys-internal/ansys-tools-local-product-launcher".insteadOf "https://github.com/ansys-internal/ansys-tools-local-product-launcher"
pip install poetry
poetry install --with dev
- name: Install custom API branch if needed
if: "${{ github.event.inputs.api_branch != '' }}"
run: |
poetry run pip install --force-reinstall git+https://github.com/ansys-internal/ansys-api-acp.git@${{ github.event.inputs.api_branch }}
- name: Configure Local Product Launcher for ACP
run: >
poetry run
ansys-launcher configure ACP docker_compose
--image_name_pyacp=ghcr.io/ansys-internal/pyacp${{ github.event.inputs.docker_image_suffix }}
--image_name_filetransfer=ghcr.io/ansys-internal/tools-filetransfer:latest
--license_server=1055@$LICENSE_SERVER
--keep_volume=False
--overwrite_default
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
- name: Launch MAPDL and DPF servers via docker-compose
run: |
docker-compose -f ./docker-compose/docker-compose-extras.yaml up -d
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
ANSYS_DPF_ACCEPT_LA: "Y"
- name: Build HTML
run: |
xvfb-run poetry run make -C doc html SPHINXOPTS="-W --keep-going -v"
- name: Stop and clean up MAPDL and DPF servers
run: |
docker-compose -f ./docker-compose/docker-compose-extras.yaml down -v
- name: Upload HTML Documentation
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: doc/build/html
retention-days: 7
- name: Install OS packages for PDF build
run: |
sudo apt update
sudo apt install build-essential zip pandoc texlive-latex-extra latexmk texlive-pstricks
- name: Restart MAPDL and DPF servers via docker-compose
run: |
docker-compose -f ./docker-compose/docker-compose-extras.yaml up -d
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
ANSYS_DPF_ACCEPT_LA: "Y"
- name: Build PDF Documentation
run: xvfb-run poetry run make -C doc pdf
- name: Upload PDF Documentation
uses: actions/upload-artifact@v3
with:
name: Documentation-pdf
path: doc/build/latex/ansys-acp-core.pdf
retention-days: 7
upload_dev_docs:
name: "Upload dev documentation"
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [docs]
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
force-orphan: false
# Release:
# if: contains(github.ref, 'refs/tags')
# needs: [main, style, docs]
# runs-on: ubuntu-latest
# steps:
# - name: Set up Python
# uses: actions/setup-python@v1
# with:
# python-version: 3.9
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v2
# with:
# name: ansys-acp-core-wheel
# - uses: actions/download-artifact@v2
# with:
# name: Documentation-pdf
# - uses: actions/download-artifact@v2
# with:
# name: Documentation-html
# path: ~/html
# # list current directory
# - name: List directory structure
# run: ls -R
# - name: Deploy
# uses: JamesIves/github-pages-deploy-action@4.1.5
# with:
# BRANCH: gh-pages
# FOLDER: ~/html
# CLEAN: true
# # note how we use the PyPI tokens
# - name: Upload to Azure PyPi (disabled)
# run: |
# pip install twine
# # twine upload --skip-existing ./**/*.whl
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# - name: Release
# uses: softprops/action-gh-release@v1
# with:
# files: |
# ./**/*.whl
# ./**/*.zip
# ./**/*.pdf