Skip to content

Commit fc88935

Browse files
committed
chore: run integration tests upon pull request approval
1 parent 405ede4 commit fc88935

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
lines changed

.github/workflows/integ-tests.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on:
2+
pull_request_review:
3+
types: [submitted]
4+
5+
name: Run Integration Tests
6+
7+
permissions:
8+
id-token: write
9+
contents: read
10+
11+
jobs:
12+
deploy:
13+
name: Deploy
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Configure AWS credentials
21+
uses: aws-actions/configure-aws-credentials@v4
22+
with:
23+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubActionsDeployTaskIntegrationTests
24+
role-session-name: deploy_task_integration_tests
25+
aws-region: us-west-2
26+
27+
# - name: Deploy Amazon ECS task definition with one-off task and wait for task stopped set to false
28+
# uses: ./
29+
# with:
30+
# task-definition: test-resources/task-definition-run-task.json
31+
# cluster: github-actions-deploy-task-def-integ-test
32+
# run-task: true
33+
# run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64
34+
# run-task-assign-public-IP: ENABLED
35+
# run-task-security-groups: sg-067ebcde49c0f3ad8
36+
# run-task-launch-type: FARGATE
37+
# wait-for-task-stopped: false
38+
39+
# - name: Deploy Amazon ECS task definition with one-off task and wait for task stopped set to true
40+
# uses: ./
41+
# with:
42+
# task-definition: test-resources/task-definition-run-task.json
43+
# cluster: github-actions-deploy-task-def-integ-test
44+
# run-task: true
45+
# run-task-subnets: subnet-e5604fce, subnet-fe9355b4, subnet-c49431bc, subnet-392f9b64
46+
# run-task-assign-public-IP: ENABLED
47+
# run-task-security-groups: sg-067ebcde49c0f3ad8
48+
# run-task-launch-type: FARGATE
49+
# wait-for-task-stopped: true
50+
# enable-ecs-managed-tags: true
51+
52+
- name: Deploy Amazon ECS task definition with ECS Service
53+
uses: ./
54+
with:
55+
task-definition: test-resources/task-definition.json
56+
service: github-actions-deploy-task-def-integ-test
57+
cluster: github-actions-deploy-task-def-integ-test
58+
wait-for-service-stability: true
59+
enable-ecs-managed-tags: true

.mergify.yml

+19-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ queue_rules:
22
- name: default
33
conditions:
44
# Conditions to get out of the queue (= merged)
5+
- status-success=Run Integration Tests
56
- status-success=Run Unit Tests
67
- status-success=Semantic Pull Request
78
- status-success=Analyze (javascript)
@@ -13,6 +14,7 @@ pull_request_rules:
1314
- "#approved-reviews-by>=1"
1415
- approved-reviews-by=@aws-actions/aws-ecs-devx
1516
- -approved-reviews-by~=author
17+
- status-success=Run Integration Tests
1618
- status-success=Run Unit Tests
1719
- status-success=Semantic Pull Request
1820
- status-success=Analyze (javascript)
@@ -26,7 +28,7 @@ pull_request_rules:
2628
method: squash
2729
name: default
2830

29-
- name: Automatically approve and merge Dependabot PRs
31+
- name: Automatically approve Dependabot PRs
3032
conditions:
3133
- base=master
3234
- author=dependabot[bot]
@@ -40,6 +42,21 @@ pull_request_rules:
4042
actions:
4143
review:
4244
type: APPROVE
45+
46+
- name: Automatically merge Dependabot PRs
47+
conditions:
48+
- base=master
49+
- "#approved-reviews-by>=1"
50+
- author=dependabot[bot]
51+
- status-success=Run Integration Tests
52+
- status-success=Run Unit Tests
53+
- status-success=Semantic Pull Request
54+
- status-success=Analyze (javascript)
55+
- -title~=(WIP|wip)
56+
- -label~=(blocked|do-not-merge)
57+
- -merged
58+
- -closed
59+
actions:
4360
queue:
4461
method: squash
45-
name: default
62+
name: default
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"containerDefinitions": [
3+
{
4+
"entryPoint": [
5+
"sh",
6+
"-c"
7+
],
8+
"portMappings": [
9+
{
10+
"hostPort": 80,
11+
"protocol": "tcp",
12+
"containerPort": 80
13+
}
14+
],
15+
"command": [
16+
"/bin/sh -c \"echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p> </div></body></html>' > /usr/local/apache2/htdocs/index.html && httpd-foreground\""
17+
],
18+
"cpu": 256,
19+
"memoryReservation": 512,
20+
"image": "httpd:2.4",
21+
"essential": true,
22+
"name": "sample-app"
23+
}
24+
],
25+
"memory": "512",
26+
"family": "github-actions-deploy-task-def-integ-tests",
27+
"requiresCompatibilities": [
28+
"FARGATE"
29+
],
30+
"networkMode": "awsvpc",
31+
"cpu": "256"
32+
}

test-resources/task-definition.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"containerDefinitions": [
3+
{
4+
"memory": 32,
5+
"essential": true,
6+
"entryPoint": ["ping"],
7+
"name": "alpine_ping",
8+
"readonlyRootFilesystem": true,
9+
"image": "alpine:3.4",
10+
"command": [
11+
"-c",
12+
"4",
13+
"example.com"
14+
],
15+
"cpu": 16
16+
}
17+
],
18+
"memory": "512",
19+
"family": "github-actions-deploy-task-def-integ-tests-run-task",
20+
"requiresCompatibilities": [
21+
"FARGATE"
22+
],
23+
"networkMode": "awsvpc",
24+
"cpu": "256"
25+
}

0 commit comments

Comments
 (0)