[PATCH] erofs-utils: introduce GitHub Actions CI
Yifan Zhao
zhaoyifan at sjtu.edu.cn
Sun Jan 21 02:25:57 AEDT 2024
This commit introduces a new CI workflow configuration designed to
automate the testing process for erofs-utils. This CI is based on the
free GitHub Actions for we have a fork in GitHub. The CI will be
triggered on every push to the {main,dev,experimental} branch.
Currently, we have only a simple test for ensuring the correctness of
mkfs.erofs, which covers a small subset of its extended options
including dedupe, fragments, ztailpacking and {lz4,lz4hc,deflate}
compression algorithms. It creates a EROFS image using Linux v6.7 source
code as the workload, then extracts it using fsck.erofs and compares the
sha256sum of the extracted files with the original ones.
Signed-off-by: Yifan Zhao <zhaoyifan at sjtu.edu.cn>
---
Hi forks,
I believe it's time to introduce a CI for erofs-utils, which could help
us to ensure the correctness of the code and avoid regressions.
Currently this simple CI covers only a limited subset of mkfs.erofs as
the commit message says, but more tests could be added in the future,
including:
- LZMA compression (which is not supported for static-linking issue)
- potential compression/dedupe rate regression ([1] is such a case)
- CI for fsck, dump and erofsfuse
An CI demo is available at [2]. In fact, problems (maybe) have been
found in [3] with deflate compression algorithm with the help of this CI.
I will take a look at this later.
[1] https://lore.kernel.org/linux-erofs/20240115150550.1961455-1-hsiangkao@linux.alibaba.com/T/#u
[2] https://github.com/SToPire/erofs-utils-citest/actions/runs/7595077242
[3] https://github.com/SToPire/erofs-utils-citest/actions/runs/7595102798
.github/workflow/ci.yml | 92 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 .github/workflow/ci.yml
diff --git a/.github/workflow/ci.yml b/.github/workflow/ci.yml
new file mode 100644
index 0000000..784166f
--- /dev/null
+++ b/.github/workflow/ci.yml
@@ -0,0 +1,92 @@
+name: erofs-utils CI
+
+on:
+ push:
+ branches:
+ - master
+ - dev
+ - experimental
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: checkout erofs-utils
+ uses: actions/checkout at v4
+ with:
+ path: 'erofs-utils'
+
+ - name: autogen erofs-utils
+ working-directory: ./erofs-utils/
+ run: ./autogen.sh
+
+ - name: configure erofs-utils
+ working-directory: ./erofs-utils/
+ run: ./configure --enable-debug
+ --prefix=${{ github.workspace }}/erofs-utils-install/
+
+ - name: make and install erofs-utils
+ working-directory: ./erofs-utils/
+ run: |
+ make
+ make install
+
+ - name: tar erofs-utils binaries
+ run: tar -cvf erofs-utils-binaries.tar -C ${{ github.workspace }}/erofs-utils-install/bin .
+
+ - name: upload erofs-utils binaries
+ uses: actions/upload-artifact at v4
+ with:
+ name: erofs-utils-binaries
+ path: erofs-utils-binaries.tar
+ overwrite: true
+
+ mkfs-correctness:
+ needs: build
+ strategy:
+ fail-fast: false
+ matrix:
+ algorithm: ['', '-zlz4', '-zlz4hc', '-zdeflate']
+ dedupe: ['', '-Ededupe']
+ fragments: ['', '-Efragments', '-Eall-fragments']
+ ztailpacking: ['', '-Eztailpacking']
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: cache Linux-src
+ id: cache-linux-src
+ uses: actions/cache at v4
+ with:
+ path: 'Linux-src'
+ key: Linux-src-v6.7
+
+ - name: checkout Linux-src if not cached
+ if: steps.cache-linux-src.outputs.cache-hit != 'true'
+ uses: actions/checkout at v4
+ with:
+ repository: 'torvalds/linux'
+ ref: 'v6.7'
+ path: 'Linux-src'
+
+ - name: download erofs-utils binaries
+ uses: actions/download-artifact at v4
+ with:
+ name: erofs-utils-binaries
+
+ - name: untar erofs-utils binaries
+ run:
+ tar -xvf erofs-utils-binaries.tar
+
+ - name: test mkfs.erofs
+ run: |
+ ./mkfs.erofs --quiet ${{ matrix.algorithm }} ${{ matrix.dedupe }} ${{ matrix.fragments }} ${{ matrix.ztailpacking }} erofs-test.img Linux-src/
+ ./fsck.erofs --extract=extract-dir/ erofs-test.img
+
+ HASH1=$(find extract-dir -type f -exec sha256sum {} + | sed 's/extract-dir//g' | sort -k2 | sha256sum -)
+ HASH2=$(find Linux-src -type f -exec sha256sum {} + | sed 's/Linux-src//g' | sort -k2 | sha256sum -)
+ if [ "$HASH1" = "$HASH2" ]; then
+ echo "PASS!"
+ fi
\ No newline at end of file
--
2.43.0
More information about the Linux-erofs
mailing list