Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Create conda-based application installer for macOS and Linux #19461

Merged
merged 43 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
24ef24c
Create experimental macOS package installer.
mrclary Sep 15, 2022
0c30c8a
Use white background for pkg logo
mrclary Sep 15, 2022
c65c5a4
Update installer licensing and branding
mrclary Sep 15, 2022
0d51ff1
Eliminate spyder-menu feedstock.
mrclary Sep 16, 2022
59d6a00
Use conda-forge feedstock
mrclary Sep 20, 2022
1449ac3
Some cleanup
mrclary Sep 20, 2022
17ecfbb
Add script for building conda packages
mrclary Sep 21, 2022
50e3bb3
Rename directory
mrclary Sep 21, 2022
c32cfe8
Add spyder source code patch
mrclary Sep 21, 2022
f87a3c8
Cleanup
mrclary Sep 21, 2022
79a839f
Add timers
mrclary Sep 21, 2022
43031a7
Add logger
mrclary Sep 24, 2022
50f2f06
Use setuptools_scm instead of git init
mrclary Sep 23, 2022
0205384
Add script for notarizing
mrclary Oct 4, 2022
ca798a7
Add script for creating keychain on CI
mrclary Sep 28, 2022
475decb
Add github workflow
mrclary Sep 23, 2022
878e8f9
Update workflow paths to ignore installers-conda directory for unit t…
mrclary Sep 22, 2022
4a26d61
Update patch file
mrclary Sep 23, 2022
052d03e
Fix PermissionError
mrclary Oct 3, 2022
78a03fe
Make certificate id an argument rather than environment variable
mrclary Sep 27, 2022
0885d0e
Only move codesign if creating keychain. Ensure only signing on relea…
mrclary Oct 5, 2022
390e53b
Explicitly use spyder and subrepo versions for build specs
mrclary Sep 29, 2022
8bcdb65
Test matrix workflow
mrclary Sep 30, 2022
ad21ca0
Adjust matrix
mrclary Sep 30, 2022
25f65fa
Fix list of files to untar
mrclary Sep 30, 2022
509886a
Restore build steps
mrclary Sep 30, 2022
36cf00a
Revise specs handling
mrclary Sep 30, 2022
1f57fd0
Refactor matrix jobs: noarch conda builds, followed by platform depen…
mrclary Oct 5, 2022
875f8d3
Provide function to change file permissions. This is required for Win…
mrclary Oct 6, 2022
99a0a88
Patch bld.bat
mrclary Oct 6, 2022
6d636ea
Remove tests from outputs
mrclary Oct 7, 2022
316cc78
Remove superfluous treatment of patches
mrclary Oct 7, 2022
bd2832b
Fix icon_image specification
mrclary Oct 7, 2022
b2194f5
Add linux and windows platforms
mrclary Oct 7, 2022
7a60068
tar's -C does not work properly for windows so we must change directo…
mrclary Oct 7, 2022
2b80340
Set CONDA_BLD_PATH to shorter path than default to avoid "FileNotFoun…
mrclary Oct 8, 2022
40b80c6
Include scientific packages
mrclary Oct 10, 2022
6ffa416
Remove win-64 from matrix build for release. Restore after release.
mrclary Oct 11, 2022
e75157d
Add EXPERIMENTAL to artifact name
mrclary Oct 11, 2022
acad9d5
Include win-64 only on release
mrclary Oct 18, 2022
b5ce815
Add python version to job name
mrclary Oct 18, 2022
cff5690
Update patch file
mrclary Oct 11, 2022
ca3ebf3
Apply suggestions from code review
mrclary Oct 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/installer-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:
- '**.sh'
- '!**.md'
- '!installers/Windows/**'
- '!installers-conda/**'
- '!.github/workflows/installer-win.yml'
- '!.github/workflows/installers-conda.yml'

release:
types:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/installer-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ on:
- '**.sh'
- '!**.md'
- '!installers/macOS/**'
- '!installers-conda/**'
- '!.github/workflows/installer-macos.yml'
- '!.github/workflows/installers-conda.yml'

release:
types:
Expand Down
217 changes: 217 additions & 0 deletions .github/workflows/installers-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
on:
pull_request:
paths:
- 'installers-conda/**'
- '.github/workflows/installers-conda.yml'
- 'requirements/*.yml'
- 'MANIFEST.in'
- '**.bat'
- '**.py'
- '**.sh'
- '!**.md'
- '!installers/**'
- '!.github/workflows/installer-win.yml'
- '!.github/workflows/installer-macos.yml'

release:
types:
- created

name: Create conda-based installers for Windows, macOS, and Linux

jobs:
build-noarch-conda-pkgs:
name: Build ${{ matrix.pkg }}
runs-on: ubuntu-latest
if: github.event_name != 'release'
strategy:
matrix:
pkg: ["python-lsp-server", "qdarkstyle", "qtconsole"]
python-version: ["3.9"]
defaults:
run:
shell: bash -l {0}
working-directory: ${{ github.workspace }}/installers-conda
env:
DISTDIR: ${{ github.workspace }}/installers-conda/dist
pkg: ${{ matrix.pkg }}
artifact_name: ${{ matrix.pkg }}_${{ matrix.python-version }}

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Build Environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: installers-conda/build-environment.yml
extra-specs: python=${{ matrix.python-version }}

- name: Build Conda Packages
run: python build_conda_pkgs.py --build $pkg

- name: Build Artifact
run: tar -a -C $CONDA_PREFIX -cf $PWD/${artifact_name}.tar.bz2 conda-bld

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/installers-conda/${{ env.artifact_name }}.tar.bz2
name: ${{ env.artifact_name }}

