bump ver #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build cat-once | |
run: | | |
cargo build --release | |
sudo mv target/release/cat-once /usr/bin/cat-once | |
- name: Prepare test file | |
run: | | |
cat-once test.file --test-create-ascii-file-size=1000000000 | |
sha1sum test.file > test-in.file.sha1 | |
tar -cf - test.file | zstd -c > test.tar.zst | |
- name: Mount tmpfs | |
run: | | |
mkdir tmp | |
sudo mount -t tmpfs -o size=1100M tmpfs tmp | |
cp test.tar.zst tmp | |
cd tmp | |
cat-once test.tar.zst --chunk-size 55MB > test2.tar.zst | |
cat-once test2.tar.zst --chunk-size 42MB | tar -I zstd -xf - -C . | |
sha1sum test.file > ../test-out.file.sha1 | |
- name: Compare checksums | |
run: | | |
cat test-in.file.sha1 | |
cat test-out.file.sha1 | |
diff test-in.file.sha1 test-out.file.sha1 | |
- name: Random tests | |
run: | | |
for i in {1..100}; do | |
file_size=$(( ( RANDOM % 10000000 ) + 1 )) | |
chunk_size=$(( ( RANDOM % 1000000 ) + 20000 )) | |
cat-once test.file --test-create-ascii-file-size=$file_size | |
sha1sum test.file > test-in.file.sha1 | |
cargo run --release -- --chunk-size $chunk_size test.file > test-out.file | |
if [ -e "test.file" ]; then | |
echo "File exist but it should not" | |
exit 1 | |
fi | |
mv test-out.file test.file | |
sha1sum test.file > test-out.file.sha1 | |
diff test-in.file.sha1 test-out.file.sha1 | |
done |