Skip to content

Commit

Permalink
Add ARM64 Architecture Build (#92)
Browse files Browse the repository at this point in the history
* Add ARM64 Architecture Build

* Bump to v2.0.5

* Make CI/CD Makefile driven
  • Loading branch information
kolanos authored Nov 2, 2021
1 parent d7c20a3 commit 5f42a5f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 20 deletions.
78 changes: 65 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
name: Upload coverage report
command: bash <(curl -s https://codecov.io/bash)

build-release:
build-release-x86_64:
docker:
- image: circleci/golang:1
steps:
Expand All @@ -50,27 +50,43 @@ jobs:
keys:
- go-mod-{{ checksum "go.sum" }}
- run:
name: Build distribution
command: make dist
name: Build and archive x86_64 distribution
command: make zip-x86_64
- store_artifacts:
path: /tmp/newrelic-lambda-extension.x86_64.zip
destination: newrelic-lambda-extension
- persist_to_workspace:
root: /tmp
paths:
- newrelic-lambda-extension.x86_64.zip

build-release-arm64:
docker:
- image: circleci/golang:1
steps:
- checkout
- restore_cache:
keys:
- go-mod-{{ checksum "go.sum" }}
- run:
name: Archive distribution
command: zip -rq /tmp/newrelic-lambda-extension.zip preview-extensions-ggqizro707 extensions
name: Build and archive arm64 distribution
command: make zip-arm64
- store_artifacts:
path: /tmp/newrelic-lambda-extension.zip
path: /tmp/newrelic-lambda-extension.arm64.zip
destination: newrelic-lambda-extension
- persist_to_workspace:
root: /tmp
paths:
- newrelic-lambda-extension.zip
- newrelic-lambda-extension.arm64.zip

publish-release:
publish-release-x86_64:
docker:
- image: circleci/golang:1
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Publish Release on GitHub
name: Publish x86_64 release on GitHub
command: |
go get -u github.com/tcnksm/ghr
ghr \
Expand All @@ -80,7 +96,26 @@ jobs:
-n "New Relic Lambda Extension ${CIRCLE_TAG}" \
-replace \
${CIRCLE_TAG} \
/tmp/workspace/newrelic-lambda-extension.zip
/tmp/workspace/newrelic-lambda-extension.x86_64.zip
publish-release-arm64:
docker:
- image: circleci/golang:1
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Publish arm64 release on GitHub
command: |
go get -u github.com/tcnksm/ghr
ghr \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
-n "New Relic Lambda Extension ${CIRCLE_TAG}" \
-replace \
${CIRCLE_TAG} \
/tmp/workspace/newrelic-lambda-extension.arm64.zip
workflows:
version: 2
Expand All @@ -100,18 +135,35 @@ workflows:
only: /.*/
tags:
only: /.*/
- build-release:
- build-release-x86_64:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/
- build-release-arm64:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/
- publish-release-x86_64:
requires:
- build
- build-release-x86_64
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/
- publish-release:
- publish-release-arm64:
requires:
- build
- build-release
- build-release-arm64
filters:
branches:
ignore: /.*/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ extensions/
response.out
.aws-sam/
coverage.txt
preview-extensions-ggqizro707
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ build: clean
clean:
rm -rf extensions
rm -f preview-extensions-ggqizro707
rm -f extensions.zip
rm -f /tmp/newrelic-lambda-extension.x86_64.zip
rm -f /tmp/newrelic-lambda-extension.arm64.zip

dist: clean
dist-x86_64: clean
env GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -o ./extensions/newrelic-lambda-extension
touch preview-extensions-ggqizro707

zip: dist
zip -r extensions.zip preview-extensions-ggqizro707 extensions
dist-arm64: clean
env GOARCH=arm64 GOOS=linux go build -ldflags="-s -w" -o ./extensions/newrelic-lambda-extension
touch preview-extensions-ggqizro707

zip-x86_64: dist-x86_64
zip -r /tmp/newrelic-lambda-extension.x86_64.zip preview-extensions-ggqizro707 extensions

publish: zip
aws lambda publish-layer-version --no-cli-pager --layer-name newrelic-lambda-extension --zip-file fileb://extensions.zip
zip-arm64: dist-arm64
zip -r /tmp/newrelic-lambda-extension.arm64.zip preview-extensions-ggqizro707 extensions

test:
go test -race ./...
Expand Down
2 changes: 1 addition & 1 deletion util/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package util

const (
Name = "newrelic-lambda-extension"
Version = "2.0.4"
Version = "2.0.5"
Id = Name + ":" + Version
)

0 comments on commit 5f42a5f

Please sign in to comment.