Skip to content

Commit 9e1ef41

Browse files
authored
Merge pull request #684 from hjgraca/feature/e2etests
chore: Add end-to-end tests
2 parents b32961e + 0c4721b commit 9e1ef41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2968
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Test Examples
3131
run: dotnet test ../examples/
3232
- name: Test & Code Coverage
33-
run: dotnet test --collect:"XPlat Code Coverage" --results-directory ./codecov --verbosity normal
33+
run: dotnet test --filter "Category!=E2E" --collect:"XPlat Code Coverage" --results-directory ./codecov --verbosity normal
3434
- name: Codecov
3535
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # 4.5.0
3636
with:
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# PROCESS
2+
#
3+
# 1. Deploy the core stack using AWS CDK.
4+
# 2. Deploy the AOT stack using AWS CDK.
5+
6+
# USAGE
7+
#
8+
# This workflow is used by the E2E Tests workflow to deploy the necessary infrastructure.
9+
10+
name: E2E Tests Infra deployment
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
deploy-core-stack:
18+
runs-on: aws-powertools_ubuntu-latest_8-core
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
22+
23+
- name: Configure AWS credentials
24+
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
25+
with:
26+
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
27+
aws-region: ${{ secrets.E2E_DEPLOY_REGION }}
28+
29+
- name: Set up .NET
30+
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
31+
with:
32+
dotnet-version: '8.x'
33+
34+
- name: Install CDK
35+
run: npm install -g aws-cdk
36+
37+
- name: Deploy Core Stack
38+
run: |
39+
cd libraries/tests/e2e/infra
40+
cdk deploy --require-approval never
41+
42+
deploy-aot-stack:
43+
runs-on: aws-powertools_ubuntu-latest_8-core
44+
strategy:
45+
matrix:
46+
architecture: [ x86_64, arm64 ]
47+
container:
48+
image: public.ecr.aws/sam/build-dotnet8:latest
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
52+
53+
- name: Configure AWS credentials
54+
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
55+
with:
56+
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
57+
aws-region: ${{ secrets.E2E_DEPLOY_REGION }}
58+
59+
- name: Set up .NET
60+
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
61+
with:
62+
dotnet-version: '8.x'
63+
64+
- name: Install CDK
65+
run: npm install -g aws-cdk
66+
67+
- name: Deploy AOT Stack
68+
run: |
69+
cd libraries/tests/e2e/infra-aot
70+
cdk deploy --require-approval never
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PROCESS
2+
#
3+
# 1. Destroy the core stack using AWS CDK.
4+
# 2. Destroy the AOT stack using AWS CDK.
5+
6+
# USAGE
7+
#
8+
# This workflow is used by the E2E Tests workflow to destroy the infrastructure after tests are completed.
9+
10+
name: Destroy e2e CDK Stacks
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
destroy-stacks:
18+
runs-on: aws-powertools_ubuntu-latest_8-core
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
22+
23+
- name: Configure AWS credentials
24+
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
25+
with:
26+
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
27+
aws-region: ${{ secrets.E2E_DEPLOY_REGION }}
28+
29+
- name: Install CDK
30+
run: npm install -g aws-cdk
31+
32+
- name: Destroy Core Stack
33+
run: |
34+
cd libraries/tests/e2e/infra
35+
cdk destroy --force
36+
37+
- name: Destroy AOT Stack
38+
run: |
39+
cd libraries/tests/e2e/infra-aot
40+
cdk destroy --force

.github/workflows/e2e-tests.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# PROCESS
2+
#
3+
# 1. Deploy the core and AOT stacks using the infra deployment workflow.
4+
# 2. Run the E2E tests after the infrastructure is deployed.
5+
# 3. Destroy the CDK stacks after the tests are completed.
6+
7+
# USAGE
8+
#
9+
# This workflow is triggered on push to the develop branch or manually via workflow_dispatch.
10+
11+
name: E2E Tests
12+
13+
on:
14+
workflow_dispatch:
15+
push:
16+
branches:
17+
- develop
18+
19+
permissions:
20+
id-token: write
21+
contents: read
22+
23+
jobs:
24+
deploy-core-stack:
25+
uses: ./.github/workflows/e2e-infra-deploy.yml
26+
27+
deploy-aot-stack:
28+
uses: ./.github/workflows/e2e-infra-deploy.yml
29+
30+
run-tests:
31+
runs-on: aws-powertools_ubuntu-latest_8-core
32+
# needs: [deploy-core-stack, deploy-aot-stack]
33+
needs: [deploy-core-stack]
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
37+
38+
- name: Set up .NET
39+
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
40+
with:
41+
dotnet-version: '8.x'
42+
43+
- name: Run Core Tests
44+
run: |
45+
cd libraries/tests/e2e/functions/core
46+
dotnet test
47+
48+
- name: Destroy Core Stack
49+
if: always()
50+
uses: ./.github/workflows/e2e-infra-destroy.yml
51+
52+
# destroy-core-stack:
53+
# needs: run-tests
54+
# uses: ./.github/workflows/e2e-infra-destroy.yml

0 commit comments

Comments
 (0)