Skip to content

chore: Add end-to-end tests #684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Test Examples
run: dotnet test ../examples/
- name: Test & Code Coverage
run: dotnet test --collect:"XPlat Code Coverage" --results-directory ./codecov --verbosity normal
run: dotnet test --filter "Category!=E2E" --collect:"XPlat Code Coverage" --results-directory ./codecov --verbosity normal
- name: Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # 4.5.0
with:
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/e2e-infra-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# PROCESS
#
# 1. Deploy the core stack using AWS CDK.
# 2. Deploy the AOT stack using AWS CDK.

# USAGE
#
# This workflow is used by the E2E Tests workflow to deploy the necessary infrastructure.

name: E2E Tests Infra deployment

permissions:
id-token: write
contents: read

jobs:
deploy-core-stack:
runs-on: aws-powertools_ubuntu-latest_8-core
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
aws-region: ${{ secrets.E2E_DEPLOY_REGION }}

- name: Set up .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
with:
dotnet-version: '8.x'

- name: Install CDK
run: npm install -g aws-cdk

- name: Deploy Core Stack
run: |
cd libraries/tests/e2e/infra
cdk deploy --require-approval never

deploy-aot-stack:
runs-on: aws-powertools_ubuntu-latest_8-core
strategy:
matrix:
architecture: [ x86_64, arm64 ]
container:
image: public.ecr.aws/sam/build-dotnet8:latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
aws-region: ${{ secrets.E2E_DEPLOY_REGION }}

- name: Set up .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
with:
dotnet-version: '8.x'

- name: Install CDK
run: npm install -g aws-cdk

- name: Deploy AOT Stack
run: |
cd libraries/tests/e2e/infra-aot
cdk deploy --require-approval never
40 changes: 40 additions & 0 deletions .github/workflows/e2e-infra-destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# PROCESS
#
# 1. Destroy the core stack using AWS CDK.
# 2. Destroy the AOT stack using AWS CDK.

# USAGE
#
# This workflow is used by the E2E Tests workflow to destroy the infrastructure after tests are completed.

name: Destroy e2e CDK Stacks

permissions:
id-token: write
contents: read

jobs:
destroy-stacks:
runs-on: aws-powertools_ubuntu-latest_8-core
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
aws-region: ${{ secrets.E2E_DEPLOY_REGION }}

- name: Install CDK
run: npm install -g aws-cdk

- name: Destroy Core Stack
run: |
cd libraries/tests/e2e/infra
cdk destroy --force

- name: Destroy AOT Stack
run: |
cd libraries/tests/e2e/infra-aot
cdk destroy --force
54 changes: 54 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# PROCESS
#
# 1. Deploy the core and AOT stacks using the infra deployment workflow.
# 2. Run the E2E tests after the infrastructure is deployed.
# 3. Destroy the CDK stacks after the tests are completed.

# USAGE
#
# This workflow is triggered on push to the develop branch or manually via workflow_dispatch.

name: E2E Tests

on:
workflow_dispatch:
push:
branches:
- develop

permissions:
id-token: write
contents: read

jobs:
deploy-core-stack:
uses: ./.github/workflows/e2e-infra-deploy.yml

deploy-aot-stack:
uses: ./.github/workflows/e2e-infra-deploy.yml

run-tests:
runs-on: aws-powertools_ubuntu-latest_8-core
# needs: [deploy-core-stack, deploy-aot-stack]
needs: [deploy-core-stack]
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Set up .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
with:
dotnet-version: '8.x'

- name: Run Core Tests
run: |
cd libraries/tests/e2e/functions/core
dotnet test

- name: Destroy Core Stack
if: always()
uses: ./.github/workflows/e2e-infra-destroy.yml

# destroy-core-stack:
# needs: run-tests
# uses: ./.github/workflows/e2e-infra-destroy.yml
Loading
Loading