Skip to content

Commit

Permalink
Develop (#93)
Browse files Browse the repository at this point in the history
* fix: add report

* fix (#86)

* feat: add artifact name (#87)

* fix (#88)

* V2 (#91)

* wip

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* test

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

---------

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

* fix

* fix

---------

Co-authored-by: bokuweb <[email protected]>
  • Loading branch information
bokuweb and bokuweb authored Oct 23, 2023
1 parent a1aa412 commit 80cd72e
Show file tree
Hide file tree
Showing 21 changed files with 1,914 additions and 105 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/deploy-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn package
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- run: pnpm package
- name: deploy
uses: s0/git-publish-subdir-action@develop
env:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ jobs:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn package
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- run: pnpm package
- name: deploy
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: v1
BRANCH: v2
FOLDER: dist
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn package
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- run: pnpm package
- uses: ./dist
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test_with_target_hash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn package
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- run: pnpm package
- uses: actions/github-script@v5
id: target
with:
Expand Down
50 changes: 37 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

---

> [!WARNING]
> v1 is deprecated. Please use v2.
[![GitHub Actions Status](https://github.com/bokuweb/reg-actions/workflows/CI/badge.svg)](https://github.com/bokuweb/reg-actions/actions)


Expand All @@ -15,8 +18,8 @@
* [How to use](#how-to-use)
* [Minimal setup](#minimal-setup)
* [Action inputs](#action-inputs)
* [Authorization](#authorization)
* [Limitation](#limitation)
* [Troubleshooting](#troubleshooting)
* [Contribute](#contribute)
* [License](#license)

Expand All @@ -26,15 +29,22 @@ This repository provides a `GitHub Action` for visual regression testing.
(See also related projects [reg-suit](https://github.com/reg-viz/reg-suit) and [reg-cli](https://github.com/reg-viz/reg-cli)).

This action uploads images and report as workflow artifact.
The html report is generated by downloading and comparing the artifacts from the branch where the pull request will be merged.
If the action succeeds, you will see the following html report.
Please check this [PR](https://github.com/bokuweb/reg-actions/pull/53) too.
The report is commented to PR and workflow summary by downloading and comparing the artifacts from the branch where the pull request will be merged.

So, this action does *not* take screenshot, please generate images by your self.
If you use `storybook`, we recommend using [storycap](https://github.com/reg-viz/storycap)

![open](https://github.com/reg-viz/reg-cli/raw/master/docs/open.png)
![viewer](https://github.com/reg-viz/reg-cli/raw/master/docs/viewer.png)
### PR Comment

![comment](./screenshot/comment.png)

You can also see an [`example`](https://github.com/bokuweb/reg-actions-example/pull/2#issuecomment-1774125992)

### Workflow Summary

![summary](./screenshot/summary.png)

You can also see an [`example`](https://github.com/bokuweb/reg-actions-example/actions/runs/6604684694#summary-17939150492).

## How to use

Expand All @@ -54,7 +64,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bokuweb/reg-actions@v1
- uses: bokuweb/reg-actions@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
image-directory-path: "./images"
Expand Down Expand Up @@ -132,17 +142,31 @@ The custom report page link.

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.

## Authorization
#### `artifact-name` (Optional)

- Type: String
- Default: `"reg"`

The name of the artifact to be Uploaded.
Default is "reg".

The `reg-actions` report is created as a `Github Oauth App` that requires the `repo` scope.
This is because, the report app downloads artifact directly and it needs the `repo` scope to download the `artifact`.
#### `branch` (Optional)

- Type: String
- Default: `"reg_actions"`

So if you use this action in private repository, please check [Restricting access to your organization's data](https://docs.github.com/ja/organizations/restricting-access-to-your-organizations-data).
The branch name for uploading images. This action will upload the image to the specified branch and use its URL in the comments.
Default is "reg_actions".

## Limitation

- If the `artifact` is deleted, the report will also be deleted, see [`Artifact and log retention policy`](https://docs.github.com/ja/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy) for the retention period of the `artifact`.
- The report may be slow to display. This is due to the fact that the report is built while retrieving the artifacts via `ReadableStream`. If this is a problem, please use [reg-suit](https://github.com/reg-viz/reg-suit).

## Troubleshooting

- `Error: HttpError: Resource not accessible by integration`.

Please go to the `Settings > Actions > General > Workflow permissions` of the relevant repository and change the permission from `Read repository contents permission` to `Read and write permissions`.


## Contribute
Expand All @@ -153,7 +177,7 @@ Thanks for your help improving the project! We are so happy to have you!

The MIT License (MIT)

Copyright (c) 2022 bokuweb
Copyright (c) 2023 bokuweb

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
11 changes: 9 additions & 2 deletions dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ inputs:
target-hash:
description: "The commit hash to be compared."
required: false
artifact-name:
description: 'Workflow artifact name. `reg` by default.'
required: false
branch:
description: 'A branch name which manages images. `reg_actions` by default.'
required: false
custom-report-page:
description: "The custom report page link."
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
runs:
using: "node16"
using: "node20"
main: "lib/index.js"

34 changes: 19 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "node12-template-action",
"name": "reg-actions",
"version": "0.0.0",
"private": true,
"description": "Node 12 template action",
"description": "github actions for reg",
"main": "lib/main.js",
"scripts": {
"build": "tsc",
Expand All @@ -12,7 +12,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/node12-template.git"
"url": "git+https://github.com/bokuweb/reg-actions.git"
},
"keywords": [
"actions",
Expand All @@ -21,36 +21,40 @@
],
"author": "GitHub",
"license": "MIT",
"resolutions": {
"**/ansi-regex": "^6.0.1",
"**/glob-parent": "^6.0.2",
"**/trim-newlines": "^4.0.2",
"**/axios": "^1.1.3",
"**/kind-of": "^6.0.3",
"**/minimist": "^1.2.7",
"**/shell-quote": "^1.7.3",
"**/braces": "^3.0.2"
"pnpm": {
"overrides": {
"fsevents": "1.2.13.",
"ansi-regex": "^6.0.1",
"glob-parent": "^6.0.2",
"trim-newlines": "^4.0.2",
"axios": "^1.1.3",
"kind-of": "^6.0.3",
"minimist": "^1.2.7",
"shell-quote": "^1.7.3",
"braces": "^3.0.2"
}
},
"dependencies": {
"@actions/artifact": "^1.1.0",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@actions/github": "^6.0.0",
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1",
"@types/cpx": "^1.5.2",
"@types/glob": "^8.0.0",
"adm-zip": "^0.5.9",
"axios": "^1.1.3",
"chalk": "^5.1.2",
"cpx": "^1.5.0",
"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"
},
"devDependencies": {
"@octokit/openapi-types": "^19.0.0",
"@types/adm-zip": "^0.5.0",
"@types/axios": "^0.14.0",
"@types/loglevel": "^1.6.3",
Expand Down
Loading

0 comments on commit 80cd72e

Please sign in to comment.