-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (67 loc) · 2.5 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: exampleの出力結果画像が最新かどうかのテスト
# 参考元: https://sue445.hatenablog.com/entry/2021/01/07/004835#Q-%E3%81%A0%E3%81%A3%E3%81%9F%E3%82%89pull_request%E3%81%AF%E4%B8%8D%E8%A6%81%E3%81%A7%E3%81%AF
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
workflow_dispatch:
defaults:
run:
shell: bash --noprofile --norc -euxo pipefail {0}
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: リポジトリのチェックアウト
uses: actions/checkout@v2
- name: sassコマンドのインストール
run: npm install -g sass
- name: コミットに含まれるスライド画像をバックアップ
run: mkdir example-backup && mv example/example.0* example-backup
- name: 一度すべて削除して再ビルド
run: make clean all
- name: 再ビルドの結果がコミットした結果と一致しているかチェック
run: |
result="$(composite -compose difference \
example/example.001.png \
example-backup/example.001.png \
- | \
identify -format "%[mean]" -)"
(( $(echo "0.001 > $result" |bc -l) ))
result="$(composite -compose difference \
example/example.002.png \
example-backup/example.002.png \
- | \
identify -format "%[mean]" -)"
(( $(echo "0.001 > $result" |bc -l) ))
result="$(composite -compose difference \
example/example.003.png \
example-backup/example.003.png \
- | \
identify -format "%[mean]" -)"
(( $(echo "0.001 > $result" |bc -l) ))
result="$(composite -compose difference \
example/example.004.png \
example-backup/example.004.png \
- | \
identify -format "%[mean]" -)"
(( $(echo "0.001 > $result" |bc -l) ))
- name: 検証しやすいようにビルド結果をartifactへ保存
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: example
path: example
if-no-files-found: error
- name: 結果画像をコミットへ貼り付け
uses: actions/github-script@v5
if: github.event_name == 'pull_request'
with:
script: |
const script = require('./.github/github-script.js')
console.log(await script({ github, context }))