PR: Remove dependency on pkg_resources
and use importlib-metadata
instead
#5934
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
paths: | |
- 'installers/macOS/**' | |
- '.github/workflows/installer-macos.yml' | |
- 'requirements/*.yml' | |
- 'MANIFEST.in' | |
- '**.bat' | |
- '**.py' | |
- '**.sh' | |
- '!**.md' | |
- '!installers/Windows/**' | |
- '!installers-conda/**' | |
- '!.github/workflows/installer-win.yml' | |
- '!.github/workflows/installers-conda.yml' | |
release: | |
types: | |
- created | |
workflow_dispatch: | |
concurrency: | |
group: installer-macos-${{ github.ref }} | |
cancel-in-progress: true | |
name: Create macOS App Bundle and DMG | |
env: | |
IS_PRE: ${{ github.event_name == 'workflow_dispatch' }} | |
IS_RELEASE: ${{ github.event_name == 'release' }} | |
jobs: | |
matrix_prep: | |
name: Determine Build Matrix | |
runs-on: ubuntu-latest | |
outputs: | |
build_type: ${{ steps.set-matrix.outputs.build_type }} | |
steps: | |
- id: set-matrix | |
run: | | |
if [[ ${GITHUB_EVENT_NAME} == 'release' || ${IS_PRE} == 'true' ]]; then | |
build_type="'Full', 'Lite'" | |
else | |
build_type="'Full'" | |
fi | |
echo "build_type=[${build_type}]" >> $GITHUB_OUTPUT | |
build: | |
name: macOS App Bundle | |
runs-on: ${{ matrix.os }} | |
needs: matrix_prep | |
strategy: | |
matrix: | |
build_type: ${{fromJson(needs.matrix_prep.outputs.build_type)}} | |
os: ["macos-12", "macos-14"] | |
include: | |
- os: "macos-12" | |
pyver: "3.9.14" | |
- os: "macos-14" | |
pyver: "3.10.11" | |
defaults: | |
run: | |
shell: bash -l {0} | |
working-directory: ${{ github.workspace }}/installers/macOS | |
env: | |
LITE_FLAG: ${{ matrix.build_type == 'Lite' && '--lite' || '' }} | |
DMGNAME: ${{ matrix.build_type == 'Lite' && 'Spyder-Lite.dmg' || 'Spyder.dmg' }} | |
DISTDIR: ${{ github.workspace }}/dist | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} | |
APPLICATION_PWD: ${{ secrets.APPLICATION_PWD }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Install pcregrep | |
run: | | |
if [[ -z "$(which pcregrep)" ]]; then | |
brew install pcre | |
else | |
echo "$(which pcregrep) already installed." | |
fi | |
- name: Install Dependencies | |
run: | | |
INSTALL_FLAGS=() | |
if [[ -z ${LITE_FLAG} ]]; then | |
INSTALL_FLAGS+=('-r' 'req-scientific.txt') | |
fi | |
${pythonLocation}/bin/python -m pip install -U pip 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: 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 | |
- name: Show Build Environment | |
run: | | |
${pythonLocation}/bin/python -V -V | |
${pythonLocation}/bin/python -m pip list | |
- name: Install Micromamba | |
working-directory: ${{ github.workspace }}/spyder | |
run: | | |
curl -Ls https://micro.mamba.pm/api/micromamba/osx-64/latest | tar -xvj bin/micromamba | |
install_name_tool -change @rpath/libc++.1.dylib /usr/lib/libc++.1.dylib bin/micromamba | |
- name: Build Application Bundle | |
run: | | |
echo "Patch Black 1 of 2" | |
sitepkgs=$($pythonLocation/bin/python -c "import site; print(site.getsitepackages()[0])") | |
touch ${sitepkgs}/black-24.1.1.dist-info/top_level.txt | |
${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} | |
echo "Patch Black 2 of 2" | |
cp -v ${sitepkgs}/629853fdff261ed89b74__mypyc* ${DISTDIR}/Spyder.app/Contents/Resources/lib/python*/ | |
- name: Create Keychain | |
if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}} | |
run: ./certkeychain.sh "${MACOS_CERTIFICATE}" "${MACOS_CERTIFICATE_PWD}" | |
- name: Code Sign Application | |
if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}} | |
run: | | |
pil=$(${pythonLocation}/bin/python -c "import PIL, os; print(os.path.dirname(PIL.__file__))") | |
rm -v ${DISTDIR}/Spyder.app/Contents/Frameworks/liblzma.5.dylib | |
cp -v ${pil}/.dylibs/liblzma.5.dylib ${DISTDIR}/Spyder.app/Contents/Frameworks/ | |
./codesign.sh "${DISTDIR}/Spyder.app" | |
- name: Test Application Bundle | |
run: ./test_app.sh -t 60 -d 10 ${DISTDIR} | |
- name: Build Disk Image | |
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}" | |
- name: Notarize Disk Image | |
if: ${{env.IS_RELEASE == 'true' || env.IS_PRE == 'true'}} | |
run: ./notarize.sh -p "${APPLICATION_PWD}" "${DISTDIR}/${DMGNAME}" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.DISTDIR }}/${{ env.DMGNAME }} | |
name: ${{ env.DMGNAME }} | |
- name: Get Release | |
if: ${{env.IS_RELEASE == 'true'}} | |
id: get_release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
uses: bruceadams/get-release@v1.3.2 | |
- name: Upload Release Asset | |
if: ${{env.IS_RELEASE == 'true'}} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ${{ env.DISTDIR }}/${{ env.DMGNAME }} | |
asset_name: ${{ env.DMGNAME }} | |
asset_content_type: application/x-apple-diskimage |