build-matrix:
name: Determine Build Matrix
runs-on: ubuntu-latest
outputs:
target_platform: ${{ steps.build-matrix.outputs.target_platform }}
include: ${{ steps.build-matrix.outputs.include }}
python_version: ${{ steps.build-matrix.outputs.python_version }}
steps:
- id: build-matrix
run: |
target_platform="'osx-64', 'osx-arm64', 'linux-64'"
include="\
{'os': 'macos-11', 'target-platform': 'osx-64'},\
{'os': 'macos-latest', 'target-platform': 'osx-arm64'},\
{'os': 'ubuntu-latest', 'target-platform': 'linux-64'}\
"
python_version="'3.9'"

if [[ ${GITHUB_EVENT_NAME} == 'release' ]]; then
target_platform=$target_platform", 'win-64'"
include=$include",{'os': 'windows-latest', 'target-platform': 'win-64'}"
fi

echo "target_platform=[$target_platform]" >> $GITHUB_OUTPUT
echo "include=[$include]" >> $GITHUB_OUTPUT
echo "python_version=[$python_version]" >> $GITHUB_OUTPUT

build-installers:
name: Build installer for ${{ matrix.target-platform }} Python-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: [build-matrix, build-noarch-conda-pkgs]
if: always()
strategy:
matrix:
target-platform: ${{fromJson(needs.build-matrix.outputs.target_platform)}}
python-version: ${{fromJson(needs.build-matrix.outputs.python_version)}}
include: ${{fromJson(needs.build-matrix.outputs.include)}}

defaults:
run:
shell: bash -l {0}
working-directory: ${{ github.workspace }}/installers-conda
env:
DISTDIR: ${{ github.workspace }}/installers-conda/dist
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_INSTALLER_CERTIFICATE: ${{ secrets.MACOS_INSTALLER_CERTIFICATE }}
APPLICATION_PWD: ${{ secrets.APPLICATION_PWD }}
CONSTRUCTOR_TARGET_PLATFORM: ${{ matrix.target-platform }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Build Environment
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: installers-conda/build-environment.yml
extra-specs: python=${{ matrix.python-version }}

- name: Download Local Conda Packages
if: github.event_name != 'release'
uses: actions/download-artifact@v3
with:
path: ${{ github.workspace }}/installers-conda/artifacts

- name: Create Local Conda Channel
run: |
CONDA_BLD_PATH=$HOME/conda-bld
echo "CONDA_BLD_PATH=$CONDA_BLD_PATH" >> $GITHUB_ENV

files=($(find $PWD/artifacts -name *.tar.bz2))
echo ${files[@]}
cd $(dirname $CONDA_BLD_PATH)
for file in ${files[@]}; do
tar -xf $file
done

mamba index $CONDA_BLD_PATH

mamba search -c $CONDA_BLD_PATH --override-channels

- name: Build ${{ matrix.target-platform }} conda packages
run: |
pkgs=("spyder")
if [[ $GITHUB_EVENT_NAME != "release" ]]; then
pkgs+=("spyder-kernels")
fi
python build_conda_pkgs.py --build ${pkgs[@]}

- name: Create Keychain
if: github.event_name == 'release' && runner.os == 'macOS'
run: |
./certkeychain.sh "${MACOS_CERTIFICATE_PWD}" "${MACOS_CERTIFICATE}" "${MACOS_INSTALLER_CERTIFICATE}"
CNAME=$(security find-identity -p codesigning -v | pcregrep -o1 "\(([0-9A-Z]+)\)")
echo "CNAME=$CNAME" >> $GITHUB_ENV

_codesign=$(which codesign)
if [[ $_codesign =~ ${CONDA_PREFIX}.* ]]; then
# Find correct codesign
echo "Moving $_codesign..."
mv $_codesign ${_codesign}.bak
fi

- name: Build Package Installer
run: |
[[ -n $CNAME ]] && args=("--cert-id" "$CNAME") || args=()
python build_installers.py ${args[@]}
PKG_FILE=$(python build_installers.py --artifact-name)
PKG_NAME=$(basename $PKG_FILE)
echo "PKG_FILE=$PKG_FILE" >> $GITHUB_ENV
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV

- name: Test Application Bundle
if: runner.os == 'macOS'
run: |
installer -dumplog -pkg $PKG_FILE -target CurrentUserHomeDirectory 2>&1
app_path=$HOME/Applications/Spyder.app
if [[ -e "$app_path" ]]; then
ls -al $app_path/Contents/MacOS
cat $app_path/Contents/Info.plist
echo ""
else
echo "$app_path does not exist"
fi

- name: Notarize package installer
if: github.event_name == 'release' && runner.os == 'macOS'
run: ./notarize.sh -p $APPLICATION_PWD $PKG_FILE

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
path: ${{ env.PKG_FILE }}
name: ${{ env.PKG_NAME }}

- 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.PKG_FILE }}
asset_name: ${{ env.PKG_NAME }}
asset_content_type: application/octet-stream
4 changes: 2 additions & 2 deletions .github/workflows/test-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

pull_request:
Expand All @@ -30,7 +30,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

pull_request:
Expand All @@ -30,7 +30,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

pull_request:
Expand All @@ -30,7 +30,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

pull_request:
Expand All @@ -30,7 +30,7 @@ on:
- '**.bat'
- '**.py'
- '**.sh'
- '!installers/**'
- '!installers*/**'
- '!.github/workflows/installer*.yml'

jobs:
Expand Down
11 changes: 11 additions & 0 deletions installers-conda/build-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: spy-inst
channels:
- napari/label/bundle_tools
- conda-forge
dependencies:
- boa
- conda-standalone
- constructor
- gitpython
- ruamel.yaml.jinja2
- setuptools_scm
Loading