ashley-taylor / junit-report-annotations-action

Create an annotation of the build information and also list first n failed tests as seporate annotations
12 stars 29 forks source link

Junit Report data is lost when multiple workflow run with this action #21

Open orestesgaolin opened 4 years ago

orestesgaolin commented 4 years ago

I have multiple workflows configured for PRs, each can be triggered depending on the files changed in the PR.

Unfortunately the Junit Results annotations are present only in the first workflow and they are not visible in any other. All of them have very similar workflow files (with slight changes to paths) image

The results are shown correctly if there's only 1 workflow triggered that contains junit-report-annotations-action

Sample workflow.yaml:

name: user_repository

on:
  pull_request:
    paths:
      - "packages/user_repository/**"
      - ".github/workflows/user_repository.yaml"

jobs:
  build:
    defaults:
      run:
        working-directory: packages/user_repository

    runs-on: ubuntu-latest

    container:
      image: google/dart:2.8.4

    steps:
      - uses: actions/checkout@v2

      - name: Install Dependencies
        run: pub get

      - name: Format
        run: dartfmt --dry-run --set-exit-if-changed .

      - name: Analyze
        run: dartanalyzer --fatal-infos --fatal-warnings lib test

      - name: Check TODOs
        run: ../../tool/check_todos.sh .

      - name: Run tests
        run: pub run test --reporter json > test.log

      - name: Convert to junit
        run: |
          pub global activate junitreport
          export PATH="$PATH":"$HOME/.pub-cache/bin"
          cat test.log
          cat test.log | tojunit > TEST.xml
        if: always()

      - uses: ashley-taylor/junit-report-annotations-action@master
        with:
          access-token: ${{ secrets.GITHUB_TOKEN }}
          path: "**/TEST.xml"
          includeSummary: true
        if: always()

      - name: Run tests with coverage
        run: pub run test_coverage

      - name: Publish Coverage
        shell: bash
        run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}

      - name: Check Code Coverage
        uses: ChicagoFlutter/lcov-cop@v1.0.0
        with:
          path: packages/user_repository/coverage/lcov.info

I can share more info via DM/Slack/email

TurpIF commented 4 years ago

Hello,

I believe that you can override the name of those report by using the name parameter (see https://github.com/ashley-taylor/junit-report-annotations-action/blob/9ac2f823854c677f30e062dfe779445e33e5d380/action.yml#L22).

Although, this could be automatically handled by:

I don't know if merging or getting job name are technically possible. And I personally think that auto incrementing is not a solution, as the outcome would not be usable.

@ashley-taylor do you have any thoughts on this ?

Your issue shows another: the readme does not help integration and I believe that improving the readme could bring a lot to this project.

orestesgaolin commented 4 years ago

I wonder if the action could get the current check id?

Here they are using only current sha.

Here they are using check id