Skip to content

Update 08-call-reusable.yml #2

Update 08-call-reusable.yml

Update 08-call-reusable.yml #2

name: Demo 6 - Pull Request
on:
pull_request:
branches:
- main
jobs:
build-test-branch:
name: "Build and Test Of PR"
runs-on: ubuntu-latest
steps:
#- name: Make PR Fail
# run: exit 1
- uses: actions/checkout@v2
- name: Setup .NET Core 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Install dependencies
run: dotnet restore "${{ github.workspace }}/mywebapp/mywebapp.sln"
- name: Build
run: dotnet build "${{ github.workspace }}/mywebapp/mywebapp.sln" --configuration Release --no-restore
- name: Test
run: |
dotnet test "${{ github.workspace }}/mywebapp/mywebapp.sln" --no-restore --verbosity normal --logger "trx;LogFileName=test-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1.5.0
if: success() || failure() # run this step even if previous step failed
with:
name: XUnit Tests # Name of the check run which will be created
path: ${{ github.workspace }}/mywebapp/tests/TestResults/*.trx # Path to test results
reporter: dotnet-trx
- name: Publish
run: |
dotnet publish "${{ github.workspace }}/mywebapp/src/mywebapp.csproj" -c Release -o mywebapp
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.0
with:
# Artifact name
name: mywebappbuildartifacts
# A file, directory or wildcard pattern that describes what to upload
path: mywebapp/**
# The desired behavior if no files are found using the provided path.
if-no-files-found: error
# Duration after which artifact will expire in days. 0 means using default retention.
retention-days: 90