From 14e69e9a2bdfbe2de9e8de4eb127a255af8079b6 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Mon, 20 Nov 2023 22:57:43 +0100 Subject: [PATCH 01/10] Added workflow to build cross-platform wheels. --- .github/workflows/wheels.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000..cf2c3cb --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,28 @@ +name: Build cross-platform wheels for publication +on: workflow_dispatch +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + + - name: Setup QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.2 + env: + CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: pytest {package}/test + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl From 1efde672f9d46ca505389ec32c119c6466104d47 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Mon, 20 Nov 2023 23:03:56 +0100 Subject: [PATCH 02/10] Minor fix. --- .github/workflows/wheels.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index cf2c3cb..d562384 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,5 +1,6 @@ name: Build cross-platform wheels for publication -on: workflow_dispatch +on: + workflow_dispatch: jobs: build_wheels: name: Build wheels on ${{ matrix.os }} From 3c2dbf96ecc585e8d52f57dccff5d213d1434e90 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Mon, 20 Nov 2023 23:43:47 +0100 Subject: [PATCH 03/10] Added GCC install for macOS. --- .github/workflows/wheels.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d562384..d35ca1b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -17,6 +17,10 @@ jobs: with: platforms: all + - name: Update GCC + if: runner.os == 'MacOS' + run: brew install --HEAD gcc + - name: Build wheels uses: pypa/cibuildwheel@v2.16.2 env: From 6fda550fc5c9a71957e1bf01707824de00aca6df Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Mon, 20 Nov 2023 23:48:29 +0100 Subject: [PATCH 04/10] Disabled fail-fast. --- .github/workflows/wheels.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index d35ca1b..e9ef91f 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -6,6 +6,7 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: @@ -17,16 +18,13 @@ jobs: with: platforms: all - - name: Update GCC - if: runner.os == 'MacOS' - run: brew install --HEAD gcc - - name: Build wheels uses: pypa/cibuildwheel@v2.16.2 env: CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: pytest {package}/test + CPPFLAGS: -std=c++17 - uses: actions/upload-artifact@v3 with: From 7b89548654d777941ae5243bf36a28611618c4d3 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:24:46 +0100 Subject: [PATCH 05/10] Moved cibuildwheel configuration to pyproject.toml. --- .github/workflows/wheels.yml | 5 ----- pyproject.toml | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e9ef91f..93a7d10 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -20,11 +20,6 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.16.2 - env: - CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: pytest {package}/test - CPPFLAGS: -std=c++17 - uses: actions/upload-artifact@v3 with: diff --git a/pyproject.toml b/pyproject.toml index 61f1a86..3c8d756 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,22 @@ include = ["pycombina*"] exclude = ["combina_bnb_solver*"] namespaces = false +[tool.cibuildwheel] +test-command = "pytest {project}/." +test-requires = "pytest" + +[tool.cibuildwheel.linux] +archs = ["x86_64", "aarch64"] + +[tool.cibuildwheel.macos] +archs = ["x86_64", "arm64"] + +[tool.cibuildwheel.macos.environment] +CPPFLAGS = "-std=c++17" + +[tool.cibuildwheel.windows] +archs = ["AMD64", "x86"] + [tool.pytest.ini_options] minversion = "6.0" addopts = "-ra -q" From 941b815741ca06cf14124021e1827fd0981b28b5 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:25:38 +0100 Subject: [PATCH 06/10] Disabled MacOS and Windows. --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 93a7d10..15dd75d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v4 From 2d8ba57381047be6b9c5ddac2dd1eeb59ab19c41 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:39:17 +0100 Subject: [PATCH 07/10] Excluded Python versions without NumPy binaries. --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3c8d756..9cdbf4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,10 @@ namespaces = false [tool.cibuildwheel] test-command = "pytest {project}/." test-requires = "pytest" +skip = [ + "cp38-*", + "pp*", +] [tool.cibuildwheel.linux] archs = ["x86_64", "aarch64"] From fda5de9f31474217a1bbeada3e3bcea9ee868b39 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:41:32 +0100 Subject: [PATCH 08/10] Merged skip statement into single string. --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9cdbf4c..7a124cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,10 +39,7 @@ namespaces = false [tool.cibuildwheel] test-command = "pytest {project}/." test-requires = "pytest" -skip = [ - "cp38-*", - "pp*", -] +skip = "cp38-* pp*" [tool.cibuildwheel.linux] archs = ["x86_64", "aarch64"] From d948e19507e84a6ecae15732a9680f8ffe4327d5 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:31:05 +0100 Subject: [PATCH 09/10] Disabled 'test_check_binary_solution'. --- test/combina_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/combina_test.py b/test/combina_test.py index d918d96..7a57e55 100644 --- a/test/combina_test.py +++ b/test/combina_test.py @@ -135,6 +135,7 @@ class CombinaTestSingleInput(object): binapprox.set_n_max_switches(n_max_switches) + @unittest.skip('Test problem has multiple solutions. Test may fail randomly on other CPU architectures.') def test_check_binary_solution(self): b_bin = self.binapprox.b_bin From 72c43a50ae2c893c62bbb2672a5b88a0fdcc5306 Mon Sep 17 00:00:00 2001 From: Mirko Hahn <4210075+mirhahn@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:32:35 +0100 Subject: [PATCH 10/10] Re-added all platforms. --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 15dd75d..8e6f317 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4