124 lines (121 loc) · 4.64 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
on:
pull_request:
paths:
- 'installers/macOS/**'
- '.github/workflows/installer-macos.yml'
- 'requirements/*.yml'
- 'MANIFEST.in'
- '**.bat'
- '**.py'
- '**.sh'
- '!**.md'
- '!installers/Windows/**'
- '!.github/workflows/installer-win.yml'
release:
types:
- created
name: Create macOS App Bundle and DMG
jobs:
matrix_prep:
name: Determine Build Matrix
runs-on: macos-10.15
outputs:
build_type: ${{ steps.set-matrix.outputs.build_type }}
steps:
- id: set-matrix
run: |
if [[ ${GITHUB_EVENT_NAME} == 'release' ]]; then
build_type=$(echo "['Full', 'Lite']")
else
build_type=$(echo "['Full']")
fi
echo "::set-output name=build_type::{'build_type':$(echo $build_type)}"
build:
name: macOS App Bundle
runs-on: macos-10.15
needs: matrix_prep
strategy:
matrix: ${{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@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.5'
architecture: 'x64'
- 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
${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
- name: Build Application Bundle
run: ${pythonLocation}/bin/python setup.py ${LITE_FLAG} --dist-dir ${DISTDIR}
- name: Create Keychain
if: ${{github.event_name == 'release'}}
run: ./certkeychain.sh "${MACOS_CERTIFICATE}" "${MACOS_CERTIFICATE_PWD}"
- name: Code Sign Application
if: ${{github.event_name == 'release'}}
run: |
pil=$(${pythonLocation} -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 -a "${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: ${{github.event_name == 'release'}}
run: ./codesign.sh "${DISTDIR}/${DMGNAME}"
- name: Notarize Disk Image
if: ${{github.event_name == 'release'}}
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: ${{github.event_name == 'release'}}
id: get_release
env:
GITHUB_TOKEN: ${{ github.token }}
uses: bruceadams/get-release@v1.2.0
- name: Upload Release Asset
if: ${{github.event_name == 'release'}}
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