diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a4843353c..a1178d956 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -5,7 +5,7 @@ name: OpenTimelineIO # for configuring which build will be a C++ coverage build / coverage report env: - GH_COV_PY: "3.10" + GH_COV_PY: "3.13" GH_COV_OS: ubuntu-latest GH_DEPENDABOT: dependabot @@ -88,86 +88,120 @@ jobs: cd ${{ env.OTIO_CONSUMER_TEST_BUILD_DIR }} cmake ${{ github.workspace }}/tests/consumer -DCMAKE_PREFIX_PATH=${{ env.OTIO_INSTALL_DIR }} - py_build_test: - runs-on: ${{ matrix.os }} + py_smoketest_build: + # Ideally this would be ${{ env.GH_COV_OS }} - but github doens't allow it + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-14, macos-latest] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - include: - - { os: ubuntu-latest, shell: bash } - - { os: macos-latest, shell: bash } - - { os: macos-14, shell: bash } - - { os: windows-latest, shell: pwsh } - - { os: windows-latest, shell: msys2, python-version: "mingw64" } - exclude: - - { os: macos-latest, python-version: 3.9 } defaults: run: - shell: "${{ matrix.shell }} {0}" + shell: "bash {0}" env: - OTIO_CXX_COVERAGE_BUILD: ON + OTIO_CXX_COVERAGE_BUILD: 'ON' OTIO_CXX_BUILD_TMP_DIR: ${{ github.workspace }}/build steps: - - uses: actions/checkout@v4 + - name: Get tests and requirements from source + uses: actions/checkout@v4 with: submodules: "recursive" - - name: Set up MSYS2 - if: matrix.python-version == 'mingw64' - uses: msys2/setup-msys2@v2 - with: - msystem: mingw64 - install: >- - mingw-w64-x86_64-python - mingw-w64-x86_64-python-pip - mingw-w64-x86_64-gcc - mingw-w64-x86_64-cmake - make - git - name: Set up Python ${{ matrix.python-version }} - if: matrix.python-version != 'mingw64' uses: actions/setup-python@v5.4.0 with: python-version: ${{ matrix.python-version }} - name: Install coverage dependency - if: matrix.python-version == env.GH_COV_PY && matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT + if: matrix.python-version == env.GH_COV_PY && github.actor != env.GH_DEPENDABOT run: | echo 'OTIO_CXX_DEBUG_BUILD=1' >> $GITHUB_ENV sudo apt-get install lcov - name: Install python build dependencies run: | python -m pip install --upgrade pip setuptools wheel "flake8>=3.5" check-manifest - # \todo Temporarily disable check-manifest on MinGW, it is failing - # intermittently with this error: - # ModuleNotFoundError: No module named 'pip._vendor.distlib' - name: Run check-manifest and lint check - if: matrix.python-version != 'mingw64' run: make ci-prebuild - - name: Build and Install + - name: Install test dependencies + run: | + python -m pip install --upgrade -r tests/requirements.txt + - name: Build and Install OpenTimelineIO run: | - pip install .[dev] -v --break-system-packages + python -m pip install . -v --break-system-packages - name: Run tests w/ python coverage run: make ci-postbuild # (only on GH_COV_OS and GH_COV_PY) - name: Generate C++ coverage report - if: matrix.python-version == env.GH_COV_PY && matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT + if: matrix.python-version == env.GH_COV_PY && github.actor != env.GH_DEPENDABOT run: make lcov - name: Upload coverage to Codecov - if: matrix.python-version == env.GH_COV_PY && matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT - uses: codecov/codecov-action@v4 + if: matrix.python-version == env.GH_COV_PY && github.actor != env.GH_DEPENDABOT + uses: codecov/codecov-action@v5 with: flags: py-unittests name: py-opentimelineio-codecov fail_ci_if_error: false - env: - # based on: https://github.com/codecov/codecov-action?tab=readme-ov-file#usage - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + + # This is for platforms where we build and test, but don't make wheels + py_testonly_build: + needs: package_sdist + # Ideally this would be ${{ env.GH_COV_OS }} - but github doens't allow it + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + python-version: ["mingw64"] + include: + - { os: windows-latest, shell: msys2, python-version: "mingw64" } + + defaults: + run: + shell: "${{ matrix.shell }} {0}" + + env: + OTIO_CXX_COVERAGE_BUILD: 'ON' + OTIO_CXX_BUILD_TMP_DIR: ${{ github.workspace }}/build + + steps: + - name: Set up MSYS2 + if: matrix.python-version == 'mingw64' + uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + install: >- + mingw-w64-x86_64-python + mingw-w64-x86_64-python-pip + mingw-w64-x86_64-gcc + mingw-w64-x86_64-cmake + make + git + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != 'mingw64' + uses: actions/setup-python@v5.4.0 + with: + python-version: ${{ matrix.python-version }} + - name: Get sdist source + uses: actions/download-artifact@v5 + with: + name: sdist + path: ./sdist + - name: Build and Install OpenTimelineIO + run: | + python -m pip install sdist/opentimelineio-*.tar.gz -v --break-system-packages + - name: Install python dev dependencies + run: | + python -m pip install --upgrade pip setuptools wheel "flake8>=3.5" check-manifest + - name: Get source + uses: actions/checkout@v4 + - name: Install test dependencies + run: | + python -m pip install --break-system-packages --upgrade -r tests/requirements.txt + - name: Run tests w/ python coverage + run: make ci-postbuild package_wheels: - needs: py_build_test runs-on: ${{ matrix.os }} strategy: matrix: @@ -182,6 +216,8 @@ jobs: python-build: ["cp39", "cp310", "cp311", "cp312", "cp313"] steps: - uses: actions/checkout@v4 + with: + submodules: "recursive" - name: Build wheels (Python 3) uses: pypa/cibuildwheel@v3.2.1 @@ -200,8 +236,50 @@ jobs: name: wheel-${{ matrix.os }}-${{ matrix.python-build }} path: ./wheelhouse/*.whl + test_wheels: + needs: package_wheels + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-14, macos-latest] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + include: + - { os: ubuntu-latest, shell: bash } + - { os: macos-latest, shell: bash } + - { os: macos-14, shell: bash } + - { os: windows-latest, shell: pwsh } + exclude: + - { os: macos-latest, python-version: 3.9 } + + defaults: + run: + shell: "${{ matrix.shell }} {0}" + + env: + OTIO_CXX_COVERAGE_BUILD: 'ON' + OTIO_CXX_BUILD_TMP_DIR: ${{ github.workspace }}/build + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != 'mingw64' + uses: actions/setup-python@v5.4.0 + with: + python-version: ${{ matrix.python-version }} + - name: Install python build dependencies + run: | + python -m pip install --upgrade pip setuptools wheel "flake8>=3.5" check-manifest && python -m pip install --upgrade -r tests/requirements.txt + - uses: actions/download-artifact@v5 + with: + pattern: wheel-${{ matrix.os }}-* + path: 'wheelhouse' + merge-multiple: true + - name: Install wheel for environment + run: pip install --no-cache-dir --no-index --find-links wheelhouse opentimelineio + - name: Run tests w/ python coverage + run: make ci-postbuild + package_sdist: - needs: py_build_test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index f1fc21b07..7137f220f 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ ccend = $(shell echo "\033[0m") # Helpful link to install development dependencies declared in setup.py define dev_deps_message $(ccred)You can install this and other development dependencies with$(newline)$(ccend)\ -$(ccblue) pip install -e .[dev]$(newline)$(ccend) +$(ccblue) pip install -e . && pip install -r tests/requirements.txt$(newline)$(ccend) endef # variables diff --git a/setup.py b/setup.py index 05f41963f..42b0668d1 100644 --- a/setup.py +++ b/setup.py @@ -371,14 +371,6 @@ def run(self): ), ], }, - extras_require={ - 'dev': [ - 'check-manifest', - 'flake8>=3.5', - 'coverage>=4.5', - 'urllib3>=1.24.3' - ], - }, # because we need to open() the adapters manifest, we aren't zip-safe zip_safe=False, diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 000000000..88a677c0b --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,4 @@ +check-manifest +flake8>=3.5 +coverage>=4.5 +urllib3>=1.24.3