Skip to content

Commit f7d2d9e

Browse files
committed
Add more Nodejs runtime test workflow
1 parent 4872c8c commit f7d2d9e

File tree

2 files changed

+170
-17
lines changed

2 files changed

+170
-17
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Main Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/*
8+
paths-ignore:
9+
- '.github/**'
10+
- '!.github/workflows/main-build.yml'
11+
- '!.github/workflows/main-build-python.yml'
12+
- '!.github/workflows/main-build-java.yml'
13+
- '!.github/workflows/main-build-nodejs.yml'
14+
- '**.md'
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: main-build-${{ github.ref_name }}
19+
cancel-in-progress: true
20+
21+
permissions:
22+
id-token: write
23+
contents: read
24+
25+
jobs:
26+
integration-test:
27+
runs-on: ubuntu-22.04
28+
name: ${{ matrix.language }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
architecture: [ amd64, arm64 ]
33+
language: [ dotnet, go ]
34+
sample-app: [ aws-sdk ]
35+
instrumentation-type: [ wrapper ]
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
submodules: recursive
41+
- uses: actions/setup-go@v5
42+
with:
43+
go-version: '~1.21.10'
44+
check-latest: true
45+
- uses: actions/setup-dotnet@v4
46+
if: ${{ matrix.language == 'dotnet' }}
47+
with:
48+
dotnet-version: '6.0.405'
49+
- uses: aws-actions/[email protected]
50+
with:
51+
role-to-assume: ${{ secrets.INTEG_TEST_LAMBDA_ROLE_ARN }}
52+
role-duration-seconds: 7200
53+
aws-region: us-east-1
54+
- name: Patch ADOT
55+
run: ./patch-upstream.sh
56+
- name: Build layers / functions
57+
run: GOARCH=${{ matrix.architecture }} ./build.sh ${{ matrix.architecture }}
58+
working-directory: ${{ matrix.language }}
59+
- name: Get Lambda Layer amd64 architecture value
60+
if: ${{ matrix.architecture == 'amd64' }}
61+
run: echo LAMBDA_FUNCTION_ARCH=x86_64 | tee --append $GITHUB_ENV
62+
- name: Get Lambda Layer arm64 architecture value
63+
if: ${{ matrix.architecture == 'arm64' }}
64+
run: echo LAMBDA_FUNCTION_ARCH=arm64 | tee --append $GITHUB_ENV
65+
- name: Get terraform directory
66+
run: |
67+
echo TERRAFORM_DIRECTORY=${{ matrix.language }}/integration-tests/${{ matrix.sample-app }}/${{ matrix.instrumentation-type }} |
68+
tee --append $GITHUB_ENV
69+
- uses: hashicorp/setup-terraform@v2
70+
- name: Initialize terraform
71+
run: terraform init
72+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
73+
- name: Get terraform Lambda function name
74+
run: |
75+
echo TERRAFORM_LAMBDA_FUNCTION_NAME=lambda-${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{ github.run_id }} |
76+
tee --append $GITHUB_ENV
77+
- name: Apply terraform
78+
run: terraform apply -auto-approve
79+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
80+
env:
81+
TF_VAR_sdk_layer_name: opentelemetry-${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{ github.run_id }}
82+
TF_VAR_function_name: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
83+
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
84+
- name: Extract endpoint
85+
id: extract-endpoint
86+
run: terraform output -raw api-gateway-url
87+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
88+
- name: Extract SDK layer arn
89+
id: extract-sdk-layer-arn
90+
if: ${{ matrix.language != 'dotnet' && matrix.language != 'go' }}
91+
run: terraform output -raw sdk_layer_arn
92+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
93+
- name: Output annotations
94+
if: ${{ matrix.language != 'dotnet' && matrix.language != 'go' }}
95+
run: |
96+
echo "::warning::Function: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}"
97+
echo "::warning::SDK Layer ARN: ${{ steps.extract-sdk-layer-arn.outputs.stdout }}"
98+
- name: Send request to endpoint
99+
run: curl -sS ${{ steps.extract-endpoint.outputs.stdout }}
100+
- name: Checkout test framework
101+
uses: actions/checkout@v4
102+
with:
103+
repository: aws-observability/aws-otel-test-framework
104+
path: test-framework
105+
- name: validate trace sample
106+
run: |
107+
cp adot/utils/expected-templates/${{ matrix.language }}-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}.json \
108+
test-framework/validator/src/main/resources/expected-data-template/lambdaExpectedTrace.mustache
109+
cd test-framework
110+
./gradlew :validator:run --args="-c default-lambda-validation.yml --endpoint ${{ steps.extract-endpoint.outputs.stdout }} --region $AWS_REGION"
111+
- name: Destroy terraform
112+
if: always()
113+
run: terraform destroy -auto-approve
114+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
115+
env:
116+
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
117+
118+
python-runtime-test:
119+
concurrency:
120+
group: python-runtime-test
121+
cancel-in-progress: false
122+
uses: ./.github/workflows/main-build-python.yml
123+
secrets: inherit
124+
with:
125+
caller-workflow-name: 'main-build'
126+
127+
java-runtime-test:
128+
concurrency:
129+
group: java-runtime-test
130+
cancel-in-progress: false
131+
uses: ./.github/workflows/main-build-java.yml
132+
secrets: inherit
133+
with:
134+
caller-workflow-name: 'main-build'
135+
136+
nodejs-runtime-test:
137+
concurrency:
138+
group: nodejs-runtime-test
139+
cancel-in-progress: false
140+
uses: ./.github/workflows/main-build-nodejs.yml
141+
secrets: inherit
142+
with:
143+
caller-workflow-name: 'main-build'
144+
145+
publish-build-status:
146+
needs: [integration-test, python-runtime-test, java-runtime-test, nodejs-runtime-test]
147+
if: ${{ always() }}
148+
uses: ./.github/workflows/publish-status.yml
149+
with:
150+
namespace: 'ADOT/GitHubActions'
151+
repository: ${{ github.repository }}
152+
branch: ${{ github.ref_name }}
153+
workflow: main-build
154+
success: ${{ needs.integration-test.result == 'success' && needs.python-runtime-test.result == 'success' && needs.java-runtime-test.result == 'success' && needs.nodejs-runtime-test == 'success' }}
155+
region: us-west-2
156+
secrets:
157+
roleArn: ${{ secrets.METRICS_ROLE_ARN }}

.github/workflows/main-build.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '!.github/workflows/main-build.yml'
1111
- '!.github/workflows/main-build-python.yml'
1212
- '!.github/workflows/main-build-java.yml'
13+
- '!.github/workflows/main-build-nodejs.yml'
1314
- '**.md'
1415
workflow_dispatch:
1516

@@ -29,7 +30,7 @@ jobs:
2930
fail-fast: false
3031
matrix:
3132
architecture: [ amd64, arm64 ]
32-
language: [ dotnet, go, nodejs ]
33+
language: [ dotnet, go ]
3334
sample-app: [ aws-sdk ]
3435
instrumentation-type: [ wrapper ]
3536

@@ -41,20 +42,6 @@ jobs:
4142
with:
4243
go-version: '~1.21.10'
4344
check-latest: true
44-
- uses: actions/setup-node@v4
45-
if: ${{ matrix.language == 'nodejs' }}
46-
with:
47-
node-version: '16'
48-
- name: Cache (NodeJS)
49-
uses: actions/cache@v4
50-
if: ${{ matrix.language == 'nodejs' }}
51-
with:
52-
path: |
53-
~/go/pkg/mod
54-
~/.npm
55-
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}-go-${{ hashFiles('**/go.sum') }}
56-
restore-keys: |
57-
${{ runner.os }}-node-
5845
- uses: actions/setup-dotnet@v4
5946
if: ${{ matrix.language == 'dotnet' }}
6047
with:
@@ -146,16 +133,25 @@ jobs:
146133
with:
147134
caller-workflow-name: 'main-build'
148135

