Skip to content

Merge branch 'main' into ci/security #57

Merge branch 'main' into ci/security

Merge branch 'main' into ci/security #57

Workflow file for this run

name: release

Check failure on line 1 in .github/workflows/ci_cd_release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci_cd_release.yml

Invalid workflow file

(Line: 112, Col: 28): Unrecognized named-value: 'env'. Located at position 1 within expression: env.MAIN_PYTHON_VERSION, (Line: 113, Col: 22): Unrecognized named-value: 'env'. Located at position 1 within expression: env.STK_CONTAINER, (Line: 114, Col: 25): Unrecognized named-value: 'env'. Located at position 1 within expression: env.STK_DOCKER_IMAGE, (Line: 115, Col: 25): Unrecognized named-value: 'env'. Located at position 1 within expression: env.STK_PYTHON_IMAGE, (Line: 116, Col: 23): Unrecognized named-value: 'env'. Located at position 1 within expression: env.QUARTO_VERSION, (Line: 211, Col: 18): Unrecognized named-value: 'env'. Located at position 1 within expression: env.ANSYS_STK, (Line: 212, Col: 28): Unrecognized named-value: 'env'. Located at position 1 within expression: env.MAIN_PYTHON_VERSION, (Line: 213, Col: 22): Unrecognized named-value: 'env'. Located at position 1 within expression: env.STK_CONTAINER, (Line: 214, Col: 25): Unrecognized named-value: 'env'. Located at position 1 within expression: env.STK_DOCKER_IMAGE, (Line: 215, Col: 25): Unrecognized named-value: 'env'. Located at position 1 within expression: env.STK_PYTHON_IMAGE
on:
push:
tags:
- "v*.*.*"
env:
MINIMUM_PYTHON_VERSION: '3.10'
MAIN_PYTHON_VERSION: '3.13'
ANSYS_STK: 'ansys-stk'
DOCUMENTATION_CNAME: 'stk.docs.pyansys.com'
STK_DOCKER_IMAGE: 'ansys/stk-12.10:dev-ubuntu22.04'
PYSTK_DIR: '/home/stk/pystk'
LICENSE_SERVER_PORT: '1055'
QUARTO_VERSION: '1.5.55'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-changelog:
name: "Update changelog"
if: contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
code-style:
name: "Code style checks"
runs-on: ubuntu-latest
steps:
- name: "Run code style checks"
uses: ansys/actions/code-style@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: "Doc style checks"
runs-on: ubuntu-latest
if: |
!contains(github.event.pull_request.labels.*.name, 'ci:skip') &&
!contains(github.event.pull_request.labels.*.name, 'style:skip')
steps:
- name: "Checkout project"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Install jq"
run: |
# Used to format Vale input as a JSON-formatted list of files
sudo apt install -y jq
- name: "Collect desired files"
run: |
# Find all .rst files excluding those in doc/source/api/
RST_FILES=$(find doc/source -type f -name "*.rst" ! -path "doc/source/api/*")
# Find all .py files inside the examples/ directory, excluding those with an underscore
PY_FILES=$(find examples -type f -name "*.py" ! -name "*_*")
# Combine both file lists and convert them to a JSON array
# TODO: include Python files too. See Vale issue
# https://github.com/errata-ai/vale/issues/858
# VALE_FILES=$(echo -e "$RST_FILES\n$PY_FILES" | jq -R . | jq -s .)
VALE_FILES=$(echo -e "$RST_FILES" | jq -R . | jq -s .)
echo "VALE_FILES=$(echo $VALE_FILES)" >> $GITHUB_ENV
- uses: ansys/actions/doc-style@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
with:
checkout: false
files: "${{ env.VALE_FILES }}"
vale-config: doc/.vale.ini
token: ${{ secrets.GITHUB_TOKEN }}
fail-level: "warning"
build-wheelhouse:
name: "Wheelhouse ansys-stk[${{ matrix.target }}] / ${{ matrix.os }} / ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
needs: [code-style, doc-style]
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@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
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]
needs: build-wheelhouse
timeout-minutes: 90
env:
MAIN_PYTHON_VERSION: ${{ env.MAIN_PYTHON_VERSION }}
STK_CONTAINER: ${{ env.STK_CONTAINER }}
STK_DOCKER_IMAGE: ${{ env.STK_DOCKER_IMAGE }}
STK_PYTHON_IMAGE: ${{ env.STK_PYTHON_IMAGE }}
QUARTO_VERSION: ${{ env.QUARTO_VERSION }}
steps:
- name: "Checkout the project"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- 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"
run: |
python_image_name="${STK_DOCKER_IMAGE}-python${MAIN_PYTHON_VERSION}"
container_name="stk-python${MAIN_PYTHON_VERSION}"
echo "STK_PYTHON_IMAGE=${python_image_name}" >> ${GITHUB_ENV}
echo "STK_CONTAINER=${container_name}" >> ${GITHUB_ENV}
- name: "Start the container from the desired image"
run: |
docker run \
--detach -it \
--network="host" \
--name "${STK_CONTAINER}" \
--env ANSYSLMD_LICENSE_FILE="${LICENSE_SERVER_PORT}@${{ secrets.LICENSE_SERVER }}" \
--volume ${PWD}:/home/stk/pystk \
"${STK_PYTHON_IMAGE}"
- name: "Install system dependencies required for building examples"
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 ${{ env.PYSTK_DIR }} \
"${STK_CONTAINER}" /bin/bash -c \
"quarto install tinytex"
- name: "Install Tox"
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"
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 HTML documentation artifacts"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
path: doc/_build/html
name: documentation-html
- name: "Stop the container"
if: always()
run: |
docker stop "${STK_CONTAINER}"
docker logs "${STK_CONTAINER}"
docker rm "${STK_CONTAINER}"
tests:
name: "Tests Python ${{ matrix.python }}"
runs-on: [self-hosted, pystk]
needs: code-style
strategy:
matrix:
# Can not use ${{ env.MINIMUM_PYTHON_VERSION }} because GitHub actions
# does not support ENV variable substitution in matrix definition
python: ['3.10', '3.11', '3.12', '3.13']
fail-fast: false
env:
ANSYS_STK: ${{ env.ANSYS_STK }}
MAIN_PYTHON_VERSION: ${{ env.MAIN_PYTHON_VERSION }}
STK_CONTAINER: ${{ env.STK_CONTAINER }}
STK_DOCKER_IMAGE: ${{ env.STK_DOCKER_IMAGE }}
STK_PYTHON_IMAGE: ${{ env.STK_PYTHON_IMAGE }}
PYSTK_DIR: ${{ env.PYSTK_DIR }}
steps:
- name: "Checkout the project"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Generate the name of the docker image and the container"
run: |
python_image_name="${STK_DOCKER_IMAGE}-python${{ matrix.python }}"
container_name="stk-python${{ matrix.python }}"
echo "STK_PYTHON_IMAGE=${python_image_name}" >> $GITHUB_ENV
echo "STK_CONTAINER=${container_name}" >> $GITHUB_ENV
- name: "Start the container from the desired image"
run: |
docker run \
--detach -it \
--network="host" \
--name "${STK_CONTAINER}" \
--env ANSYSLMD_LICENSE_FILE="${LICENSE_SERVER_PORT}@${{ secrets.LICENSE_SERVER }}" \
--volume ${PWD}:/home/stk/pystk \
"${STK_PYTHON_IMAGE}"
- name: "Install the project with the testing dependencies"
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"
run: |
docker exec \
--workdir "${PYSTK_DIR}" \
"${STK_CONTAINER}" /bin/bash -c \
"python -m pip install --group tests ."
# -- Tests
- name: "Run the extensions tests"
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"
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"
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"
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"
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"
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"
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 }}
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 }}
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 ${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@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
with:
files: .cov/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: "Stop the container"
if: always()
run: |
docker stop "${STK_CONTAINER}"
docker logs "${STK_CONTAINER}"
docker rm "${STK_CONTAINER}"
build-library:
name: "Build library"
runs-on: ubuntu-latest
needs: [doc-build, tests]
permissions:
attestations: write
contents: read
id-token: write
steps:
- uses: ansys/actions/build-library@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
with:
library-name: ${{ env.ANSYS_STK }}
attest-provenance: true
release-pypi:
name: "Release project to the public PyPI"
needs: build-library
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
steps:
- name: "Download the library artifacts from build-library step"
uses: actions/download-artifact@de96f4613b77ec03b5cf633e7c350c32bd3c5660 # v4.3.0
with:
name: ${{ env.ANSYS_STK }}-artifacts
path: ${{ env.ANSYS_STK }}-artifacts
- name: "Upload artifacts to PyPI using trusted publisher"
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: "https://upload.pypi.org/legacy/"
print-hash: true
packages-dir: ${{ env.ANSYS_STK }}-artifacts
skip-existing: false
release-github:
name: "Release to GitHub"
needs: release-pypi
runs-on: ubuntu-latest
environment: release
permissions:
attestations: write
contents: write
id-token: write
steps:
- uses: ansys/actions/release-github@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
with:
library-name: ${{ env.ANSYS_STK }}
token: ${{ secrets.GITHUB_TOKEN }}
changelog-release-notes: true
only-code: true
add-artifact-attestation-notes: true
generate_release_notes: false
doc-deploy-stable:
name: Deploy stable documentation
runs-on: ubuntu-latest
needs: release-github
steps:
- uses: ansys/actions/doc-deploy-stable@d93d46bd89025d3c78a0d18a68a9f16434c74382 # v10.0.15
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}