Skip to content

Commit

Permalink
Add new GH Actions workflow to build the wheels
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Morin <[email protected]>
  • Loading branch information
JeanChristopheMorinPerso committed Jun 3, 2023
1 parent 37d9190 commit b9d3acf
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- '**.md'
workflow_dispatch:

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:

build:
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: python

on:
push:
pull_request:

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
wheels:
name: Generate wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['37', '38', '39', '310', '311']
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: dist
env:
CIBW_BUILD: 'cp${{ matrix.python-version }}-*'
CIBW_SKIP: '*musllinux*'
CIBW_ARCHS: 'auto64'
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# CIBW_BUILD_FRONTEND: build # https:/pypa/build
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=2

- name: Store wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl

sdist:
name: Generate sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install build command
run: python -m pip install build

- name: Create sdist
run: python -m build -s . --outdir dist

- name: Store sdist
uses: actions/upload-artifact@v3
with:
name: sdist
path: ./dist/*.tar.gz

test:
name: Test wheels
needs: ['wheels']
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: dist

- name: Install wheel
run: python -m pip install dist/*.whl

- name: Python tests
run: |
python python/MaterialXTest/main.py
python python/MaterialXTest/genshader.py
python python/Scripts/mxupdate.py resources/Materials/TestSuite/stdlib/upgrade --yes
python python/Scripts/mxvalidate.py resources/Materials/Examples/StandardSurface/standard_surface_marble_solid.mtlx --stdlib --verbose
python python/Scripts/mxdoc.py --docType md libraries/pbrlib/pbrlib_defs.mtlx
python python/Scripts/mxdoc.py --docType html libraries/bxdf/standard_surface.mtlx
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target glsl
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target osl
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target mdl
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target msl
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cmake.build-type = "Release"
# Uncoment when developing locally to enable inplace builds.
# build-dir = "build/"

logging.level = "INFO"
logging.level = "DEBUG"

# Since the python package doesn't live in a standard directory
# in the source (i.e ./src or ./), we need to manually specify
Expand All @@ -73,6 +73,7 @@ MATERIALX_BUILD_SHARED_LIBS = 'OFF' # Be explicit
MATERIALX_BUILD_PYTHON = 'ON'
MATERIALX_TEST_RENDER = 'OFF'
MATERIALX_WARNINGS_AS_ERRORS = 'ON'
MATERIALX_BUILD_RENDER = 'OFF'

# TODO: How could we harmonize this variable with SKBUILD?
MATERIALX_INSTALL_PYTHON = 'OFF'

0 comments on commit b9d3acf

Please sign in to comment.