-
Notifications
You must be signed in to change notification settings - Fork 10
149 lines (147 loc) · 6.07 KB
/
encode-and-decode-again.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Encode all images and decode them again
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
check-on-ubuntu:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
include:
- os: ubuntu-18.04
codename: 'bionic'
cavif-flag: ''
- os: ubuntu-20.04
codename: 'focal'
cavif-flag: ''
steps:
- uses: actions/checkout@v2
- name: Install required tools
run: sudo apt install -y curl jq unzip coreutils imagemagick
- name: Download latest cavif
shell: bash
run: |
runId=$(curl https://api.github.com/repos/link-u/cavif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id')
artifactId=$(curl https://api.github.com/repos/link-u/cavif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "${{ matrix.codename }}")][0].id')
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o cavif.zip -L https://api.github.com/repos/link-u/cavif/actions/artifacts/${artifactId}/zip
unzip cavif.zip
env:
#id of https://github.com/link-u/cavif/actions?query=workflow%3A%22Build+debian+package+on+push+or+release-tags.%22
# curl https://api.github.com/repos/link-u/cavif/actions/workflows
WORKFLOW_ID: '4521995'
- name: Download latest davif
shell: bash
run: |
runId=$(curl https://api.github.com/repos/link-u/davif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id')
artifactId=$(curl https://api.github.com/repos/link-u/davif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "${{ matrix.codename }}")][0].id')
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o davif.zip -L https://api.github.com/repos/link-u/davif/actions/artifacts/${artifactId}/zip
unzip davif.zip
env:
#id of https://github.com/link-u/davif/actions?query=workflow%3A%22Build+debian+package+on+push+or+release-tags.%22
# curl https://api.github.com/repos/link-u/davif/actions/workflows
WORKFLOW_ID: '4521992'
- name: Install davif and cavif
run: sudo dpkg -i *.deb
- name: Use installed cavif and davif
run: |
sed -i -e 's/^CAVIF=.*$/CAVIF=cavif ${{ matrix.cavif-flag }}/' Makefile
sed -i -e 's/^DAVIF=.*$/DAVIF=davif/' Makefile
- name: Clean all images.
run: make clean
- name: Encode them all.
run: make all -j $(nproc)
- name: Decode them all.
run: make decode -j $(nproc)
- name: Copy images to upload.
run: |
mkdir -p ${{ matrix.codename }}/decoded
mkdir -p ${{ matrix.codename }}/encoded
cp decoded/* ${{ matrix.codename }}/decoded
cp *.avif ${{ matrix.codename }}/encoded
- name: Upload result
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.codename }}
path: ${{ matrix.codename }}
- name: Compare the result
run: make compare -j $(nproc)
check-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
path-type: inherit
- name: Install dependencies
shell: msys2 {0}
run: |
set -eux
pacman --noconfirm -S make
pacman --noconfirm -S bc
pacman --noconfirm -S mingw-w64-x86_64-imagemagick
pacman --noconfirm -S mingw-w64-x86_64-curl
pacman --noconfirm -S mingw-w64-x86_64-jq
make --version
echo '2+2' | bc
magick -version
- name: Download latest cavif
shell: bash
run: |
runId=$(curl https://api.github.com/repos/link-u/cavif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id')
artifactId=$(curl https://api.github.com/repos/link-u/cavif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "cavif-win64")][0].id')
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o cavif.zip -L https://api.github.com/repos/link-u/cavif/actions/artifacts/${artifactId}/zip
unzip cavif.zip
rm cavif.zip
./cavif.exe -h
env:
WORKFLOW_ID: '4517759'
- name: Download latest davif
shell: bash
run: |
runId=$(curl https://api.github.com/repos/link-u/davif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id')
artifactId=$(curl https://api.github.com/repos/link-u/davif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "davif-win64")][0].id')
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o davif.zip -L https://api.github.com/repos/link-u/davif/actions/artifacts/${artifactId}/zip
unzip davif.zip
rm davif.zip
./davif.exe -h
env:
WORKFLOW_ID: '4521970'
- name: Rewrite Makefile to installed cavif and davif
shell: msys2 {0}
run: |
sed -i -e 's/^CAVIF=.*$/CAVIF=.\/cavif.exe/' Makefile
sed -i -e 's/^DAVIF=.*$/DAVIF=.\/davif.exe/' Makefile
- name: Clean all images.
shell: msys2 {0}
run: make clean
- name: Encode them all
shell: msys2 {0}
run: make all -j $(nproc)
- name: Decode them all
shell: msys2 {0}
run: make decode -j $(nproc)
- name: Copy images to upload.
shell: msys2 {0}
run: |
mkdir -p win64/decoded
mkdir -p win64/encoded
cp decoded/* win64/decoded
cp *.avif win64/encoded
- name: Upload result
uses: actions/upload-artifact@v1
with:
name: win64
path: win64
- name: Compare the result
shell: msys2 {0}
run: |
export PATH="/mingw64/bin:${PATH}"
make compare -j $(nproc)