Skip to content

Commit

Permalink
Add coverage collection to docker build (#7)
Browse files Browse the repository at this point in the history
Added coverage collection and codecov
  • Loading branch information
goelhardik authored Dec 23, 2020
1 parent 2714b74 commit 1c84f73
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

jobs:
CI:
NuGetPack:

runs-on: windows-latest

Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ on:
branches: [ main ]

jobs:
PR:
Build:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Build and test
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
docker build -t ignore/app:latest .
mkdir ${{ github.workspace }}/coverage
docker run -v "${{ github.workspace }}/coverage":"/coverage/" ignore/app:latest
bash <(curl -s https://codecov.io/bash)
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic AS builder

RUN useradd -m dotnet
USER dotnet
COPY . /app/

COPY --chown=dotnet . /app/
WORKDIR /app

ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
Expand All @@ -12,4 +10,4 @@ RUN dotnet restore

RUN dotnet build --configuration Release --no-restore

RUN dotnet test --configuration Release --no-build --verbosity normal
ENTRYPOINT exec dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" -r /coverage

0 comments on commit 1c84f73

Please sign in to comment.