Skip to content

Commit

Permalink
ci: cache python install to better deal with download errors. (electr…
Browse files Browse the repository at this point in the history
…on#34360)

* ci: cache python install to better deal with download errors.

* chore: use our CDN to download python2

* build: DRY up the python install steps

Co-authored-by: Samuel Attard <[email protected]>
  • Loading branch information
jkleinsc and MarshallOfSound authored Jun 1, 2022
1 parent cda8f3c commit a38e5d2
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions .circleci/config/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,6 @@ step-install-gnutar-on-mac: &step-install-gnutar-on-mac
ln -fs /usr/local/bin/gtar /usr/local/bin/tar
fi
step-install-python2-on-mac: &step-install-python2-on-mac
run:
name: Install python2 on macos
command: |
if [ "`uname`" == "Darwin" ]; then
curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg
sudo installer -pkg python-2.7.18-macosx10.9.pkg -target /
fi
step-gn-gen-default: &step-gn-gen-default
run:
name: Default GN gen
Expand Down Expand Up @@ -1011,7 +1002,7 @@ steps-electron-gn-check: &steps-electron-gn-check
- *step-checkout-electron
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-install-python2-on-mac
- install-python2-mac
- *step-setup-env-for-build
- *step-setup-goma-for-build
- *step-generate-deps-hash
Expand Down Expand Up @@ -1130,6 +1121,31 @@ steps-test-node: &steps-test-node

# Command Aliases
commands:
install-python2-mac:
steps:
- restore_cache:
keys:
- v2.7.18-python-cache-{{ arch }}
name: Restore python cache
- run:
name: Install python2 on macos
command: |
if [ "`uname`" == "Darwin" ]; then
if [ ! -f "python-downloads/python-2.7.18-macosx10.9.pkg" ]; then
mkdir python-downloads
echo 'Downloading Python 2.7.18'
curl -O https://dev-cdn.electronjs.org/python/python-2.7.18-macosx10.9.pkg
mv python-2.7.18-macosx10.9.pkg python-downloads
else
echo 'Using Python install from cache'
fi
sudo installer -pkg python-downloads/python-2.7.18-macosx10.9.pkg -target /
fi
- save_cache:
paths:
- python-downloads
key: v2.7.18-python-cache-{{ arch }}
name: Persisting python cache
maybe-restore-portaled-src-cache:
parameters:
halt-if-successful:
Expand Down Expand Up @@ -1296,7 +1312,7 @@ commands:
- run: rm -rf src/electron
- *step-restore-brew-cache
- *step-install-gnutar-on-mac
- *step-install-python2-on-mac
- install-python2-mac
- *step-save-brew-cache
- when:
condition: << parameters.build >>
Expand Down Expand Up @@ -1488,7 +1504,7 @@ commands:
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-install-python2-on-mac
- install-python2-mac
- *step-get-more-space-on-mac
- when:
condition: << parameters.checkout >>
Expand Down

0 comments on commit a38e5d2

Please sign in to comment.