Skip to content

night

night #899

Workflow file for this run

name: night
on:
workflow_dispatch:
inputs:
run-doc:
description: 'Build and deploy documentation'
required: true
default: true
type: boolean
run-tests:
description: 'Run tests'
required: true
default: true
type: boolean
schedule:
# From Monday to Friday (both included) at 00:00 UTC. Used for running only
# the 'MAIN_PYTHON_VERSION'.
- cron: '0 0 * * 1-5'
# From Saturday to Sunday (both included) at 00:00 UTC. Used for running the
# complete list of Python versions.
- cron: '0 0 * * 6,0'
env:
ANSYS_STK: 'ansys-stk'
DOCUMENTATION_CNAME: 'stk.docs.pyansys.com'
LICENSE_SERVER_PORT: '1055'
MAIN_PYTHON_VERSION: '3.12'
MINIMUM_PYTHON_VERSION: '3.10'
PYSTK_DIR: '/home/stk/pystk'
QUARTO_VERSION: '1.5.55'
STK_DOCKER_IMAGE: 'ansys/stk-13.0:dev-ubuntu22.04'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Apply the principle of least privilege to state at job level the right
# permissions. More information about workflow permissions in the page
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions
permissions: {}
jobs:
build-wheelhouse:
name: "Wheelhouse ansys-stk[${{ matrix.target }}] / ${{ matrix.os }} / ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
if: (github.event_name == 'workflow_dispatch' && inputs.run-doc == true) || github.event_name == 'schedule'
permissions:
attestations: write
contents: read
id-token: write
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
target: ['core', 'extensions', 'grpc', 'jupyter', 'migration', 'all']
steps:
- uses: ansys/actions/build-wheelhouse@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
with:
library-name: ${{ env.ANSYS_STK }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
target: ${{ matrix.target }}
attest-provenance: true
doc-build:
name: "Doc build"
runs-on: [self-hosted, pystk]
timeout-minutes: 360
needs: build-wheelhouse
permissions:
contents: read
steps:
- name: "Checkout the project"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Download wheelhouse into static path"
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: "doc/source/_static/wheelhouse"
pattern: "*-wheelhouse-*"
- name: "Display the wheelhouse layout"
run: |
tree doc/source/_static/wheelhouse
- name: "Generate the name of the Docker image and the container"
id: docker
env:
RUNNER: ${{ runner.name }}
run: |
image_name="${STK_DOCKER_IMAGE}-python${MAIN_PYTHON_VERSION}"
container_name="stk-python${MAIN_PYTHON_VERSION}-${RUNNER}"
echo "image=${image_name}" >> "${GITHUB_OUTPUT}"
echo "container=${container_name}" >> "${GITHUB_OUTPUT}"
- name: "Start the container from the desired image"
env:
STK_IMAGE: ${{ steps.docker.outputs.image }}
STK_CONTAINER: ${{ steps.docker.outputs.container }}
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
run: |
docker run \
--detach -it \
--network="host" \
--name="${STK_CONTAINER}" \
--env ANSYSLMD_LICENSE_FILE="${LICENSE_SERVER_PORT}@${LICENSE_SERVER}" \
--volume ${PWD}:/home/stk/pystk \
"${STK_IMAGE}"
- name: "Install system dependencies required for building examples"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--user root \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"apt update && apt install -y wget pandoc"
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"wget --no-check-certificate https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb"
docker exec \
--user root \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"dpkg -i quarto-${QUARTO_VERSION}-linux-amd64.deb"
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"quarto install tinytex"
- name: "Install Tox"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"python -m pip install --upgrade pip tox && rm -rf .tox"
- name: "Build the full documentation"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export BUILD_API=true BUILD_EXAMPLES=true && tox -e doc-links,doc-html"
- name: "Upload combined artifacts"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
path: doc/_build/html
name: documentation-html
- name: "Stop the container"
if: always()
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker stop "${STK_CONTAINER}"
docker logs "${STK_CONTAINER}"
docker rm "${STK_CONTAINER}"
tests:
name: "Tests Python ${{ matrix.python }}"
runs-on: [self-hosted, pystk]
if: (github.event_name == 'workflow_dispatch' && inputs.run-tests == true) || github.event_name == 'schedule'
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13']
is-weekly-run:
- ${{ github.event_name == 'schedule' && github.event.schedule == '0 0 * * 1-5' }}
exclude:
- is-weekly-run: true
python: "3.10"
- is-weekly-run: true
python: "3.11"
- is-weekly-run: true
python: "3.12"
fail-fast: false
permissions:
contents: read
steps:
- name: "Checkout the project"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Generate the name of the Docker image and the container"
id: docker
env:
RUNNER: ${{ runner.name }}
run: |
image_name="${STK_DOCKER_IMAGE}-python${MAIN_PYTHON_VERSION}"
container_name="stk-python${MAIN_PYTHON_VERSION}-${RUNNER}"
echo "image=${image_name}" >> "${GITHUB_OUTPUT}"
echo "container=${container_name}" >> "${GITHUB_OUTPUT}"
- name: "Start the container from the desired image"
env:
STK_IMAGE: ${{ steps.docker.outputs.image }}
STK_CONTAINER: ${{ steps.docker.outputs.container }}
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
run: |
docker run \
--detach -it \
--network="host" \
--name "${STK_CONTAINER}" \
--env ANSYSLMD_LICENSE_FILE="${LICENSE_SERVER_PORT}@${LICENSE_SERVER}" \
--volume ${PWD}:/home/stk/pystk \
"${STK_IMAGE}"
container_name=$(docker ps --latest --format "{{.Names}}")
echo "name=${container_name}" >> "${GITHUB_OUTPUT}"
- name: "Install the project with the testing dependencies"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"python -m pip install --upgrade pip tox && rm -rf .tox"
- name: "Install coverage dependencies"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"python -m pip install --group tests ."
# -- Tests
- name: "Run the extensions tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/extensions && tox -e tests-extensions-cov"
- name: "Run the API migration assistant tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/migration && tox -e tests-core-migration-cov"
- name: "Run the aviator tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/aviator && tox -e tests-core-aviator-graphics-cov-linux"
- name: "Run the non graphics stk tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/stknogfx && tox -e tests-core-stk-nographics-cov-linux"
- name: "Run the graphics only stk tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/stkgfx && tox -e tests-core-stk-graphicsonly-cov-linux"
- name: "Run the vgt tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/vgt && tox -e tests-core-vgt-graphics-cov-linux"
- name: "Run the doc snippet tests"
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=.cov/snippets && tox -e tests-core-snippets-graphics-cov-linux"
# -- Coverage
- name: "Combine all coverage results"
if: ${{ matrix.python == env.MINIMUM_PYTHON_VERSION }}
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR}/.cov \
"${STK_CONTAINER}" /bin/bash -c \
"export COVERAGE_FILE=coverage && coverage combine aviator stknogfx stkgfx vgt snippets migration extensions"
- name: "Generate coverage report in XML and HTML"
if: ${{ matrix.python == env.MINIMUM_PYTHON_VERSION }}
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"coverage html --rcfile pyproject.toml --data-file=.cov/coverage --directory=.cov/${ANSYS_STK}-coverage --fail-under=89"
docker exec \
--workdir ${PYSTK_DIR} \
"${STK_CONTAINER}" /bin/bash -c \
"coverage xml --rcfile pyproject.toml --data-file=.cov/coverage -o .cov/coverage.xml"
- name: "Upload ${{ env.ANSYS_STK }} coverage results"
if: ${{ matrix.python == env.MINIMUM_PYTHON_VERSION }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
path: .cov/${ANSYS_STK}-coverage
name: ${ANSYS_STK}-coverage
- name: "Upload coverage reports to Codecov"
if: ${{ matrix.python == env.MINIMUM_PYTHON_VERSION }}
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
files: .cov/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: "Stop the container"
if: always()
env:
STK_CONTAINER: ${{ steps.docker.outputs.container }}
run: |
docker stop "${STK_CONTAINER}"
docker logs "${STK_CONTAINER}"
docker rm "${STK_CONTAINER}"
doc-deploy-dev:
name: "Deploy dev docs"
runs-on: ubuntu-latest
needs: doc-build
permissions:
contents: write
steps:
- uses: ansys/actions/doc-deploy-dev@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}