From 47ca5681f967430cd62839ea355d90bfc58e3c24 Mon Sep 17 00:00:00 2001 From: Colin Dembovsky Date: Thu, 15 Apr 2021 10:50:10 -0500 Subject: [PATCH] Adding workflow_dispatch and unit tests --- .github/workflows/catalog-api.yml | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/catalog-api.yml b/.github/workflows/catalog-api.yml index ca05a56ea..9c39165ef 100644 --- a/.github/workflows/catalog-api.yml +++ b/.github/workflows/catalog-api.yml @@ -1,6 +1,7 @@ name: catalog-api on: + workflow_dispatch: push: branches: - dev @@ -21,6 +22,7 @@ on: env: SERVICE: catalog-api IMAGE: catalog.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/Catalog/Catalog.API + dotnet build --no-restore + cd - + cd Services/Catalog/Catalog.UnitTests + dotnet test - name: Compose build ${{ env.SERVICE }} run: sudo -E docker-compose build ${{ env.SERVICE }} @@ -46,6 +63,21 @@ jobs: - 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/Catalog/Catalog.API + dotnet build --no-restore + cd - + cd Services/Catalog/Catalog.UnitTests + dotnet test + - name: Enable experimental features for the Docker daemon and CLI run: | echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json