Test Pull Request - Quick README Edit #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR - Build / Test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v4.1.0 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Restore dependencies | |
| run: dotnet restore "${{github.workspace}}/src/my-web-app.sln" | |
| - name: Build | |
| run: dotnet build "${{github.workspace}}/src/my-web-app.sln" --no-restore --configuration Release | |
| - name: Test | |
| run: dotnet test "${{github.workspace}}/src/my-web-app.sln" --no-restore --logger:"junit;LogFilePath=${{ github.workspace }}/results/test-results.xml" | |
| # create a test summary markdown file | |
| # if you don't specify an output file, it will automatically add | |
| # as a job summary. If you specify an output file, you have to | |
| # create your own step of adding it to the job summary. I am | |
| # intentionally doing that to show job summaries | |
| - name: Create test summary | |
| uses: test-summary/action@v2.4 | |
| with: | |
| paths: ${{ github.workspace }}/results/*.xml | |
| output: ${{ github.workspace }}/results/summary.md | |
| show: "all" | |
| if: always() | |
| # I am adding the test results to the Job Summary | |
| - name: Add Test Results To Job Summary | |
| run: | | |
| echo "TEST RESULTS:" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line | |
| cat "${{ github.workspace }}/results/summary.md" >> $GITHUB_STEP_SUMMARY | |
| if: always() | |
| - name: Publish | |
| run: dotnet publish "${{github.workspace}}/src/my-web-app/my-web-app.csproj" -c Release -o mywebapp | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: myapp | |
| path: mywebapp/** | |
| if-no-files-found: error |