Skip to content

Pin flask < 3.x for flask sqlalchemy tests (#412) #106

Pin flask < 3.x for flask sqlalchemy tests (#412)

Pin flask < 3.x for flask sqlalchemy tests (#412) #106

name: Integration Testing
on:
push:
branches:
- master
jobs:
build_SDK:
name: Build X-Ray Python SDK
runs-on: ubuntu-latest
steps:
- name: Pull in source code from aws-xray-sdk-python Github repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Build X-Ray Python SDK
run: python setup.py sdist
- name: Upload SDK build artifact
uses: actions/upload-artifact@v3
with:
name: sdk-build-artifact
path: .
build_WebApp:
name: Build Web Application
needs: build_SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Download X-Ray SDK build artifact
uses: actions/download-artifact@v3
with:
name: sdk-build-artifact
path: ./sample-apps/flask
- name: Build WebApp with X-Ray Python SDK
run: pip3 install . -t .
working-directory: ./sample-apps/flask
- name: Zip up the deployment package
run: zip -r deploy.zip . -x '*.git*'
working-directory: ./sample-apps/flask
- name: Upload WebApp with X-Ray SDK build artifact
uses: actions/upload-artifact@v3
with:
name: sdk-flask-build-artifact
path: ./sample-apps/flask/deploy.zip
deploy_WebApp:
name: Deploy Web Application
needs: build_WebApp
runs-on: ubuntu-latest
steps:
- name: Checkout X-Ray SDK to get terraform source
uses: actions/checkout@v3
- name: Download WebApp with X-Ray SDK build artifact
uses: actions/download-artifact@v3
with:
name: sdk-flask-build-artifact
- 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.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- 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@v3
with:
name: terraform-state-artifact
path: ./terraform
test_WebApp:
name: Test WebApp
needs: deploy_WebApp
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 14
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Checkout test framework
uses: actions/checkout@v3
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@v3
with:
name: terraform-state-artifact
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- 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 }}'