From 23555a412fc8de8eb297c29a7319e8d53534792a Mon Sep 17 00:00:00 2001 From: Daniel Flores Date: Wed, 30 Oct 2024 13:29:22 -0400 Subject: [PATCH] test: run integ tests upon pull request approval --- .github/workflows/pr-approval.yml | 15 +++++++++++++++ .mergify.yml | 2 ++ task-definition.json | 32 +++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .github/workflows/pr-approval.yml create mode 100644 task-definition.json diff --git a/.github/workflows/pr-approval.yml b/.github/workflows/pr-approval.yml new file mode 100644 index 000000000..91bdb1868 --- /dev/null +++ b/.github/workflows/pr-approval.yml @@ -0,0 +1,15 @@ +name: PR Approval + +on: + pull_request_review: + types: [submitted] + workflow_dispatch: +jobs: + integ_tests: + if: github.event.review.state == 'approved' + name: Run Integration Tests + uses: aws-actions/amazon-ecs-deploy-task-definition/.github/workflows/test-workflow.yml@integ-tests + with: + call_local_action: 'true' + secrets: + account_id: ${{ secrets.AWS_ACCOUNT_ID }} \ No newline at end of file diff --git a/.mergify.yml b/.mergify.yml index 787336e67..04ecbc437 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -5,6 +5,7 @@ queue_rules: - status-success=Run Unit Tests - status-success=Semantic Pull Request - status-success=Analyze (javascript) + - status-success=Run Integration Tests pull_request_rules: - name: Automatically merge on CI success and review approval @@ -16,6 +17,7 @@ pull_request_rules: - status-success=Run Unit Tests - status-success=Semantic Pull Request - status-success=Analyze (javascript) + - status-success=Run Integration Tests - label!=work-in-progress - -title~=(WIP|wip) - -merged diff --git a/task-definition.json b/task-definition.json new file mode 100644 index 000000000..132cf7ee7 --- /dev/null +++ b/task-definition.json @@ -0,0 +1,32 @@ +{ + "containerDefinitions": [ + { + "entryPoint": [ + "sh", + "-c" + ], + "portMappings": [ + { + "hostPort": 80, + "protocol": "tcp", + "containerPort": 80 + } + ], + "command": [ + "/bin/sh -c \"echo ' Amazon ECS Sample App

Amazon ECS Sample App

Congratulations!

Your application is now running on a container in Amazon ECS.

' > /usr/local/apache2/htdocs/index.html && httpd-foreground\"" + ], + "cpu": 256, + "memoryReservation": 512, + "image": "httpd:2.4", + "essential": true, + "name": "sample-app" + } + ], + "memory": "512", + "family": "github-actions-deploy-task-def-integ-tests", + "requiresCompatibilities": [ + "FARGATE" + ], + "networkMode": "awsvpc", + "cpu": "256" +}