Skip to content

Commit

Permalink
Try tmate if tests fail
Browse files Browse the repository at this point in the history
  • Loading branch information
jminor committed Jun 17, 2024
1 parent ea64553 commit e3d9273
Showing 1 changed file with 127 additions and 123 deletions.
250 changes: 127 additions & 123 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ env:

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -28,14 +28,14 @@ jobs:
# Unfortunately the CMake test target is OS dependent so we set it as
# a variable here.
include:
- os: ubuntu-22.04
OTIO_TEST_TARGET: test
- os: windows-2022
OTIO_TEST_TARGET: RUN_TESTS
- os: macos-12
OTIO_TEST_TARGET: test
- os: macos-14
OTIO_TEST_TARGET: test
- os: ubuntu-22.04
OTIO_TEST_TARGET: test
- os: windows-2022
OTIO_TEST_TARGET: RUN_TESTS
- os: macos-12
OTIO_TEST_TARGET: test
- os: macos-14
OTIO_TEST_TARGET: test

env:
OTIO_BUILD_CONFIG: Release
Expand All @@ -44,139 +44,143 @@ jobs:
OTIO_CONSUMER_TEST_BUILD_DIR: ${{ github.workspace }}/consumertest

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install coverage dependency
if: matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT
run: |
sudo apt-get install lcov
- name: Build
run: |
cmake -E make_directory ${{ env.OTIO_BUILD_DIR }}
cd ${{ env.OTIO_BUILD_DIR }}
cmake ${{ github.workspace }} -DCMAKE_INSTALL_PREFIX=${{ env.OTIO_INSTALL_DIR }} -DOTIO_SHARED_LIBS=OFF -DOTIO_CXX_COVERAGE=ON
cmake --build . --config ${{ env.OTIO_BUILD_CONFIG }}
- name: Run tests
run: |
cd ${{ env.OTIO_BUILD_DIR }}
cmake --build . --target ${{ matrix.OTIO_TEST_TARGET }} --config ${{ env.OTIO_BUILD_CONFIG }}
- name: Collect code coverage
if: matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT
run: |
cd ${{ env.OTIO_BUILD_DIR }}
lcov --capture -b . --directory . --output-file=coverage.info -q
cat coverage.info | sed "s/SF:.*src/SF:src/g" > coverage.filtered.info
lcov --remove coverage.filtered.info '*/usr/*' --output-file=coverage.filtered.info -q
lcov --remove coverage.filtered.info '*/deps/*' --output-file=coverage.filtered.info -q
lcov --remove coverage.filtered.info '*/tests/*' --output-file=coverage.filtered.info -q
lcov --list coverage.filtered.info
# \todo Should the Codecov web pages show the results of the C++ or Python tests?
# - name: Upload coverage to Codecov
# if: matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT
# uses: codecov/[email protected]
# with:
# files: ${{ env.OTIO_BUILD_DIR }}/coverage.filtered.info
# flags: unittests
# name: opentimelineio-codecov
# fail_ci_if_error: true
- name: Install
run: |
cd ${{ env.OTIO_BUILD_DIR }}
cmake --build . --target install --config ${{ env.OTIO_BUILD_CONFIG }}
- name: Consumer tests
run: |
cmake -E make_directory ${{ env.OTIO_CONSUMER_TEST_BUILD_DIR }}
cd ${{ env.OTIO_CONSUMER_TEST_BUILD_DIR }}
cmake ${{ github.workspace }}/tests/consumer -DCMAKE_PREFIX_PATH=${{ env.OTIO_INSTALL_DIR }}
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Install coverage dependency
if: matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT
run: |
sudo apt-get install lcov
- name: Build
run: |
cmake -E make_directory ${{ env.OTIO_BUILD_DIR }}
cd ${{ env.OTIO_BUILD_DIR }}
cmake ${{ github.workspace }} -DCMAKE_INSTALL_PREFIX=${{ env.OTIO_INSTALL_DIR }} -DOTIO_SHARED_LIBS=OFF -DOTIO_CXX_COVERAGE=ON
cmake --build . --config ${{ env.OTIO_BUILD_CONFIG }}
- name: Run tests
run: |
cd ${{ env.OTIO_BUILD_DIR }}
cmake --build . --target ${{ matrix.OTIO_TEST_TARGET }} --config ${{ env.OTIO_BUILD_CONFIG }}
- name: Collect code coverage
if: matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT
run: |
cd ${{ env.OTIO_BUILD_DIR }}
lcov --capture -b . --directory . --output-file=coverage.info -q
cat coverage.info | sed "s/SF:.*src/SF:src/g" > coverage.filtered.info
lcov --remove coverage.filtered.info '*/usr/*' --output-file=coverage.filtered.info -q
lcov --remove coverage.filtered.info '*/deps/*' --output-file=coverage.filtered.info -q
lcov --remove coverage.filtered.info '*/tests/*' --output-file=coverage.filtered.info -q
lcov --list coverage.filtered.info
# \todo Should the Codecov web pages show the results of the C++ or Python tests?
# - name: Upload coverage to Codecov
# if: matrix.os == env.GH_COV_OS && github.actor != env.GH_DEPENDABOT
# uses: codecov/[email protected]
# with:
# files: ${{ env.OTIO_BUILD_DIR }}/coverage.filtered.info
# flags: unittests
# name: opentimelineio-codecov
# fail_ci_if_error: true
- name: Install
run: |
cd ${{ env.OTIO_BUILD_DIR }}
cmake --build . --target install --config ${{ env.OTIO_BUILD_CONFIG }}
- name: Consumer tests
run: |
cmake -E make_directory ${{ env.OTIO_CONSUMER_TEST_BUILD_DIR }}
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 }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- { os: ubuntu-22.04, shell: bash }
- { os: macos-12, shell: bash }
- { os: macos-14, shell: bash }
- { os: windows-2022, shell: pwsh }
- { os: windows-2022, shell: msys2, python-version: 'mingw64' }
- { os: windows-2022, shell: msys2, python-version: "mingw64" }
exclude:
- { os: macos-14, python-version: 3.7 }
- { os: macos-14, python-version: 3.8 }
- { os: macos-14, python-version: 3.9 }

