Skip to content

Commit

Permalink
ci: add arm64 linux deployment (#10134)
Browse files Browse the repository at this point in the history
* ci: add arm64 linux deployment

* build: pkg cli with node 14

BREAKING CHANGE: needed to make lerna behave

Co-authored-by: John Corser <xss@amazon.com>
  • Loading branch information
johnpc and John Corser committed Apr 5, 2022
1 parent 5c0e290 commit f04af99
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ executors:
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux-x64

defaults: &defaults
working_directory: ~/repo
Expand Down Expand Up @@ -544,7 +544,7 @@ jobs:
git stash
git stash drop
uploadPkgCli
./out/amplify-pkg-linux --version
./out/amplify-pkg-linux-x64 --version
- run:
name: Authenticate with npm
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
Expand Down Expand Up @@ -950,7 +950,7 @@ commands:
name: Symlink Amplify packaged CLI
command: |
cd out
ln -sf amplify-pkg-linux amplify
ln -sf amplify-pkg-linux-x64 amplify
echo "export PATH=$AMPLIFY_DIR:$PATH" >> $BASH_ENV
source $BASH_ENV
- run:
Expand Down
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ executors:
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux-x64

# our defined job, and its steps
jobs:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux-x64
- << parameters.os >>
steps:
- persist_to_workspace:
Expand All @@ -84,7 +84,7 @@ jobs:
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux-x64
steps:
- attach_workspace:
at: ./
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux-x64
steps:
- attach_workspace:
at: ./
Expand Down
16 changes: 9 additions & 7 deletions .circleci/local_publish_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,25 @@ function uploadPkgCli {
aws configure --profile=s3-uploader set aws_session_token $S3_AWS_SESSION_TOKEN
cd out/
export hash=$(git rev-parse HEAD | cut -c 1-12)
export version=$(./amplify-pkg-linux --version)
export version=$(./amplify-pkg-linux-x64 --version)

aws --profile=s3-uploader s3 cp amplify-pkg-win.exe s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-win-$(echo $hash).exe
aws --profile=s3-uploader s3 cp amplify-pkg-macos s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-macos-$(echo $hash)
aws --profile=s3-uploader s3 cp amplify-pkg-linux s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-$(echo $hash)
aws --profile=s3-uploader s3 cp amplify-pkg-linux-arm64 s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-arm64-$(echo $hash)
aws --profile=s3-uploader s3 cp amplify-pkg-linux-x64 s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-x64-$(echo $hash)
if [ -z "$NPM_TAG" ]; then
exit 0
fi

echo "Tag name is $NPM_TAG. Uploading to s3://aws-amplify-cli-do-not-delete/$(echo $version)"
if [ "0" -ne "$(aws s3 ls s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux | egrep -v "amplify-pkg-linux-.*" | wc -l)" ]; then
echo "Cannot overwrite existing file at s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux"
if [ "0" -ne "$(aws s3 ls s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-x64 | egrep -v "amplify-pkg-linux-x64-.*" | wc -l)" ]; then
echo "Cannot overwrite existing file at s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-x64"
exit 1
fi
aws --profile=s3-uploader s3 cp amplify-pkg-win.exe s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-win.exe
aws --profile=s3-uploader s3 cp amplify-pkg-macos s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-macos
aws --profile=s3-uploader s3 cp amplify-pkg-linux s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux
aws --profile=s3-uploader s3 cp amplify-pkg-linux-arm64 s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-arm64
aws --profile=s3-uploader s3 cp amplify-pkg-linux-x64 s3://aws-amplify-cli-do-not-delete/$(echo $version)/amplify-pkg-linux-x64
cd ..
}

Expand All @@ -80,14 +82,14 @@ function generatePkgCli {

# Build pkg cli
cp package.json ../build/node_modules/package.json
npx pkg -t node12-macos-x64,node12-linux-x64,node12-win-x64 ../build/node_modules --out-path ../out
npx pkg -t node14-macos-x64,node14-linux-x64,node14-linux-arm64,node14-win-x64 ../build/node_modules --out-path ../out

cd ..
}

function loginToLocalRegistry {
# Login so we can publish packages
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url")
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e usser@example.com -r "$custom_registry_url")
}

function unsetNpmRegistryUrl {
Expand Down
7 changes: 6 additions & 1 deletion packages/amplify-cli-npm/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ const supportedPlatforms = [
{
TYPE: 'Linux',
ARCHITECTURE: 'x64',
BINARY_NAME: 'amplify-pkg-linux',
BINARY_NAME: 'amplify-pkg-linux-x64',
},
{
TYPE: 'Linux',
ARCHITECTURE: 'arm64',
BINARY_NAME: 'amplify-pkg-linux-arm64',
},
{
TYPE: 'Darwin',
Expand Down

0 comments on commit f04af99

Please sign in to comment.