-
Notifications
You must be signed in to change notification settings - Fork 117
147 lines (117 loc) · 4.66 KB
/
IntegrationTesting.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Integration Testing
on:
workflow_dispatch:
push:
branches:
- master
jobs:
package_SDK:
name: Build X-Ray Go SDK With Sample App
runs-on: ubuntu-latest
steps:
- name: Checkout X-Ray Go SDK
uses: actions/checkout@v2
- name: Create a directory
run: mkdir sample-apps/http-server/aws-xray-sdk-go
- name: Copy X-Ray SDK to deployment package with Sample App
run: rsync -r * sample-apps/http-server/aws-xray-sdk-go --exclude sample-apps/
- name: The application.go file must be at the working directory level in EB Go. We need to change the redirection to the folder we copied in the previous step.
run: sed -i 's|replace github.com/aws/aws-xray-sdk-go => ../../|replace github.com/aws/aws-xray-sdk-go => ./aws-xray-sdk-go|g' go.mod
working-directory: ./sample-apps/http-server
- name: Zip up the deployment package
run: zip -r deploy.zip . -x '*.git*'
working-directory: ./sample-apps/http-server
- name: Upload WebApp with X-Ray SDK build artifact
uses: actions/upload-artifact@v2
with:
name: deployment-package
path: sample-apps/http-server/deploy.zip
deploy_WebApp:
name: Deploy X-Ray Instrumented Web App
needs: package_SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download terraform state artifact
uses: actions/download-artifact@v2
with:
name: deployment-package
- name: Copy deployment package to terraform directory
run: cp deploy.zip ./terraform
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
aws-region: us-west-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Init
run: terraform init
working-directory: ./terraform
- name: Terraform Validate
run: terraform validate -no-color
working-directory: ./terraform
- name: Terraform Plan
run: terraform plan -var-file="fixtures.us-west-2.tfvars" -no-color
env:
TF_VAR_resource_prefix: '${{ github.run_id }}-${{ github.run_number }}'
continue-on-error: true
working-directory: ./terraform
- name: Terraform Apply
run: terraform apply -var-file="fixtures.us-west-2.tfvars" -auto-approve
env:
TF_VAR_resource_prefix: '${{ github.run_id }}-${{ github.run_number }}'
working-directory: ./terraform
- name: Upload terraform state files for destorying resources
uses: actions/upload-artifact@v2
with:
name: terraform-state-artifact
path: ./terraform
test_WebApp:
name: Run testing suite
needs: deploy_WebApp
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: 14
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
aws-region: us-west-2
- name: Checkout test framework
uses: actions/checkout@v2
with:
repository: aws-observability/aws-otel-test-framework
ref: terraform
- name: Run testing suite
run: ./gradlew :validator:run --args='-c default-xray-trace-validation.yml --endpoint http://${{ github.run_id }}-${{ github.run_number }}-eb-app-env.us-west-2.elasticbeanstalk.com'
cleanup:
name: Resource tear down
needs: test_WebApp
if: always()
runs-on: ubuntu-latest
steps:
- name: Download terraform state artifact
uses: actions/download-artifact@v2
with:
name: terraform-state-artifact
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INTEG_TEST_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.INTEG_TEST_AWS_KEY_SECRET }}
aws-region: us-west-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Init
run: terraform init
- name: set permissions to terraform plugins
run: chmod -R a+x .terraform/*
- name: Destroy resources
run: terraform destroy -state="terraform.tfstate" -var-file="fixtures.us-west-2.tfvars" -auto-approve
env:
TF_VAR_resource_prefix: '${{ github.run_id }}-${{ github.run_number }}'