From eea0b2918f3b3d73d79cf3914d111f472586f169 Mon Sep 17 00:00:00 2001 From: Gediminas Kirsanskas Date: Sun, 5 May 2024 00:00:33 +0200 Subject: [PATCH] Test for MacOS build. --- .github/workflows/build_wheels.yml | 25 ++++++++++++++----------- .github/workflows/full_test.yml | 9 ++++----- pyproject.toml | 15 ++++++++++++--- scripts/cibw_before_all_macos.sh | 17 ++++++++++++++++- 4 files changed, 46 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index cc82f88..4bb5305 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -11,23 +11,26 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2019, macos-10.15] + os: [ubuntu-22.04, windows-2022, macos-12, macos-14] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + # Used to host cibuildwheel + - uses: actions/setup-python@v5 + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.17.0 - name: Build wheels - uses: pypa/cibuildwheel@v1.11.1.post1 + run: python -m cibuildwheel --output-dir wheelhouse # to supply options, put them in 'env', like: - env: - CIBW_BEFORE_ALL_MACOS: bash scripts/cibw_before_all_macos.sh - CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* - CIBW_SKIP: "*-win32 *-manylinux_i686 *aarch64 *ppc64le *s390x *universal2 *arm64" - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest --pyargs qmeq - - - uses: actions/upload-artifact@v2 + # env: + # CIBW_SOME_OPTION: value + + - uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl - name: Upload binaries to release diff --git a/.github/workflows/full_test.yml b/.github/workflows/full_test.yml index 2a98cc3..82fbe70 100644 --- a/.github/workflows/full_test.yml +++ b/.github/workflows/full_test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, windows-2022, macos-11] + os: [ubuntu-22.04, windows-2022, macos-12, macos-14] steps: - uses: actions/checkout@v4 @@ -26,11 +26,10 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse # to supply options, put them in 'env', like: - env: - CIBW_BEFORE_ALL_MACOS: bash scripts/cibw_before_all_macos.sh - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest --pyargs qmeq + # env: + # CIBW_SOME_OPTION: value - uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl diff --git a/pyproject.toml b/pyproject.toml index 7a48339..57f9430 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,11 @@ classifiers = [ [project.urls] Homepage = "http://github.com/gedaskir/qmeq" +[tool.cibuildwheel.macos] +before-all = "bash scripts/cibw_before_all_macos.sh" + [tool.cibuildwheel] +# List of Python versions to build build = [ "cp38-*", "cp39-*", @@ -50,12 +54,17 @@ build = [ "cp311-*", "cp312-*" ] +# List of builds to skip skip = [ "*-win32", - "*-manylinux_i686", + "*-win_arm64", + "*musllinux*", + "*i686", "*aarch64", "*ppc64le", "*s390x", - "*universal2", - "*arm64" + "*universal2" ] +# Run the package tests using `pytest` +test-requires = "pytest" +test-command = "pytest --pyargs qmeq" diff --git a/scripts/cibw_before_all_macos.sh b/scripts/cibw_before_all_macos.sh index 83e560f..161e984 100644 --- a/scripts/cibw_before_all_macos.sh +++ b/scripts/cibw_before_all_macos.sh @@ -1,6 +1,21 @@ #!/bin/bash set -e -x -ln -sf /usr/local/bin/gcc-10 /usr/local/bin/gcc +GCC_VERSION=gcc-12 +echo "Check the locations compilers" +whereis gcc +whereis clang +whereis $GCC_VERSION + +echo "Determine the location of $GCC_VERSION" +GCC12_PATH=$(type -P $GCC_VERSION) +echo $GCC12_PATH + +echo "Link gcc command to particular $GCC_VERSION" +ln -sf $GCC12_PATH /usr/local/bin/gcc gcc --version + +echo "Link clang command to particular $GCC_VERSION" +ln -sf $GCC12_PATH /usr/local/bin/clang +clang --version