From 203763e6861d436c714508bbcdd1bf64bf691a11 Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Thu, 10 Dec 2020 13:18:37 +0000 Subject: [PATCH] tests now also comes through docker to test it (#38) Co-authored-by: Ayrat Hudaygulov --- .github/workflows/dotnet-test.yml | 20 +++++++------------- .gitignore | 1 + Dockerfile | 10 +++++++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 0b124fc..47e4111 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -1,25 +1,19 @@ -name: .NET Core +name: Build & Test on: push: branches: [ master ] + paths-ignore: + - "**.md" pull_request: branches: [ master ] + paths-ignore: + - "**.md" jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.300 - - name: Restore tools - run: dotnet tool restore - - name: Build - run: dotnet build -c Release - - name: Test - run: dotnet test -c Release --no-restore --verbosity normal + - name: Build & Test + run: docker build . diff --git a/.gitignore b/.gitignore index dfd2a0c..0b9cf70 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ +out/ # Visual Studio 2015 cache/options directory .vs/ diff --git a/Dockerfile b/Dockerfile index e229f7c..e15e8cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-dotnet +FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build-dotnet WORKDIR /app # Copy csproj and restore as distinct layers COPY *.sln ./ @@ -7,16 +7,20 @@ COPY src/Grinder.Common/Grinder.Common.fsproj ./src/Grinder.Common/Grinder.Commo COPY src/Grinder.DataAccess/Grinder.DataAccess.csproj ./src/Grinder.DataAccess/Grinder.DataAccess.csproj COPY tests/Grinder.Tests/Grinder.Tests.fsproj ./tests/Grinder.Tests/Grinder.Tests.fsproj COPY src/Grinder.ExportTool/Grinder.ExportTool.fsproj ./src/Grinder.ExportTool/Grinder.ExportTool.fsproj -RUN dotnet restore +RUN dotnet tool restore +RUN dotnet restore -r linux-x64 # Then build app COPY src/Grinder/. ./src/Grinder COPY src/Grinder.Common/. ./src/Grinder.Common COPY src/Grinder.DataAccess/. ./src/Grinder.DataAccess WORKDIR /app/src/Grinder +# Build&Test +RUN dotnet test -c Release -r linux-x64 -o out --no-restore --verbosity normal +# Publish RUN dotnet publish -r linux-x64 -c Release -o out # Build runtime image -FROM mcr.microsoft.com/dotnet/core/runtime:3.1 +FROM mcr.microsoft.com/dotnet/runtime:3.1 EXPOSE 80