Skip to content

Fix text_cache with proper cache invocation #425

Fix text_cache with proper cache invocation

Fix text_cache with proper cache invocation #425

name: Test optimize_image
on:
push:
branches:
- 'main'
- 'releases/**'
pull_request:
workflow_dispatch:
jobs:
optimized:
runs-on: ubuntu-latest
outputs:
imgsize: ${{ steps.compress.outputs.imgsize }}
steps:
- uses: actions/checkout@v4
- uses: ./ # pguyot/arm-runner-action@HEAD
id: optimized
with:
base_image: raspios_lite:2021-05-07
optimize_image: yes
commands: |
cat /dev/random > /rand || rm /rand
- name: Compress image
id: compress
run: |
mv ${{ steps.optimized.outputs.image }} /home/actions/temp/optimized-image.img
gzip /home/actions/temp/optimized-image.img
imgsize=`stat --printf="%s" /home/actions/temp/optimized-image.img.gz`
echo "imgsize=${imgsize}" >> $GITHUB_OUTPUT
slimmed:
runs-on: ubuntu-latest
outputs:
imgsize: ${{ steps.compress.outputs.imgsize }}
steps:
- uses: actions/checkout@v4
- uses: ./ # pguyot/arm-runner-action@HEAD
id: slimmed
with:
base_image: raspios_lite:2021-05-07
optimize_image: yes
commands: |
apt-get -y --purge autoremove ".*python.*"
cat /dev/random > /rand || rm /rand
- name: Compress image
id: compress
run: |
mv ${{ steps.slimmed.outputs.image }} /home/actions/temp/slimmed-image.img
gzip /home/actions/temp/slimmed-image.img
imgsize=`stat --printf="%s" /home/actions/temp/slimmed-image.img.gz`
echo "imgsize=${imgsize}" >> $GITHUB_OUTPUT
unoptimized:
runs-on: ubuntu-latest
outputs:
imgsize: ${{ steps.compress.outputs.imgsize }}
steps:
- uses: actions/checkout@v4
- uses: ./ # pguyot/arm-runner-action@HEAD
id: unoptimized
with:
base_image: raspios_lite:2021-05-07
optimize_image: no
commands: |
cat /dev/random > /rand || rm /rand
- name: Compress image
id: compress
run: |
mv ${{ steps.unoptimized.outputs.image }} /home/actions/temp/unoptimized-image.img
gzip /home/actions/temp/unoptimized-image.img
imgsize=`stat --printf="%s" /home/actions/temp/unoptimized-image.img.gz`
echo "imgsize=${imgsize}" >> $GITHUB_OUTPUT
compare:
runs-on: ubuntu-latest
needs: [optimized, unoptimized, slimmed]
steps:
- name: Test image sizes
run: |
echo "Optimized size: ${{needs.optimized.outputs.imgsize}}"
echo "Slimmed size: ${{needs.slimmed.outputs.imgsize}}"
echo "Unoptimized size: ${{needs.unoptimized.outputs.imgsize}}"
test $(( ${{needs.unoptimized.outputs.imgsize}} - ${{needs.optimized.outputs.imgsize}} )) > 300000000
test $(( ${{needs.optimized.outputs.imgsize}} - ${{needs.slimmed.outputs.imgsize}} )) > 5000000