PR: Use requests
instead of urllib
for updates
#5727
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: macos-11 | |
needs: matrix_prep | |
strategy: | |
matrix: | |
build_type: ${{fromJson(needs.matrix_prep.outputs.build_type)}} | |
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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9.14' | |
architecture: 'x64' | |
- 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 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: 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: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} | |
- 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: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR} --dmg --no-app | |
- 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 -i 30 -p "${APPLICATION_PWD}" "${DISTDIR}/${DMGNAME}" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
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.2.0 | |
- 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 |