From 5501b480fe78862fcbdf39917258305f0f5d0332 Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:31:49 -0800 Subject: [PATCH] Add arm64 to build matrix * Update Python to 3.10.11 (arm64 builds not available for Python 3.9 from setup-python) * Update DMG name to include Spyder version and architecture --- .github/workflows/installer-macos.yml | 21 ++++++++++++--------- installers/macOS/req-build.txt | 2 +- installers/macOS/setup.py | 26 ++++++++++++++++++++++---- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.github/workflows/installer-macos.yml b/.github/workflows/installer-macos.yml index 03984faa953..ac1ff623f87 100644 --- a/.github/workflows/installer-macos.yml +++ b/.github/workflows/installer-macos.yml @@ -47,11 +47,12 @@ jobs: echo "build_type=[${build_type}]" >> $GITHUB_OUTPUT build: name: macOS App Bundle - runs-on: macos-11 + runs-on: ${{ matrix.os }} needs: matrix_prep strategy: matrix: build_type: ${{fromJson(needs.matrix_prep.outputs.build_type)}} + os: ["macos-11", "macos-14"] defaults: run: shell: bash -l {0} @@ -69,10 +70,9 @@ jobs: with: fetch-depth: 0 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.9.14' - architecture: 'x64' + python-version: '3.10.11' - name: Install pcregrep run: | if [[ -z "$(which pcregrep)" ]]; then @@ -88,8 +88,8 @@ jobs: fi ${pythonLocation}/bin/python -m pip install -U pip setuptools wheel ${pythonLocation}/bin/python -m pip install -r req-build.txt -r req-extras.txt -r req-plugins.txt "${INSTALL_FLAGS[@]}" -e ${GITHUB_WORKSPACE} - - name: Add mising file to Black dist-info - run: touch ${pythonLocation}/lib/python3.9/site-packages/black-23.12.0.dist-info/top_level.txt + - name: Add missing file to Black dist-info + run: touch ${pythonLocation}/lib/python3.10/site-packages/black-24.1.1.dist-info/top_level.txt - name: Install Subrepos if: ${{github.event_name == 'pull_request'}} run: ${pythonLocation}/bin/python -bb -X dev -W error ${GITHUB_WORKSPACE}/install_dev_repos.py --not-editable --no-install spyder @@ -105,7 +105,7 @@ jobs: - name: Build Application Bundle run: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} - name: Add missing Black module to bundle - run: cp -v ${pythonLocation}/lib/python3.9/site-packages/629853fdff261ed89b74__mypyc* ${DISTDIR}/Spyder.app/Contents/Resources/lib/python3.9/ + run: cp -v ${pythonLocation}/lib/python3.10/site-packages/629853fdff261ed89b74__mypyc* ${DISTDIR}/Spyder.app/Contents/Resources/lib/python3.10/ - name: Create Keychain if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}} run: ./certkeychain.sh "${MACOS_CERTIFICATE}" "${MACOS_CERTIFICATE_PWD}" @@ -119,7 +119,10 @@ jobs: - name: Test Application Bundle run: ./test_app.sh -t 60 -d 10 ${DISTDIR} - name: Build Disk Image - run: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} --dmg --no-app + run: | + DMGNAME=$(${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dmg-name) + ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} --dmg --no-app + echo "DMGNAME=$DMGNAME" >> $GITHUB_ENV - name: Sign Disk Image if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}} run: ./codesign.sh "${DISTDIR}/${DMGNAME}" @@ -136,7 +139,7 @@ jobs: id: get_release env: GITHUB_TOKEN: ${{ github.token }} - uses: bruceadams/get-release@v1.2.0 + uses: bruceadams/get-release@v1.3.2 - name: Upload Release Asset if: ${{env.IS_RELEASE == 'true'}} uses: actions/upload-release-asset@v1 diff --git a/installers/macOS/req-build.txt b/installers/macOS/req-build.txt index 609ddc9f6fc..27d3e0268ee 100644 --- a/installers/macOS/req-build.txt +++ b/installers/macOS/req-build.txt @@ -2,4 +2,4 @@ dmgbuild>=1.4.2 py2app==0.28.4 sphinx==5.1.1 # See spyder-ide/spyder#19618 for details. -black==23.12.0 # Pin it to add missing modules to the bundle. See workflow file for the details. +black==24.1.1 # Pin it to add missing modules to the bundle. See workflow file for the details. diff --git a/installers/macOS/setup.py b/installers/macOS/setup.py index 4f5e93e4c36..d11c7243d20 100644 --- a/installers/macOS/setup.py +++ b/installers/macOS/setup.py @@ -16,6 +16,7 @@ from logging import getLogger, StreamHandler, Formatter from pathlib import Path from setuptools import setup +from platform import machine from spyder import get_versions @@ -98,6 +99,18 @@ def make_app_bundle(dist_dir, make_lite=False): return +def disk_image_name(make_lite=False): + """ + Return disk image name + """ + dmg_name = f'Spyder-{SPYVER}_{machine()}' + if make_lite: + dmg_name += '-Lite' + dmg_name += '.dmg' + + return dmg_name + + def make_disk_image(dist_dir, make_lite=False): """ Make macOS disk image containing Spyder.app application bundle. @@ -117,12 +130,9 @@ def make_disk_image(dist_dir, make_lite=False): from dmgbuild.core import DMGError volume_name = '{}-{} Py-{}.{}.{}'.format(APP_BASE_NAME, SPYVER, *PYVER) - dmg_name = 'Spyder' if make_lite: volume_name += ' Lite' - dmg_name += '-Lite' - dmg_name += '.dmg' - dmgfile = (dist_dir / dmg_name).as_posix() + dmgfile = (dist_dir / disk_image_name(make_lite)).as_posix() settings_file = (THISDIR / 'dmg_settings.py').as_posix() settings = { @@ -162,9 +172,17 @@ def make_disk_image(dist_dir, make_lite=False): parser.add_argument('-b', '--bdist-base', dest='build_dir', default='build', help='Build directory; passed to py2app') + parser.add_argument( + '-m', '--dmg-name', dest='dmg_name', action='store_true', + help='Return the DMG name: Spyder-{VER}_{ARCH}-{LITE}.dmg' + ) args, rem = parser.parse_known_args() + if args.dmg_name: + print(disk_image_name(args.make_lite)) + sys.exit() + # Groom sys.argv for py2app sys.argv = sys.argv[:1] + ['py2app'] + rem