Skip to content

Commit 5d9e01d

Browse files
committed
feat: initial commit of action
1 parent 2a34a61 commit 5d9e01d

33 files changed

+60065
-20
lines changed

.devcontainer/devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "GitHub Actions (TypeScript)",
3+
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
4+
"postCreateCommand": "npm install",
5+
"customizations": {
6+
"codespaces": {
7+
"openFiles": ["README.md"]
8+
},
9+
"vscode": {
10+
"extensions": [
11+
"bierner.markdown-preview-github-styles",
12+
"davidanson.vscode-markdownlint",
13+
"dbaeumer.vscode-eslint",
14+
"esbenp.prettier-vscode",
15+
"github.copilot",
16+
"github.copilot-chat",
17+
"github.vscode-github-actions",
18+
"github.vscode-pull-request-github",
19+
"me-dutour-mathieu.vscode-github-actions",
20+
"redhat.vscode-yaml",
21+
"rvest.vs-code-prettier-eslint",
22+
"yzhang.markdown-all-in-one"
23+
],
24+
"settings": {
25+
"editor.defaultFormatter": "esbenp.prettier-vscode",
26+
"editor.tabSize": 2,
27+
"editor.formatOnSave": true,
28+
"markdown.extension.list.indentationSize": "adaptive",
29+
"markdown.extension.italic.indicator": "_",
30+
"markdown.extension.orderedList.marker": "one"
31+
}
32+
}
33+
},
34+
"remoteEnv": {
35+
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
36+
},
37+
"features": {
38+
"ghcr.io/devcontainers/features/github-cli:1": {},
39+
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
40+
}
41+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/workflows/action.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: 'action'
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
test-action:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
24+
- name: Run Test Reports Action Locally
25+
id: test-action
26+
uses: ./
27+
with:
28+
ctrf-report-path: './ctrf-reports/ctrf-report.json'
29+
template-path: './templates/custom-summary.hbs'
30+
summary-report: true
31+
failed-report: true
32+
flaky-report: true
33+
flaky-rate-report: true
34+
fail-rate-report: true
35+
previous-results-report: true
36+
ai-report: true
37+
failed-folded-report: false
38+
suite-folded-report: true
39+
suite-list-report: true
40+
# custom-report: true # Enable if using a custom template
41+
42+
# Behavior Options
43+
# title: 'My Custom Tests'
44+
# use-suite-name: true
45+
# pull-request: true
46+
# previous-results-max: 10
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Print Output Summary
51+
run: echo "${{ steps.test-action.outputs.summary }}"
52+
53+
- name: Upload Test Results
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ctrf-report
57+
path: ctrf-reports/ctrf-report.json
58+
if: always()

