-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
145 lines (139 loc) · 5.31 KB
/
installer-macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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