From 17dc8efb534475e6de390fd75dc653706ff6cfe4 Mon Sep 17 00:00:00 2001 From: Colin Dembovsky Date: Thu, 15 Apr 2021 10:50:19 -0500 Subject: [PATCH] Adding unit tests --- .github/workflows/basket-api.yml | 17 +++++++++++++++- .github/workflows/ordering-api.yml | 32 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/basket-api.yml b/.github/workflows/basket-api.yml index 1d6ca60e7..dadd47467 100644 --- a/.github/workflows/basket-api.yml +++ b/.github/workflows/basket-api.yml @@ -32,7 +32,22 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master - + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" + cd Services/Basket/Basket.API + dotnet build --no-restore + cd - + cd Services/Basket/Basket.UnitTests + dotnet test + - name: Compose build ${{ env.SERVICE }} run: sudo -E docker-compose build ${{ env.SERVICE }} working-directory: ./src diff --git a/.github/workflows/ordering-api.yml b/.github/workflows/ordering-api.yml index 5adec0760..afaf99152 100644 --- a/.github/workflows/ordering-api.yml +++ b/.github/workflows/ordering-api.yml @@ -1,6 +1,7 @@ name: ordering-api on: + workflow_dispatch: push: branches: - dev @@ -21,6 +22,7 @@ on: env: SERVICE: ordering-api IMAGE: ordering.api + DOTNET_VERSION: 5.0.x jobs: @@ -30,6 +32,21 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" + cd Services/Ordering/Ordering.API + dotnet build --no-restore + cd - + cd Services/Ordering/Ordering.UnitTests + dotnet test - name: Compose build ${{ env.SERVICE }} run: sudo -E docker-compose build ${{ env.SERVICE }} @@ -45,6 +62,21 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Build and run unit tests + run: | + cd src + dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" + cd Services/Ordering/Ordering.API + dotnet build --no-restore + cd - + cd Services/Ordering/Ordering.UnitTests + dotnet test - name: Enable experimental features for the Docker daemon and CLI run: |