Make LAMBDA_DOCKER_FLAGS default; set it in devcontainer env #91
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Install tools | |
| run: | | |
| pip install --pre localstack awscli-local[ver1] terraform-local pytest requests | |
| # Terraform | |
| curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" \ | |
| | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
| sudo apt-get update -qq && sudo apt-get install -y terraform | |
| - name: Start LocalStack | |
| env: | |
| LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} | |
| run: | | |
| docker pull localstack/localstack-pro & | |
| DEBUG=1 LOCALSTACK_APPINSPECTOR_ENABLE=1 localstack start -d | |
| localstack wait | |
| - name: Deploy infrastructure via Terraform | |
| run: | | |
| cd 01-serverless-app/terraform | |
| tflocal init | |
| tflocal apply -auto-approve | |
| - name: Build and push fulfillment image | |
| run: | | |
| ECR_REGISTRY="000000000000.dkr.ecr.us-east-1.localhost.localstack.cloud:4566" | |
| awslocal ecr get-login-password | \ | |
| docker login --username AWS --password-stdin "$ECR_REGISTRY" | |
| docker build -t "$ECR_REGISTRY/fulfillment:latest" 01-serverless-app/services/fulfillment | |
| docker push "$ECR_REGISTRY/fulfillment:latest" | |
| - name: Run E2E tests | |
| run: | | |
| cd 02-e2e-testing && pytest tests/ -v | |
| - name: Print LocalStack logs | |
| if: always() | |
| run: | | |
| localstack logs | |
| localstack stop |