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.
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 |
False |
boolean |
1 |
validate-build |
Whether to validate the build process. If |
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@v8.1
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.
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 |
False |
boolean |
True |
check-licenses |
Whether to check the library’s dependencies license or not. If |
False |
boolean |
True |
whitelist-license-check |
Optional list of packages to ignore during the license check. Separated by a comma.
Only used when |
False |
string |
|
checkout |
Whether to do a checkout step or not. If |
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@v8.1
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.
Input |
Description |
Required |
Type |
Default |
---|---|---|---|---|
python-version |
Python version used for building the wheels. |
True |
string |
|
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 |
|
cibw-build |
Desired build wheel CPython version. |
False |
string |
cp310-* |
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 |
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@v8.1