-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
73 lines (69 loc) · 2.75 KB
/
action.yml
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
name: Run mocha through yarn and upload report
description: |
Run a yarn task expecting mocha reports and coverage data to be produced. The reports will follow naming conventions
detailed by our ADRs (https://confluence.equisoft.com/display/HRMI/ADR).
Report named `build/mocha/junit.xml` with `build/mocha/coverage/clover.xml` are expected under all circumstances.
Errors will be annotated on pull requests.
inputs:
enable-annotations:
description: |
Annotate files with mocha errors, in which case a `build/mocha/junit.xml` file is expected.
This is the default behavior for projects that branched off webapp-boilerplate.
Defaults to `true`.
required: true
default: "true"
report-name:
description: The name of the result report. It must follow the convention detailed by our ADRs.
required: true
default: typescript-test-results.junit.xml
coverage-report-name:
description: The name of the coverage report. It must follow the convention detailed by our ADRs.
required: true
default: typescript-test-coverage.clover.xml
report-retention-days:
description: Duration in days to preserve reports. Defaults to 5.
required: true
default: "5"
task-name:
description: The task name. Defaults to "eslint:ci".
required: true
default: test:ci
working-directory:
description: Relative path under $GITHUB_WORKSPACE where the project is located.
required: false
default: "."
runs:
using: composite
steps:
- name: Action context
shell: bash
id: context
run: |
echo "working-directory=$(realpath ${{ inputs.working-directory }})" >> $GITHUB_OUTPUT
- name: Run Jest
shell: bash
working-directory: ${{ steps.context.outputs.working-directory }}
run: yarn ${{ inputs.task-name }}
- name: Upload report
uses: actions/upload-artifact@v4
if: "!cancelled()"
with:
name: ${{ inputs.report-name }}
retention-days: ${{ inputs.report-retention-days }}
if-no-files-found: error
path: ${{ steps.context.outputs.working-directory }}/build/mocha/junit.xml
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: "!cancelled()"
with:
name: ${{ inputs.coverage-report-name }}
retention-days: ${{ inputs.report-retention-days }}
if-no-files-found: error
path: ${{ steps.context.outputs.working-directory }}/build/mocha/coverage/clover.xml
- name: Create annotations
uses: mikepenz/action-junit-report@v5
if: "!cancelled() && inputs.enable-annotations == 'true' && github.actor != 'dependabot[bot]'"
with:
check_name: Mocha Report Analysis
report_paths: |
${{ inputs.working-directory }}/build/mocha/junit.xml