|
| 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 }} |
0 commit comments