Build actions#

The build actions allow for building artifacts for a Python library. These artifacts include both source distribution files and wheels.

Build library action#

Verifies if a Python library builds properly. As a result of a successful building process, wheel and source distribution artifacts are generated. This action is expected to be used as an independent job.

Note

Use this action instead of the build-ci-wheels if your library is a pure Python project with no source code to be compiled.

Source code for this action

Input

Description

Required

Type

Default

library-name

Name of the Python library. This is the name used when uploading the wheel and source distribution as artifacts. The name should be the same one used in the PyPI index.

True

string

python-version

Python version used for installing and execution of the build process.

False

string

3.1

use-python-cache

Whether to use the Python cache for installing previously downloaded libraries. If true, previously downloaded libraries are installed from the Python cache. If false, libraries are downloaded from the PyPI index.

False

boolean

1

validate-build

Whether to validate the build process. If true, the build process is validated. If false, the build process is not validated.

False

boolean

1

Examples#

Build library basic example
build-library:
  name: "Build library basic example"
  runs-on: ubuntu-latest
  steps:
    - name: "Build library source and wheel artifacts"
      uses: ansys/actions/build-library@v6.0
      with:
        library-name: "ansys-<product>-<library>"

Build wheelhouse action#

Generates compressed artifacts for the wheelhouse of a Python library. The wheelhouse contains all the necessary dependencies to install the project. This allows for local installations and avoids the need to connect to the online PyPI index.

Warning

Since version 4.1, the input parameter library-namespace is no longer required.

Source code for this action

Input

Description

Required

Type

Default

library-name

Name of the Python library. This is the name used when uploading the wheel and source distribution as artifacts. The name should be the same one used in the PyPI index.

True

string

operating-system

Name of the operating system where the library is installed.

True

string

python-version

Python version used for installing and execution of the build wheel process.

True

string

target

Optional target used during the building process.

False

string

use-python-cache

Whether to use the Python cache for installing previously downloaded libraries. If true, previously downloaded libraries are installed from the Python cache. If false, libraries are downloaded from the PyPI index.

False

boolean

True

check-licenses

Whether to check the library’s dependencies license or not. If true. the licenses are checked. If false, no license check is performed. By default it is set to true.

False

boolean

True

Examples#

Build wheelhouse for latest Python versions
build-wheelhouse:
  name: "Build wheelhouse for latest Python versions"
  runs-on: ${{ matrix.os }}
  strategy:
     matrix:
         os: [ubuntu-latest, windows-latest]
         python-version: ['3.7', '3.8', '3.9', '3.10']
  steps:
    - name: "Build a wheelhouse of the Python library"
      uses: ansys/actions/build-wheelhouse@v6.0
      with:
        library-name: "<ansys-product-library>"
        operating-system: ${{ matrix.os }}
        python-version: ${{ matrix.python-version }}

Build CI wheels action#

Build wheels for a Python library containing compiled source code. This action is expected to be used within a matrix job. Its goal is to generate wheel files for every combination of operating system, build system, and Python version. The action uses the cibuildwheel behind the scenes.

Note

This actions should only be used by libraries including source code that needs to be compiled.

Source code for this action

Input

Description

Required

Type

Default

python-version

Python version used for building the wheels.

True

string

cibw-build

Desired build wheel CPython version.

False

string

cp310-*

cibw-skip

Desired conditions to skip when building the wheels.

False

string

-musllinux

cibw-archs

Desired build architecture.

False

string

auto

requires-pypy

Whether to generate wheels for wheel files for PyPy in addition to the wheel files for CPython. Default value is false.

False

boolean

False

Examples#

Build a C-extension library
build-c-extension:
  name: "Build a C-extension library"
  runs-on: ${{ matrix.os }}
  strategy:
     matrix:
         os: [ubuntu-latest, windows-latest, macos-11]
  steps:
    - name: "Build a C-extension library wheel artifacts"
      uses: ansys/actions/build-ci-library@v6.0