Skip to content

Commit

Permalink
feat: allow specifying expected images directory (#148)
Browse files Browse the repository at this point in the history
* Update README.md

* fix: 103 (#104)

* fix: comment (#105)

Co-authored-by: bokuweb <[email protected]>

* feat: comment-report-format option allow to summarize changed file comment format (#107)

* fix: `The disable-branch option is not working` (#112)

* test

* test

* test

* test

* fix: input

* fix: report generation (#113)

* deps: update (#114)

* build(deps): bump follow-redirects from 1.15.2 to 1.15.4 (#106)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: bokuweb <[email protected]>

* Delete yarn.lock

* build(deps): bump undici from 5.28.3 to 5.28.4 (#120)

Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v5.28.3...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: 118 (#121)

* fix: #118 (#122)

* feat: add cleanup workspace directory (#124)

* handle: error (#125)

* fix: handle comment size limitation (#126)

* Update comment.ts (#128)

* chore: add logs (#129)

* chore: add logs (#130)

* fix

* fix

* chore: update deps (#131)

* feat: add link for artifact (#133)

* deps: update deps (#132)

* fix: use artifact client for download (#135)

* fix: use artifact client for download

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* Revert "fix: use artifact client for download (#135)" (#136)

This reverts commit 19d3918.

* feat: outdated comment action option to minimize previous reg-action comments (#138)

* feat: Support retention days (#139)

* feat: Support retention days

* test

* test

* test

* remove test

* green keep (#140)

* fix retention-days input parameter (#141)

* chore: add log (#142)

* fix: use for (#143)

* fix (#144)

* fix: replace client (#145)

* Revert "fix: replace client (#145)" (#146)

This reverts commit 60a8105.

* fix: threshold-pixel param default overrides threshold-rate (#147)

Allows threshold-pixel value to be null as well, if not defined.
That way, when specifying threshold-rate, only the threshold-rate will
be applied. Otherwise threshold-rate does not have any effect, since
it will always be overriden by threshold-pixel that defaults to 0.

* feat: allow specifying expected images directory

This way, it is not needed to find previous runs and download an artifact.
Instead, the images are copied from the expected images directory
and compared immediately.

* add missing property into action.yml

* revert back to using targetRun parameter

* fix validation of expectedImagesDirectoryPath

* do not allow empty expectedImagesDirectoryPath if it's defined

* Remove `allowEmpty` from `validateImageDirPath`

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: bokuweb <[email protected]>
Co-authored-by: bokuweb <[email protected]>
Co-authored-by: Ken Kaizu <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yuki Mima <[email protected]>
  • Loading branch information
6 people authored Jul 17, 2024
1 parent 6b919df commit 37f4dd9
Show file tree
Hide file tree
Showing 12 changed files with 2,626 additions and 3,439 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ jobs:
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
image-directory-path: "./images"
disable-branch: true
report-file-path: './'
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
### Action inputs
Input definitions are written in [action.yml](./action.yml).
Input definitions are written in [action.yml](https://github.com/reg-viz/reg-actions/blob/main/dist/action.yml).
#### `github-token` (Required)

Expand All @@ -87,7 +87,17 @@ It is used to upload test report and add comment to pull request.
- Type: String
- Default: N/A

Path to images directory.The images stored in this directory will be compared with the expected images from the last upload.
Path to images directory. The images stored in this directory will be compared with the expected images from the last upload.

#### `expected-images-directory-path` (Optional)

- Type: String
- Default: N/A

Path to expected images directory. These images will be compared with images stored in `image-directory-path`.

If this option is specified, images from artifact upload are ignored.
Instead, the images are copied directly from the specified directory.

#### `enable-antialias` (Optional)

Expand Down Expand Up @@ -165,6 +175,26 @@ Default is "reg_actions".

The option to disable push to a branch. When set to false, the `branch` option is ignored, and images will not be displayed in the comments.

#### `comment-report-format` (Optional)

- Type: String
- Default: `"raw"`

The option how to render changed file in comment. This action will change PR and workflow summary report format. Available options are `raw` and `summarized`. `raw` will render report comment with expanded results. `summarized` will render report comment using `<details>` tag to summarize by changed files.

#### `outdated-comment-action` (Optional)

- Type: String
- Default: `"none"`

The option to handle outdated comments in the PR. Available options are `none` and `minimize`. `none` do nothing. `minimize` will minimize outdated action comments.

### `retention-days` (Optional)

- Type: number
- Default: `30`

This option allows you to specify the duration for which images are stored in the branch. If not specified, the default is 30 days.

## Limitation

Expand Down
14 changes: 13 additions & 1 deletion dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputs:
image-directory-path:
description: "Path to images directory.The images stored in this directory will be compared with the expected images from the last upload."
required: true
expected-images-directory-path:
description: "Path to expected images directory. The images stored in this directory will be compared with the actual images from image-directory-path."
required: false
enable-antialias:
description: "Enable antialias. If omitted false."
required: false
Expand Down Expand Up @@ -40,7 +43,16 @@ inputs:
required: false
report-file-path:
description: "Path of the generated report html file. This file can be deployed in other Actions steps, but is not included in the artifact. If omitted, no html report is generated."
required: false
required: false
comment-report-format:
description: "The option how to render changed file in comment. `raw` by default."
required: false
outdated-comment-action:
description: "The option to handle outdated comments. `none` by default."
required: false
retention-days:
description: "This option allows you to specify the duration for which images are stored in the branch. If not specified, the default is 30 days."
required: false
runs:
using: "node20"
main: "lib/index.js"
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,32 @@
}
},
"dependencies": {
"@actions/artifact": "^1.1.0",
"@actions/core": "^1.10.0",
"@actions/artifact": "^2.1.7",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"@actions/io": "^1.1.2",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"@types/glob": "^8.0.0",
"adm-zip": "^0.5.9",
"axios": "^1.1.3",
"chalk": "^5.1.2",
"cpy": "^10.1.0",
"exponential-backoff": "^3.1.0",
"fast-glob": "^3.3.1",
"glob": "^8.0.3",
"loglevel": "^1.8.0",
"make-dir": "^3.1.0",
"reg-cli": "^0.17.7"
"@types/glob": "^8.1.0",
"adm-zip": "^0.5.14",
"axios": "^1.7.2",
"chalk": "^5.3.0",
"cpy": "^11.0.1",
"exponential-backoff": "^3.1.1",
"fast-glob": "^3.3.2",
"glob": "^10.4.1",
"loglevel": "^1.9.1",
"make-dir": "^4.0.0",
"reg-cli": "^0.18.6"
},
"devDependencies": {
"@octokit/openapi-types": "^19.0.0",
"@types/adm-zip": "^0.5.0",
"@octokit/openapi-types": "^22.2.0",
"@types/adm-zip": "^0.5.5",
"@types/axios": "^0.14.0",
"@types/loglevel": "^1.6.3",
"@types/make-dir": "^2.1.0",
"@types/node": "^18.11.5",
"@vercel/ncc": "^0.34.0",
"typescript": "^4.8.4"
"@types/node": "^20.13.0",
"@vercel/ncc": "^0.38.1",
"typescript": "^5.4.5"
}
}
Loading

0 comments on commit 37f4dd9

Please sign in to comment.