diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 63fdc5a..ff148e4 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -7,15 +7,48 @@ on: branches: [ "main" ] jobs: - build_all: + build_windows: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} env: + CC: clang-cl + CXX: clang-cl + LDFLAGS: "-Wl,-S" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] + os: ["windows-latest"] + python-version: ["3.9", "3.10", "3.11"] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pytest pytest-cov coverage-badge coveralls pytest-benchmark + pip install --verbose . + - name: Test with pytest + run: | + python -m pytest tests/ --cov=simplextree --benchmark-skip + coverage run --source=./simplextree -m pytest tests/ --benchmark-skip + coverage json -o tests/test_results.json + coverage report -m + build_unix: + name: ${{ matrix.os }} - Python ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest"] python-version: ["3.9", "3.10", "3.11"] steps: - name: Checkout @@ -57,134 +90,4 @@ jobs: namedLogo: Pytest # - name: Send coverage report # run: | - # coveralls --service=github - - build_windows_wheels: - name: Build ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest] - cibw_arch: ["AMD64"] - cibw_python: ["cp39-*", "cp310-*", "cp311-*"] - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/setup-python@v4 - name: Install Python - with: - python-version: "3.9" - - - name: Install cibuildwheel and add clang-cl to path - run: | - python -m pip install cibuildwheel - - - name: Build AMD64 Windows wheels for CPython - if: matrix.cibw_arch == 'AMD64' - # To avoid "LINK : fatal error LNK1158: cannot run 'rc.exe'" - # we explicitly add rc.exe to path using the method from: - # https://github.com/actions/virtual-environments/issues/294#issuecomment-588090582 - # with additional -arch=x86 flag to vsdevcmd.bat - run: | - function Invoke-VSDevEnvironment { - $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" - $installationPath = & $vswhere -prerelease -legacy -latest -property installationPath - $Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat" - & "${env:COMSPEC}" /s /c "`"$Command`" -arch=amd64 -no_logo && set" | Foreach-Object { - if ($_ -match '^([^=]+)=(.*)') { - [System.Environment]::SetEnvironmentVariable($matches[1], $matches[2]) - } - } - } - Invoke-VSDevEnvironment - Get-Command rc.exe | Format-Table -AutoSize - python -m cibuildwheel --output-dir dist - env: - # define CC, CXX so meson will use clang-cl instead of MSVC - CC: clang-cl - CXX: clang-cl - CIBW_BUILD: ${{ matrix.cibw_python }} - CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_arch }} - # -Wl,-S equivalent to gcc's -Wl,--strip-debug - LDFLAGS: "-Wl,-S" - - build_macos_wheels: - name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest] - cibw_python: ["cp39-*", "cp310-*", "cp311-*"] - cibw_arch: ["x86_64", "arm64"] # TODO: add "universal2" once a universal2 libomp is available - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/setup-python@v4 - name: Install Python - with: - python-version: "3.9" - - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel - - - name: Build wheels for CPython Mac OS - run: | - # Make sure to use a libomp version binary compatible with the oldest - # supported version of the macos SDK as libomp will be vendored into - # the scikit-image wheels for macos. The list of binaries are in - # https://packages.macports.org/libomp/. Currently, the oldest - # supported macos version is: High Sierra / 10.13. When upgrading - # this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment - # variable accordingly. Note that Darwin_17 == High Sierra / 10.13. - # - # We need to set both MACOS_DEPLOYMENT_TARGET and MACOSX_DEPLOYMENT_TARGET - # until there is a new release with this commit: - # https://github.com/mesonbuild/meson-python/pull/309 - if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then - # SciPy requires 12.0 on arm to prevent kernel panics - # https://github.com/scipy/scipy/issues/14688 - # so being conservative, we just do the same here - export MACOSX_DEPLOYMENT_TARGET=12.0 - export MACOS_DEPLOYMENT_TARGET=12.0 - OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-arm64/llvm-openmp-11.1.0-hf3c4609_1.tar.bz2" - else - export MACOSX_DEPLOYMENT_TARGET=10.9 - export MACOS_DEPLOYMENT_TARGET=10.9 - OPENMP_URL="https://anaconda.org/conda-forge/llvm-openmp/11.1.0/download/osx-64/llvm-openmp-11.1.0-hda6cdc1_1.tar.bz2" - fi - echo MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} - echo MACOS_DEPLOYMENT_TARGET=${MACOS_DEPLOYMENT_TARGET} - - # use conda to install llvm-openmp - # Note that we do NOT activate the conda environment, we just add the - # library install path to CFLAGS/CXXFLAGS/LDFLAGS below. - sudo conda create -n build $OPENMP_URL - PREFIX="/usr/local/miniconda/envs/build" - export CC=/usr/bin/clang - export CXX=/usr/bin/clang++ - export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp" - export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include" - export CXXFLAGS="$CXXFLAGS -I$PREFIX/include" - export LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp" - - python -m cibuildwheel --output-dir dist - env: - CIBW_BUILD: ${{ matrix.cibw_python }} - CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }} - CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 - CIBW_MANYLINUX_I686_IMAGE: manylinux1 - CIBW_TEST_SKIP: "*-macosx_arm64" - - - uses: actions/upload-artifact@v3 - with: - name: wheels - path: ./dist/*.whl \ No newline at end of file + # coveralls --service=github \ No newline at end of file diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 827def7..2242b06 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -64,7 +64,7 @@ jobs: LDFLAGS: "-Wl,-S" build_macos_wheels: - name: Build python ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }} + name: Build ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}