Skip to content

Commit ffa7968

Browse files
chore: main implementation
1 parent c2d7be5 commit ffa7968

39 files changed

+17241
-0
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.github/workflows/publish.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: GitHub action publish new version
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
versionType:
6+
type: choice
7+
description: Version Type
8+
required: true
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
permissions:
14+
contents: write
15+
jobs:
16+
publish:
17+
name: Publish github action version
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Use Node.js 20
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: 20.x
27+
28+
- name: Install npm deps
29+
run: npm ci
30+
31+
- name: Configure git
32+
run: git config --global user.email "[email protected]" && git config --global user.name "y-infra"
33+
34+
- name: Bump version
35+
run: npm version ${{ github.event.inputs.versionType }}
36+
37+
- name: Build github action
38+
run: npm run ci:build
39+
40+
- name: Commit version
41+
run: git add dist -f && git commit --amend --no-edit dist && git push --follow-tags

.github/workflows/test.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Testplane CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build_and_test:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Use Node.js 20
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 20.x
23+
24+
- name: Cache npm dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
29+
30+
- name: Install npm deps
31+
run: npm ci
32+
33+
- name: Run unit tests
34+
run: npm run unit
35+
36+
- name: Run lint
37+
run: npm run lint
38+
39+
- name: Build GitHub action
40+
run: npm run ci:build
41+
42+
- name: Run Testplane action
43+
id: testplane
44+
uses: ./
45+
with:
46+
cwd: testplane-project-example
47+
48+
- name: Deploy report
49+
if: always() && steps.testplane.outputs.html-report-path
50+
uses: peaceiris/actions-gh-pages@v4
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
publish_dir: ${{ steps.testplane.outputs.html-report-path }}
54+
destination_dir: ${{ steps.testplane.outputs.html-report-path }}
55+
keep_files: true
56+
57+
- name: Comment PR with link to Testplane HTML report
58+
if: always() && steps.testplane.outputs.html-report-path
59+
uses: thollander/actions-comment-pull-request@v3
60+
with:
61+
message: |
62+
### Testplane run finisned
63+
64+
Testplane HTML-report is available at https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.testplane.outputs.html-report-path }}
65+
comment-tag: testplane_html_report_link

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
dist/dev.js

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.18.1

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

action.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Testplane action'
2+
description: 'GitHub action for Testplane'
3+
runs:
4+
using: 'node20'
5+
main: 'dist/index.js'
6+
inputs:
7+
cwd:
8+
description: 'Relative directory to run Testplane in'
9+
required: false
10+
default: '.'
11+
package-manager:
12+
description: 'Package manager, used in the project (one of "npm", "pnpm", "yarn")'
13+
required: false
14+
default: 'npm'
15+
html-report-prefix:
16+
description: 'Html-reporter report path prefix'
17+
required: false
18+
default: 'testplane-reports'
19+
config-path:
20+
description: 'Testplane custom config path'
21+
required: false
22+
default: ''
23+
storybook:
24+
description: 'If enabled, uses @testplane/storybook plugin tests'
25+
required: false
26+
default: ''
27+
set:
28+
description: 'Comma separated list of sets to test'
29+
required: false
30+
default: ''
31+
browser:
32+
description: 'Comma separated list of browsers to test'
33+
required: false
34+
default: ''
35+
grep:
36+
description: 'Grep expression to specify tests to launch'
37+
required: false
38+
default: ''
39+
outputs:
40+
html-report-path:
41+
description: 'Path to html report, generated by html-reporter'
42+
exit-code:
43+
description: 'Testplane run exit code'

eslint.config.mjs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pluginJs from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import eslintConfigPrettier from "eslint-config-prettier";
4+
import eslintPluginPrettier from "eslint-plugin-prettier/recommended";
5+
6+
export default [
7+
{ files: ["**/*.{js,mjs,cjs,ts}"] },
8+
{ files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } },
9+
pluginJs.configs.recommended,
10+
...tseslint.configs.recommended,
11+
eslintConfigPrettier,
12+
eslintPluginPrettier,
13+
];

jest.config.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"extensionsToTreatAsEsm": [
3+
".ts"
4+
],
5+
"moduleNameMapper": {
6+
"^(\\.{1,2}/.*)\\.js$": "$1"
7+
},
8+
"preset": "ts-jest/presets/default-esm",
9+
"testEnvironment": "node",
10+
"testMatch": [
11+
"**/*.test.ts"
12+
],
13+
"transform": {
14+
"^.+\\.ts$": [
15+
"ts-jest",
16+
{
17+
"isolatedModules": true,
18+
"useESM": true
19+
}
20+
]
21+
}
22+
}

0 commit comments

Comments
 (0)