Skip to content

Commit

Permalink
Merge pull request #811 from nextcloud/fix/test-reporter
Browse files Browse the repository at this point in the history
Added corrected config for unit and integration test reporting
  • Loading branch information
christianlupus authored Oct 15, 2021
2 parents aeece73 + 2f75f4f commit 0569716
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 25 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish-test-results.yml
Original file line number Diff line number Diff line change
@@ -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"

35 changes: 10 additions & 25 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: CI-tests
name: CI

on:
push:
Expand Down Expand Up @@ -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



2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0569716

Please sign in to comment.