.gitignore

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,108 @@
1-
dist
21
node_modules
32
./ctrf
43
/ctrf
54
/coverage
5+
6+
# Dependency directory
7+
node_modules
8+
9+
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
10+
# Logs
11+
logs
12+
*.log
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
lerna-debug.log*
17+
18+
# Diagnostic reports (https://nodejs.org/api/report.html)
19+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
20+
21+
# Runtime data
22+
pids
23+
*.pid
24+
*.seed
25+
*.pid.lock
26+
27+
# Directory for instrumented libs generated by jscoverage/JSCover
28+
lib-cov
29+
30+
# Coverage directory used by tools like istanbul
31+
coverage
32+
*.lcov
33+
34+
# nyc test coverage
35+
.nyc_output
36+
37+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
38+
.grunt
39+
40+
# Bower dependency directory (https://bower.io/)
41+
bower_components
42+
43+
# node-waf configuration
44+
.lock-wscript
45+
46+
# Compiled binary addons (https://nodejs.org/api/addons.html)
47+
build/Release
48+
49+
# Dependency directories
50+
jspm_packages/
51+
52+
# TypeScript v1 declaration files
53+
typings/
54+
55+
# TypeScript cache
56+
*.tsbuildinfo
57+
58+
# Optional npm cache directory
59+
.npm
60+
61+
# Optional eslint cache
62+
.eslintcache
63+
64+
# Optional REPL history
65+
.node_repl_history
66+
67+
# Output of 'npm pack'
68+
*.tgz
69+
70+
# Yarn Integrity file
71+
.yarn-integrity
72+
73+
# dotenv environment variables file
74+
.env
75+
.env.test
76+
77+
# parcel-bundler cache (https://parceljs.org/)
78+
.cache
79+
80+
# next.js build output
81+
.next
82+
83+
# nuxt.js build output
84+
.nuxt
85+
86+
# vuepress build output
87+
.vuepress/dist
88+
89+
# Serverless directories
90+
.serverless/
91+
92+
# FuseBox cache
93+
.fusebox/
94+
95+
# DynamoDB Local files
96+
.dynamodb/
97+
98+
# OS metadata
99+
.DS_Store
100+
Thumbs.db
101+
102+
# Ignore built ts files
103+
__tests__/runner/*
104+
105+
# IDE files
106+
.idea
107+
.vscode
108+
*.code-workspace

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
21.6.2

action.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: 'tbc'
2+
description:
3+
'A GitHub Action to build test reports and publish to job summaries and pull
4+
requests.'
5+
author: 'ctrf-io'
6+
7+
branding:
8+
icon: 'file'
9+
color: 'blue'
10+
11+
inputs:
12+
# Core Configuration
13+
report-path:
14+
description: 'Path to the CTRF report JSON file.'
15+
required: true
16+
template-path:
17+
description:
18+
'Path to the Handlebars template for customizing markdown output.'
19+
required: false
20+
title:
21+
description:
22+
'Title to display in the GitHub Actions summary or pull request comment.'
23+
required: false
24+
25+
# Report Options
26+
summary-report:
27+
description: 'Include the summary report.'
28+
required: false
29+
default: false
30+
test-report:
31+
description: 'Include the tests table report.'
32+
required: false
33+
default: false
34+
test-list-report:
35+
description: 'Include the tests list report.'
36+
required: false
37+
default: false
38+
failed-report:
39+
description: 'Include the failed tests report.'
40+
required: false
41+
default: false
42+
fail-rate-report:
43+
description: 'Include the fail rate report.'
44+
required: false
45+
default: false
46+
flaky-report:
47+
description: 'Include the flaky tests report.'
48+
required: false
49+
default: false
50+
flaky-rate-report:
51+
description: 'Include the flaky rate report.'
52+
required: false
53+
default: false
54+
failed-folded-report:
55+
description: 'Include the failed folded report.'
56+
required: false
57+
default: false
58+
previous-results-report:
59+
description: 'Include the previous results report.'
60+
required: false
61+
default: false
62+
ai-report:
63+
description: 'Include the AI analysis report.'
64+
required: false
65+
default: false
66+
skipped-report:
67+
description: 'Include the skipped report.'
68+
required: false
69+
default: false
70+
suite-folded-report:
71+
description: 'Include the suite folded report.'
72+
required: false
73+
default: false
74+
suite-list-report:
75+
description: 'Include the suite list report.'
76+
required: false
77+
default: false
78+
pull-request-report:
79+
description: 'Include the pull request report.'
80+
required: false
81+
default: false
82+
custom-report:
83+
description: >
84+
Include a custom report using a Handlebars template. To group tests in the
85+
custom report, use the 'group-by' or 'always-group-by' input.
86+
required: false
87+
default: false
88+
89+
# Behavior Options
90+
summary:
91+
description: 'Post generated markdown to the GitHub Actions summary.'
92+
required: false
93+
default: true
94+
pull-request:
95+
description: 'Add a comment to the pull request with the generated report.'
96+
required: false
97+
default: false
98+
annotate:
99+
description: 'Add annotations to failed tests in the GitHub Actions UI.'
100+
required: false
101+
default: true
102+
on-fail-only:
103+
description: 'Add a pull request comment only if tests fail.'
104+
required: false
105+
default: false
106+
exit-on-fail:
107+
description: 'Exit the workflow with a failure status if any tests fail.'
108+
required: false
109+
default: false
110+
use-suite-name:
111+
description: 'Prefix test names with the suite name for better grouping.'
112+
required: false
113+
default: false
114+
updateComment:
115+
description: 'Update existing Pull Request comment.'
116+
required: false
117+
default: false
118+
overwriteComment:
119+
description: 'Overwrite existing Pull Request comment.'
120+
required: false
121+
default: false
122+
commentTag:
123+
description: 'Tag to match Pull Request comment'
124+
required: false
125+
default: false
126+
127+
# Advanced Options
128+
artifact-name:
129+
description: 'Name of the artifact containing test reports.'
130+
required: false
131+
default: 'ctrf-report'
132+
previous-results-max:
133+
description:
134+
'Maximum number of previous test results to display in the report.'
135+
required: false
136+
default: 10
137+
fetch-previous-results:
138+
description:
139+
'Always fetch previous workflow runs when using custom templates.'
140+
required: false
141+
default: false
142+
group-by:
143+
description: >
144+
Specify grouping for applicable reports (e.g., suite or file path).
145+
Options: - 'suite': Group tests by their suite property. - 'filePath':
146+
Group tests by their file path. Default is 'filePath'. Use this for
147+
built-in or custom reports where grouping is needed.
148+
required: false
149+
default: 'filePath'
150+
always-group-by:
151+
description:
152+
Force grouping by suite or file path for all reports, overriding default
153+
behavior
154+
required: false
155+
default: false
156+
debug:
157+
description: 'Enable debug mode for verbose logging.'
158+
required: false
159+
default: false
160+
161+
outputs:
162+
summary:
163+
description: 'The markdown summary generated from the test report.'
164+
165+
runs:
166+
using: 'node20'
167+
main: dist/index.js

badges/coverage.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)