From d79d9e31b4f986ee18f538836c31be71602060f0 Mon Sep 17 00:00:00 2001 From: s2quake Date: Sat, 15 Jun 2024 20:21:20 +0900 Subject: [PATCH] ci: Add test report action. --- .github/workflows/build-and-test.yml | 11 ++++------- .github/workflows/test-report.yml | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c35b886..07c0b3d 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,9 +1,6 @@ name: Build and Test on: - push: - branches: - - main pull_request: jobs: @@ -11,16 +8,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4.1.7 - - name: Setup .NET Core - uses: actions/setup-dotnet@v4.0.0 + - uses: actions/setup-dotnet@v4.0.0 with: dotnet-version: 8.0.100 - run: dotnet build --configuration Release - run: | dotnet test --configuration Release --no-restore --no-build \ - --logger "trx;LogFileName=$(PWD)/logs/test-results.trx" + --logger "trx;LogFileName=${{ github.workspace }}/logs/test-results.trx" + - run: echo "PWD=$(pwd)" >> $GITHUB_ENV - uses: actions/upload-artifact@v4 # upload test results if: success() || failure() # run this step even if previous step failed with: name: test-results - path: $(PWD)/logs/test-results.trx + path: ${{ github.workspace }}/logs/test-results.trx diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 0000000..5f8b8d5 --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,22 @@ +name: Test Report +on: + pull_request: + workflow_run: + workflows: [Build and Test] + types: [completed] + +permissions: + contents: read + actions: read + checks: write + +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: dorny/test-reporter@v1.9.1 + with: + artifact: test-results + name: XUnit Tests + path: test-results.trx + reporter: dotnet-trx \ No newline at end of file