| 1 |
name: Encode all images and decode them again weekly. |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
schedule: |
| 6 |
- cron: '0 20 * * 0' # https://crontab.guru/#0_2_*_*_0 |
| 7 |
|
| 8 |
jobs: |
| 9 |
check-on-ubuntu: |
| 10 |
runs-on: ${{ matrix.os }} |
| 11 |
strategy: |
| 12 |
matrix: |
| 13 |
os: [ubuntu-18.04, ubuntu-20.04] |
| 14 |
include: |
| 15 |
- os: ubuntu-18.04 |
| 16 |
codename: 'bionic' |
| 17 |
cavif-flag: '' |
| 18 |
- os: ubuntu-20.04 |
| 19 |
codename: 'focal' |
| 20 |
cavif-flag: '' |
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v2 |
| 23 |
- name: Install required tools |
| 24 |
run: sudo apt install -y curl jq unzip coreutils imagemagick |
| 25 |
- name: Download latest cavif |
| 26 |
shell: bash |
| 27 |
run: | |
| 28 |
runId=$(curl https://api.github.com/repos/link-u/cavif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id') |
| 29 |
artifactId=$(curl https://api.github.com/repos/link-u/cavif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "${{ matrix.codename }}")][0].id') |
| 30 |
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o cavif.zip -L https://api.github.com/repos/link-u/cavif/actions/artifacts/${artifactId}/zip |
| 31 |
unzip cavif.zip |
| 32 |
env: |
| 33 |
#id of https://github.com/link-u/cavif/actions?query=workflow%3A%22Build+debian+package+on+push+or+release-tags.%22 |
| 34 |
# curl https://api.github.com/repos/link-u/cavif/actions/workflows |
| 35 |
WORKFLOW_ID: '4521995' |
| 36 |
- name: Download latest davif |
| 37 |
shell: bash |
| 38 |
run: | |
| 39 |
runId=$(curl https://api.github.com/repos/link-u/davif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id') |
| 40 |
artifactId=$(curl https://api.github.com/repos/link-u/davif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "${{ matrix.codename }}")][0].id') |
| 41 |
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o davif.zip -L https://api.github.com/repos/link-u/davif/actions/artifacts/${artifactId}/zip |
| 42 |
unzip davif.zip |
| 43 |
env: |
| 44 |
#id of https://github.com/link-u/davif/actions?query=workflow%3A%22Build+debian+package+on+push+or+release-tags.%22 |
| 45 |
# curl https://api.github.com/repos/link-u/davif/actions/workflows |
| 46 |
WORKFLOW_ID: '452394' |
| 47 |
- name: Install davif and cavif |
| 48 |
run: sudo dpkg -i *.deb |
| 49 |
- name: Use installed cavif and davif |
| 50 |
run: | |
| 51 |
sed -i -e 's/^CAVIF=.*$/CAVIF=cavif ${{ matrix.cavif-flag }}/' Makefile |
| 52 |
sed -i -e 's/^DAVIF=.*$/DAVIF=davif/' Makefile |
| 53 |
- name: Clean all images. |
| 54 |
run: make clean |
| 55 |
- name: Encode them all. |
| 56 |
run: make all -j $(nproc) |
| 57 |
- name: Decode them all. |
| 58 |
run: make decode -j $(nproc) |
| 59 |
- name: Copy images to upload. |
| 60 |
run: | |
| 61 |
mkdir -p ${{ matrix.codename }}/decoded |
| 62 |
mkdir -p ${{ matrix.codename }}/encoded |
| 63 |
cp decoded/* ${{ matrix.codename }}/decoded |
| 64 |
cp *.avif ${{ matrix.codename }}/encoded |
| 65 |
- name: Upload result |
| 66 |
uses: actions/upload-artifact@v1 |
| 67 |
with: |
| 68 |
name: ${{ matrix.codename }} |
| 69 |
path: ${{ matrix.codename }} |
| 70 |
- name: Compare the result |
| 71 |
run: make compare -j $(nproc) |
| 72 |
check-on-windows: |
| 73 |
runs-on: windows-latest |
| 74 |
steps: |
| 75 |
- uses: actions/checkout@v2 |
| 76 |
- name: Install msys2 |
| 77 |
uses: msys2/setup-msys2@v2 |
| 78 |
with: |
| 79 |
msystem: MINGW64 |
| 80 |
update: true |
| 81 |
path-type: inherit |
| 82 |
- name: Install dependencies |
| 83 |
shell: msys2 {0} |
| 84 |
run: | |
| 85 |
set -eux |
| 86 |
pacman --noconfirm -S make |
| 87 |
pacman --noconfirm -S bc |
| 88 |
pacman --noconfirm -S mingw-w64-x86_64-imagemagick |
| 89 |
pacman --noconfirm -S mingw-w64-x86_64-curl |
| 90 |
pacman --noconfirm -S mingw-w64-x86_64-jq |
| 91 |
make --version |
| 92 |
echo '2+2' | bc |
| 93 |
magick -version |
| 94 |
- name: Download latest cavif |
| 95 |
shell: bash |
| 96 |
run: | |
| 97 |
runId=$(curl https://api.github.com/repos/link-u/cavif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id') |
| 98 |
artifactId=$(curl https://api.github.com/repos/link-u/cavif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "cavif-win64")][0].id') |
| 99 |
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o cavif.zip -L https://api.github.com/repos/link-u/cavif/actions/artifacts/${artifactId}/zip |
| 100 |
unzip cavif.zip |
| 101 |
rm cavif.zip |
| 102 |
./cavif.exe -h |
| 103 |
env: |
| 104 |
WORKFLOW_ID: '4517759' |
| 105 |
- name: Download latest davif |
| 106 |
shell: bash |
| 107 |
run: | |
| 108 |
runId=$(curl https://api.github.com/repos/link-u/davif/actions/workflows/${WORKFLOW_ID}/runs | jq '[.workflow_runs[] | select( .conclusion == "success")][0].id') |
| 109 |
artifactId=$(curl https://api.github.com/repos/link-u/davif/actions/runs/${runId}/artifacts | jq '[.artifacts[] | select( .name == "davif-win64")][0].id') |
| 110 |
curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -o davif.zip -L https://api.github.com/repos/link-u/davif/actions/artifacts/${artifactId}/zip |
| 111 |
unzip davif.zip |
| 112 |
rm davif.zip |
| 113 |
./davif.exe -h |
| 114 |
env: |
| 115 |
WORKFLOW_ID: '4521970' |
| 116 |
- name: Rewrite Makefile to installed cavif and davif |
| 117 |
shell: msys2 {0} |
| 118 |
run: | |
| 119 |
sed -i -e 's/^CAVIF=.*$/CAVIF=.\/cavif.exe/' Makefile |
| 120 |
sed -i -e 's/^DAVIF=.*$/DAVIF=.\/davif.exe/' Makefile |
| 121 |
- name: Clean all images. |
| 122 |
shell: msys2 {0} |
| 123 |
run: make clean |
| 124 |
- name: Encode them all |
| 125 |
shell: msys2 {0} |
| 126 |
run: make all -j $(nproc) |
| 127 |
- name: Decode them all |
| 128 |
shell: msys2 {0} |
| 129 |
run: make decode -j $(nproc) |
| 130 |
- name: Copy images to upload. |
| 131 |
shell: msys2 {0} |
| 132 |
run: | |
| 133 |
mkdir -p win64/decoded |
| 134 |
mkdir -p win64/encoded |
| 135 |
cp decoded/* win64/decoded |
| 136 |
cp *.avif win64/encoded |
| 137 |
- name: Upload result |
| 138 |
uses: actions/upload-artifact@v1 |
| 139 |
with: |
| 140 |
name: win64 |
| 141 |
path: win64 |
| 142 |
- name: Compare the result |
| 143 |
shell: msys2 {0} |
| 144 |
run: | |
| 145 |
export PATH="/mingw64/bin:${PATH}" |
| 146 |
make compare -j $(nproc) |