Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement image diff plugin #96

Merged
merged 32 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7ebc530
Add new plugin type
tuliren Dec 26, 2022
7f6c47d
Update type
tuliren Dec 26, 2022
881af1e
Add request type
tuliren Dec 26, 2022
c110082
Add dependencies
tuliren Dec 26, 2022
424d924
Rename plugin
tuliren Dec 26, 2022
8594f71
Add image diff config
tuliren Dec 26, 2022
1ae7477
Update logo for testing
tuliren Dec 26, 2022
cf000c0
Implement plugin
tuliren Dec 26, 2022
462b07f
Update package
tuliren Dec 26, 2022
8f1be21
Fix image path in stoat config
tuliren Dec 26, 2022
e36bd0e
Add plugin enum and unit test
tuliren Dec 26, 2022
77b49ac
Simplify image name
tuliren Dec 26, 2022
b0de8e6
Update package
tuliren Dec 26, 2022
6dea9a9
Use setup-node v3
tuliren Dec 26, 2022
a494647
Merge branch 'main' of github.com:stoat-dev/stoat-action into liren/i…
tuliren Jan 7, 2023
fa9869c
Download image in github workflow
tuliren Jan 7, 2023
f87f0e9
Remove image downloader
tuliren Jan 7, 2023
deb380e
Update package
tuliren Jan 7, 2023
310d626
Fix image download path in docs
tuliren Jan 7, 2023
42a8273
Ignore missing image path or baseline
tuliren Jan 7, 2023
fbfa203
Rename fileUrl to imageUrl
tuliren Jan 7, 2023
9ee675d
Update rendered stoat config schema
tuliren Jan 7, 2023
4bd1835
Rename path field to image
tuliren Jan 7, 2023
0a1b9ad
Update package
tuliren Jan 7, 2023
53acb10
Use jimp to resize image
tuliren Jan 7, 2023
1c79029
Update package
tuliren Jan 7, 2023
aa20229
Fix logs
tuliren Jan 7, 2023
0d3fcbf
Add more logs
tuliren Jan 7, 2023
205fd7b
Add more logs
tuliren Jan 7, 2023
fd8cb31
Update repo sha log
tuliren Jan 7, 2023
b99303a
Use writeAsync
tuliren Jan 7, 2023
8971456
Revert logo image
tuliren Jan 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Setup cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Setup cache
Expand Down
6 changes: 6 additions & 0 deletions .stoat/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ plugins:
metadata:
name: Documentation
path: docs/build
image_diff:
compare_logo_image:
metadata:
name: Logo
path: docs/static/img/logo-128.png
baseline: https://stoat-dev--static.stoat.page/branding/128.png
tuliren marked this conversation as resolved.
Show resolved Hide resolved
38 changes: 18 additions & 20 deletions action/__tests__/templateHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const staticHosting2: StaticHostingPlugin = {
const json1: JsonPlugin = {
path: 'path1'
};
const imageDiff1: JsonPlugin = {
path: 'path1'
};

describe('Read local template', () => {
test('getTemplate', async () => {
Expand All @@ -52,8 +55,14 @@ describe('Read local template', () => {
});

test('getLocalTemplate', () => {
expect(getLocalTemplate(template1Path)).toEqual({ template: template1, format: TemplateFormat.Handlebars });
expect(getLocalTemplate(template2Path)).toEqual({ template: template2, format: TemplateFormat.Jinja2 });
expect(getLocalTemplate(template1Path)).toEqual({
template: template1,
format: TemplateFormat.Handlebars
});
expect(getLocalTemplate(template2Path)).toEqual({
template: template2,
format: TemplateFormat.Jinja2
});
});
});

Expand All @@ -67,18 +76,13 @@ describe('Read remote default template', () => {
const stoatConfigWithOnePlugin: StoatConfigSchema = {
version: 1,
plugins: {
static_hosting: {
plugin1: staticHosting1
}
static_hosting: { plugin1: staticHosting1 }
}
};
const stoatConfigWithMultiPlugins: StoatConfigSchema = {
version: 1,
plugins: {
static_hosting: {
plugin1: staticHosting1,
plugin2: staticHosting2
}
static_hosting: { plugin1: staticHosting1, plugin2: staticHosting2 }
}
};

Expand Down Expand Up @@ -107,9 +111,7 @@ describe('getPlugins', () => {
getPlugins({
version: 1,
plugins: {
static_hosting: {
plugin1: staticHosting1
}
static_hosting: { plugin1: staticHosting1 }
}
})
).toEqual([Plugin.StaticHosting]);
Expand All @@ -120,15 +122,11 @@ describe('getPlugins', () => {
getPlugins({
version: 1,
plugins: {
static_hosting: {
plugin1: staticHosting1,
plugin2: staticHosting2
},
json: {
plugin3: json1
}
static_hosting: { plugin1: staticHosting1, plugin2: staticHosting2 },
json: { plugin3: json1 },
image_diff: { plugin4: imageDiff1 }
}
}).sort()
).toEqual([Plugin.Json, Plugin.StaticHosting].sort());
).toEqual([Plugin.Json, Plugin.StaticHosting, Plugin.ImageDiff].sort());
});
});
Loading