diff --git a/.github/workflows/publish-test-results.yml b/.github/workflows/publish-test-results.yml new file mode 100644 index 000000000..4d51f3bee --- /dev/null +++ b/.github/workflows/publish-test-results.yml @@ -0,0 +1,38 @@ + +name: Annotate test results + +on: + workflow_run: + workflows: + - "CI" + +jobs: + test-results: + runs-on: ubuntu-latest + name: Test results + if: github.event.workflow_run.conclusion != 'skipped' + + steps: + - name: Download and Extract Artifacts + #env: + #GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + run: | + mkdir -p artifacts && cd artifacts + + artifacts_url=${{ github.event.workflow_run.artifacts_url }} + + gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact + do + IFS=$'\t' read name url <<< "$artifact" + gh api $url > "$name.zip" + unzip -d "$name" "$name.zip" + done + + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + with: + commit: ${{ github.event.workflow_run.head_sha }} + event_file: artifacts/Event File/event.json + event_name: ${{ github.event.workflow_run.event }} + files: "artifacts/Junit test log files*/*.xml" + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f1a4f9904..2461e1b8e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ -name: CI-tests +name: CI on: push: @@ -262,30 +262,15 @@ jobs: name: cookbook-appstore path: /tmp/appstore.tar.gz - - annotate-test-results: - name: Annotate the test results - needs: - - unit-tests + event_file: + name: "Upload Event File" runs-on: ubuntu-latest - if: success() || failure() - steps: - - name: Download artifact - uses: actions/download-artifact@v2 - #with: - #name: Junit test log files - #path: . - - name: List files - shell: bash - run: ls -lR - #if: always() - - name: Publish Unit Test Results - uses: EnricoMi/publish-unit-test-result-action@v1.19 - with: - files: "Junit test log files*/*.xml" - test_changes_limit: 100 - #if: always() - + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: Event File + path: ${{ github.event_path }} + retention-days: 1 + - diff --git a/CHANGELOG.md b/CHANGELOG.md index bc4c01653..1f39ebdf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ [#809](https://github.com/nextcloud/cookbook/pull/809) @christianlupus - Update stylelint-config-prettier [#807](https://github.com/nextcloud/cookbook/pull/807) @christianlupus +- Correct unit testing for dependabot and forked branches + [#811](https://github.com/nextcloud/cookbook/pull/811) @christianlupus ## 0.9.4 - 2021-09-29