defaults:
run:
shell: '${{ matrix.shell }} {0}'
shell: "${{ matrix.shell }} {0}"

env:
OTIO_CXX_COVERAGE_BUILD: ON
OTIO_CXX_BUILD_TMP_DIR: ${{ github.workspace }}/build

steps:
- uses: actions/checkout@v3
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/[email protected]
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
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
- name: Run check-manifest and lint check
run: make ci-prebuild
- name: Build and Install
run: |
# compile and install into virtualenv/virtual machine (verbosely)
pip install .[dev] -v
- name: Run tests w/ python coverage
run: make ci-postbuild
# (only on ubuntu/pyhton3.7)
- name: Generate C++ coverage report
if: matrix.python-version == env.GH_COV_PY && matrix.os == env.GH_COV_OS && 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
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 }}
- uses: actions/checkout@v3
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/[email protected]
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
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
- name: Run check-manifest and lint check
run: make ci-prebuild
- name: Build and Install
run: |
# compile and install into virtualenv/virtual machine (verbosely)
pip install .[dev] -v
- name: Run tests w/ python coverage
run: make ci-postbuild
# if tests failed, then run tmate for remote debugging
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
# (only on ubuntu/python3.7)
- name: Generate C++ coverage report
if: matrix.python-version == env.GH_COV_PY && matrix.os == env.GH_COV_OS && 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
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 }}

package_wheels:
needs: py_build_test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
python-build: ['cp37*', 'cp38*', 'cp39*', 'cp310*', 'cp311*', 'cp312*']
python-build: ["cp37*", "cp38*", "cp39*", "cp310*", "cp311*", "cp312*"]
exclude:
- { os: macos-14, python-build: 'cp37*' }
- { os: macos-14, python-build: "cp37*" }
steps:
- uses: actions/checkout@v3

Expand All @@ -186,7 +190,7 @@ jobs:
output-dir: wheelhouse
env:
CIBW_BUILD: ${{ matrix.python-build }}
CIBW_SKIP: '*musllinux*'
CIBW_SKIP: "*musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014

Expand All @@ -199,19 +203,19 @@ jobs:
needs: py_build_test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/checkout@v3
with:
submodules: "recursive"

- uses: actions/[email protected]
- uses: actions/[email protected]

- name: Install pypa/build
run: python -m pip install build --user
- name: Install pypa/build
run: python -m pip install build --user

- name: Generate sdist
run: python -m build -s .
- name: Generate sdist
run: python -m build -s .

- uses: actions/upload-artifact@v3
with:
name: sdist
path: dist
- uses: actions/upload-artifact@v3
with:
name: sdist
path: dist

0 comments on commit e3d9273

Please sign in to comment.