File: unit-tests.yml

package info (click to toggle)
eclipse-equinox 4.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 28,400 kB
  • sloc: java: 214,632; xml: 6,108; ansic: 5,780; sh: 227; cpp: 63; makefile: 14
file content (124 lines) | stat: -rw-r--r-- 6,067 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Publish Unit Test Results

on:
  workflow_run:
    workflows: ["Build Equinox"]
    types:
      - completed

permissions: {}

jobs:
  unit-test-results:
    name: Unit Test Results
    runs-on: ubuntu-latest
    if: github.event.workflow_run.conclusion != 'skipped'
    permissions:
      checks: write
      pull-requests: write
      actions: read
    steps:
      - name: Download and Extract Unit Test Results
        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@v2
        with:
          commit:      ${{ github.event.workflow_run.head_sha }}
          junit_files: "artifacts/**/*-reports/*.xml"
          event_name:  ${{ github.event.workflow_run.event }}
          event_file:  artifacts/Event File/event.json
  tck-results:
    name: TCK Test Results for ${{ matrix.tck.name }}
    runs-on: ubuntu-latest
    if: github.event.workflow_run.conclusion != 'skipped'
    permissions:
      checks: write
      pull-requests: write
      actions: read
    strategy:
      fail-fast: false
      matrix:
        tck: 
          - { name: framework,   chapter:  '10', label: 'Framework',           suffix: ' API',                   pattern: "TEST-org.osgi.test.cases.framework-*.xml" }
          - { name: url,         chapter:  '52', label: 'URL Handlers',        suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.url-*.xml" }
          - { name: resolver,    chapter:  '59', label: 'Resolver',            suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.resolver-*.xml" }
          - { name: log,         chapter: '101', label: 'Log',                 suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.log-*.xml" }
          - { name: device,      chapter: '103', label: 'Device Access',       suffix: ' Specification',         pattern: "TEST-org.osgi.test.cases.device-*.xml" }
          - { name: cm,          chapter: '104', label: 'Configuration Admin', suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.cm-*.xml"}
          - { name: metatype,    chapter: '105', label: 'Metatype',            suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.metatype-*.xml" }
          - { name: preferences, chapter: '106', label: 'Preferences',         suffix: 'Service Specification',  pattern: "TEST-org.osgi.test.cases.prefs-*.xml" }
          - { name: useradmin,   chapter: '107', label: 'User Admin',          suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.useradmin-*.xml" }
          - { name: event,       chapter: '113', label: 'Event Admin',         suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.event-*.xml" }
          - { name: coordinator, chapter: '130', label: 'Coordinator',         suffix: ' Service Specification', pattern: "TEST-org.osgi.test.cases.coordinator-*.xml" }
          - { name: tracker,     chapter: '701', label: 'Tracker',             suffix: ' Specification',         pattern: "TEST-org.osgi.test.cases.tracker-*.xml" }
          
    steps:  
      - name: Download and Extract Unit Test Results
        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: Parse TCK Results of ${{ matrix.tck.name }}
        uses: EnricoMi/publish-unit-test-result-action@v2
        id: test-results
        if: always()
        with:
          commit:       ${{ github.event.workflow_run.head_sha }}
          junit_files:  artifacts/**/tck-results/${{ matrix.tck.pattern }}
          comment_mode: off
          check_name:   ${{ matrix.tck.label }} TCK
          event_name:   ${{ github.event.workflow_run.event }}
          event_file:   artifacts/Event File/event.json
      - name: Set badge color of ${{ matrix.tck.name }}
        shell: bash
        run: |
           case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
           success)
           echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
           ;;
           failure)
           echo "BADGE_COLOR=800000" >> $GITHUB_ENV
           ;;
           neutral)
           echo "BADGE_COLOR=696969" >> $GITHUB_ENV
           ;;
           esac
      - name: Create badge of ${{ matrix.tck.name }}
        uses: emibcn/badge-action@4209421db54c8764d8932070ffd0f81715a629bf
        with:
          # label: ${{ matrix.tck.chapter }} - ${{ matrix.tck.label }} ${{ matrix.tck.suffix }}
          label:  '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests'
          status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_succ }} passed, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_fail }} failed'
          color: ${{ env.BADGE_COLOR }}
          path: tck-badge-${{ matrix.tck.name }}.svg
      - name: Upload badge of ${{ matrix.tck.name }} to Gist
        if: github.ref == 'refs/heads/master'
        uses: andymckay/append-gist-action@6e8d64427fe47cbacf4ab6b890411f1d67c07f3e
        with:
          token: ${{ secrets.GIST_TOKEN }}
          gistURL: https://gist.github.com/eclipse-equinox-bot/d941fe2a4992a018d88e778b48ee3135
          file: tck-badge-${{ matrix.tck.name }}.svg