136+
nodejs-runtime-test:
137+
concurrency:
138+
group: nodejs-runtime-test
139+
cancel-in-progress: false
140+
uses: ./.github/workflows/main-build-nodejs.yml
141+
secrets: inherit
142+
with:
143+
caller-workflow-name: 'main-build'
144+
149145
publish-build-status:
150-
needs: [integration-test, python-runtime-test, java-runtime-test]
146+
needs: [integration-test, python-runtime-test, java-runtime-test, nodejs-runtime-test]
151147
if: ${{ always() }}
152148
uses: ./.github/workflows/publish-status.yml
153149
with:
154150
namespace: 'ADOT/GitHubActions'
155151
repository: ${{ github.repository }}
156152
branch: ${{ github.ref_name }}
157153
workflow: main-build
158-
success: ${{ needs.integration-test.result == 'success' && needs.python-runtime-test.result == 'success' && needs.java-runtime-test.result == 'success' }}
154+
success: ${{ needs.integration-test.result == 'success' && needs.python-runtime-test.result == 'success' && needs.java-runtime-test.result == 'success' && needs.nodejs-runtime-test == 'success' }}
159155
region: us-west-2
160156
secrets:
161157
roleArn: ${{ secrets.METRICS_ROLE_ARN }}

0 commit comments

Comments
 (0)