-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
56 lines (39 loc) · 1.68 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
version: 0.2
phases:
install:
runtime-versions:
golang: 1.14
commands:
# Use go modules rather than GOPATH
- export GO111MODULE="on"
# Install golint
- go get golang.org/x/lint/golint@v0.0.0-20210508222113-6edffad5e616
# Install Testify to use common assertions and mocks in tests
- go get -u github.com/stretchr/testify@v1.6.1
pre_build:
commands:
# Fetch all dependencies
- go get ./...
# Ensure code passes all lint tests
- golint -set_exit_status
# Check for common Go application problems with 'go vet'
- go vet .
# Run all tests included with our application
- go test .
build:
commands:
# Build our go application
- go build -o main
# Copy static assets to S3, and package application with AWS CloudFormation/SAM
- aws s3 cp --recursive public/ s3://$WEBSITE_S3_BUCKET/public/ --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
- sed -i -e "s|assets/|$WEBSITE_S3_PREFIX/public/assets/|g" public/index.html
- aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.yml
post_build:
commands:
# Do not remove this statement. This command is required for AWS CodeStar projects.
# Update the AWS Partition, AWS Region, account ID and project ID in the project ARN on template-configuration.json file so AWS CloudFormation can tag project resources.
- sed -i.bak 's/\$PARTITION\$/'${PARTITION}'/g;s/\$AWS_REGION\$/'${AWS_REGION}'/g;s/\$ACCOUNT_ID\$/'${ACCOUNT_ID}'/g;s/\$PROJECT_ID\$/'${PROJECT_ID}'/g' template-configuration.json
artifacts:
files:
- template-export.yml
- template-configuration.json