Skip to content

Commit

Permalink
feat: add install-rosetta command (#13)
Browse files Browse the repository at this point in the history
* feat: add install-rosetta command

* add rosetta install test
  • Loading branch information
georgexu99 committed Oct 24, 2023
1 parent a8cecf3 commit 5100e44
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ jobs:
- run:
command: '[ $(node -v) = "v$(cat ~/.node-js-version)" ]'
name: Confirm Version
install-rosetta:
executor: << parameters.executor >>
parameters:
executor:
description: The executor to use for the job
type: string
steps:
- node/install-rosetta
- run:
command: '[ $(/usr/bin/pgrep -q oahd && echo Yes || echo No) = "Yes" ]'
name: Confirm Rosetta install
run-tests:
executor: << parameters.executor >>
parameters:
Expand Down Expand Up @@ -148,6 +159,12 @@ workflows:
- run:
command: '[ $(node -v) = "v$(cat ~/.node-js-version)" ]'
name: Confirm Version
- install-rosetta:
filters: *filters
matrix:
parameters:
executor:
- node/macos
- run-tests:
filters: *filters
matrix:
Expand Down Expand Up @@ -222,6 +239,7 @@ workflows:
requires:
- orb-tools/pack
- check-version
- install-rosetta
- check-version-job
- run-tests
- run-tests-job
Expand Down
6 changes: 6 additions & 0 deletions src/commands/install-rosetta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description:
Install Rosetta 2 on Apple Silicon executors
steps:
- run:
name: Installing Rosetta 2
command: << include(scripts/install-rosetta.sh) >>
19 changes: 19 additions & 0 deletions src/examples/install_rosetta_command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
description: >
Example using the install-rosetta command.
usage:
version: 2.1
orbs:
node: electronjs/node@x.y.z
jobs:
install-rosetta:
executor: node/macos
steps:
- node/install-rosetta
- run:
command: '[ $(/usr/bin/pgrep -q oahd && echo Yes || echo No) = "Yes" ]'
name: Confirm Rosetta install
workflows:
install_rosetta:
jobs:
- install-rosetta
7 changes: 7 additions & 0 deletions src/scripts/install-rosetta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
if [ "$(uname -m)" = "arm64" ]; then
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
else
echo "Rosetta 2 can only be installed on Apple Silicon!"
exit 1
fi

0 comments on commit 5100e44

Please sign in to comment.