From 558ea8d14db099abbfb4a6a6a166f9f5bfc4365f Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Thu, 4 Apr 2024 12:16:32 +0200 Subject: [PATCH] Update testing and build workflows with new ARM M1 runners (#270) * update workflow with new ARM M1 runners * update action versions to avoid warning about node.js --- .github/workflows/build_deploy_wheels.yml | 52 +++++++++----------- .github/workflows/test_unit_and_examples.yml | 2 +- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build_deploy_wheels.yml b/.github/workflows/build_deploy_wheels.yml index 5655eee5..39dc7c30 100644 --- a/.github/workflows/build_deploy_wheels.yml +++ b/.github/workflows/build_deploy_wheels.yml @@ -25,23 +25,23 @@ jobs: # so easier to separate out here. - [ ubuntu-latest, manylinux, x86_64] - [ ubuntu-latest, manylinux, i686] - - [ macos-latest, macosx, x86_64 ] - - [ macos-11, macosx, arm64] # cross compiled - - [ windows-2019, win, AMD64 ] + - [ macos-latest, macosx, x86_64 ] # Intel chip + - [ macos-14, macosx, arm64] # ARM M1/M2 chip + - [ windows-latest, win, AMD64] - python: [[ "cp37", "3.7" ], [ "cp38", "3.8" ], [ "cp39", "3.9" ], + python: [[ "cp38", "3.8" ], [ "cp39", "3.9" ], [ "cp310", "3.10" ], [ "cp311", "3.11" ], ["cp312", "3.12"]] name: Build wheel for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.11 - name: install-rtools needed for windows if: ${{ runner.os == 'Windows' }} @@ -50,12 +50,11 @@ jobs: echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.16.2 + run: python -m pip install cibuildwheel==2.17.0 - name: Build Solcore - if: >- - ( ! contains(matrix.buildplat[2], 'arm64' ) ) - uses: pypa/cibuildwheel@v2.16.2 + if: ${{ matrix.buildplat[0] != 'macos-14' }} + uses: pypa/cibuildwheel@v2.17.0 env: CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}* CIBW_ARCHS: ${{ matrix.buildplat[2] }} @@ -63,38 +62,31 @@ jobs: CIBW_BEFORE_BUILD_MACOS: brew reinstall gfortran CIBW_BEFORE_BUILD_LINUX: python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true" - - name: Set extra env for arm64 - if: >- - ( contains(matrix.buildplat[2], 'arm64' ) ) - run: | - echo "LDFLAGS=-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" >> $GITHUB_ENV; - echo "LIBRARY_PATH=-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" >> $GITHUB_ENV; - - - name: Cross-build Solcore for arm64 - if: ${{ (matrix.python[0] != 'cp37') && ( contains(matrix.buildplat[2], 'arm64') )}} # image not present for python3.7 - uses: pypa/cibuildwheel@v2.16.2 + - name: Build Solcore (Apple Silicon M1/M2) + if: ${{ matrix.buildplat[0] == 'macos-14' && matrix.python[0] != 'cp38' && matrix.python[0] != 'cp39' }} + uses: pypa/cibuildwheel@v2.17.0 env: CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}* CIBW_ARCHS: ${{ matrix.buildplat[2] }} - CIBW_ENVIRONMENT: CFLAGS='-target arm64-apple-macos' - CIBW_BEFORE_BUILD_MACOS: bash {project}/build_tools/cibw_before_build_macos_arm.sh && meson setup --cross-file={project}/build_tools/x86_64-w64-arm64.ini build - CIBW_CONFIG_SETTINGS_MACOS: builddir=build + CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS + CIBW_BEFORE_BUILD_MACOS: brew reinstall gfortran + CIBW_BEFORE_BUILD_LINUX: python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true" - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} + name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} path: ./wheelhouse/*.whl build_sdist: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build sdist run: pipx run build --sdist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: dist/*.tar.gz @@ -105,13 +97,13 @@ jobs: steps: - name: Download sdist artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: artifact path: dist - name: Download wheel artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: wheelhouse diff --git a/.github/workflows/test_unit_and_examples.yml b/.github/workflows/test_unit_and_examples.yml index f3fd8960..7b38b347 100644 --- a/.github/workflows/test_unit_and_examples.yml +++ b/.github/workflows/test_unit_and_examples.yml @@ -231,4 +231,4 @@ jobs: env: SOLCORE_SPICE: ngspice run: | - python -m spin test -- -r a -v solcore/tests/test_examples.py -n "auto" + python -m spin test -- -r a -v solcore/tests/test_examples.py -n "auto" \ No newline at end of file