Fix unit tests #120
This file contains 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Deploy Application | |
on: | |
push: | |
branches: [main] | |
paths: | |
- cdk/src/StockPriceService/** | |
- src/StockTraderAPI/** | |
- tests/** | |
- .github/workflows/deploy-service.yml | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v2 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.x | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
npm install -g aws-cdk | |
dotnet tool install -g Amazon.Lambda.Tools | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Unit tests | |
run: | | |
dotnet test ./tests/Stocks.UnitTests/Stocks.UnitTests.csproj | |
- name: Deploy Dev Test Infrastructure | |
run: | | |
export STACK_POSTFIX=Dev | |
cdk deploy StockTestInfrastructureDev --require-approval=never --app "dotnet run --project cdk/src/StockPriceService/StockPriceService.csproj" | |
- name: Deploy to AWS | |
run: | | |
export STACK_POSTFIX=Dev | |
cdk deploy StockPriceStackDev --require-approval=never --app "dotnet run --project cdk/src/StockPriceService/StockPriceService.csproj" | |
- name: Integration tests | |
run: | | |
export STACK_POSTFIX=Dev | |
dotnet test ./tests/Stocks.IntegrationTests/Stocks.IntegrationTests.csproj | |
- name: Functional tests | |
env: | |
TEMPORARY_PASSWORD: ${{ secrets.TEMPORARY_PASSWORD }} | |
run: | | |
export STACK_POSTFIX=Dev | |
dotnet test ./tests/Stocks.FunctionalTests/Stocks.FunctionalTests.csproj | |
- name: Tear Down Dev Test Infrastructure | |
run: | | |
export STACK_POSTFIX=Dev | |
cdk destroy StockTestInfrastructureDev --require-approval=never --app "dotnet run --project cdk/src/StockPriceService/StockPriceService.csproj" | |
- name: Deploy Prod Test Infrastructure | |
run: | | |
export STACK_POSTFIX=Prod | |
cdk deploy StockTestInfrastructureProd --require-approval=never --app "dotnet run --project cdk/src/StockPriceService/StockPriceService.csproj" | |
- name: Deploy to AWS Production | |
run: | | |
export STACK_POSTFIX=Prod | |
cdk deploy StockPriceStackProd --require-approval=never --app "dotnet run --project cdk/src/StockPriceService/StockPriceService.csproj" | |
- name: Functional tests prod | |
env: | |
TEMPORARY_PASSWORD: ${{ secrets.TEMPORARY_PASSWORD }} | |
run: | | |
export STACK_POSTFIX=Prod | |
dotnet test ./tests/Stocks.FunctionalTests/Stocks.FunctionalTests.csproj | |
- name: Tear Down Prod Test Infrastructure | |
run: | | |
export STACK_POSTFIX=Prod | |
cdk destroy StockTestInfrastructureProd --require-approval=never --app "dotnet run --project cdk/src/StockPriceService/StockPriceService.csproj" |