Skip to content

Commit

Permalink
Add test for resize2fs
Browse files Browse the repository at this point in the history
  • Loading branch information
pguyot committed May 4, 2024
1 parent e9ce169 commit 44f39c8
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/test-optimize_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,35 @@ jobs:
optimize_image: yes
commands: |
cat /dev/random > /rand || rm /rand
dpkg -l
- 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.*"
apt-get -y --purge autoremove ".*gcc.*"
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:
Expand All @@ -51,10 +72,12 @@ jobs:
echo "imgsize=${imgsize}" >> $GITHUB_OUTPUT
compare:
runs-on: ubuntu-latest
needs: [optimized, unoptimized]
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}} )) > 0

0 comments on commit 44f39c8

Please sign in to comment.