Skip to content

Commit

Permalink
Migrate to provided.al2 lambda runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesJJ committed Sep 1, 2023
1 parent e7a2b2a commit 9c8d07d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
name: Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.21

- name: Format Check
run: cd function && if [ $(gofmt -l -s . | grep -E -v '^vendor/' | tee /tmp/gofmt.txt
Expand All @@ -29,18 +29,18 @@ jobs:
name: Functionality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.21

- name: Build
run: cd function && go build -v ./...
run: cd function && go build -v -tags lambda.norpc ./...

- name: Test
run: cd function && go test -v -covermode="count" -coverprofile="/tmp/coverage.out"
run: cd function && go test -v -tags lambda.norpc -covermode="count" -coverprofile="/tmp/coverage.out"

- name: Coverage Report
run: cd function && go tool cover -func="/tmp/coverage.out"
Expand Down
13 changes: 7 additions & 6 deletions aws-serverless/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -eou pipefail

SAM_DIR="$(dirname "$0")"
FUNC_DIR_RELATIVE="../function"
APP="bootstrap"

cd "${SAM_DIR}"

Expand All @@ -14,14 +15,14 @@ if [ ! -f "${SANITY}" ] ; then
fi

cd "${FUNC_DIR_RELATIVE}"
GOOS=linux GOARCH=amd64 go build -o main
GOOS=linux GOARCH=arm64 go build -tags lambda.norpc -o "${APP}"
zip "${APP}.zip" "${APP}"
rm -f "${APP}"
cd -

mv "${FUNC_DIR_RELATIVE}/main" ./
sam deploy \
--no-confirm-changeset \
$@
rm -f ./main
mv "${FUNC_DIR_RELATIVE}/${APP}.zip" ./
sam deploy --tags "project=cloudwatch_to_google_chat" $@
rm -f "${APP}.zip"



8 changes: 5 additions & 3 deletions aws-serverless/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ Resources:
Function:
Type: AWS::Serverless::Function
Properties:
Handler: main
Runtime: go1.x
CodeUri: .
Handler: bootstrap
Runtime: provided.al2
Architectures:
- arm64
CodeUri: ./bootstrap.zip
FunctionName: !Join ['-', [!Ref AWS::StackName, lambda]]
Description: *DESC
Timeout: 30
Expand Down

0 comments on commit 9c8d07d

Please sign in to comment.