Skip to content

Commit

Permalink
Add CI step to check for too-large files and lfs files
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Mar 2, 2023
1 parent 73187e0 commit e2bad45
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/misc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI (Misc)

on:
workflow_dispatch:
pull_request:
push:
branches:
Expand All @@ -25,3 +26,7 @@ jobs:
- name: Rerun lints
run: |
./scripts/lint.py
- name: Check for too large files
run: |
./scripts/check_large_files.sh
23 changes: 23 additions & 0 deletions scripts/check_large_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Check for files that are too large to be checked into the repository.
# Whenever we want to make an exception, we add it to `check_large_files_allow_list.txt`
set -eu

#find . -type f -size +300k | grep -vnE -f ./scripts/check_large_files_allow_list.txt

maximum_size=$((1024 * 300))

result=0
while read -d '' -r file; do
if [[ -f "$file" ]]; then
actualsize=$(wc -c <"$file")
if [ $actualsize -ge $maximum_size ]; then
if ! grep -qx "$file" ./scripts/check_large_files_allow_list.txt; then
echo $file is larger than $maximum_size bytes
result=1
fi
fi
fi
done < <(git ls-files -z --empty-directory)

exit $result
1 change: 1 addition & 0 deletions scripts/check_large_files_allow_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rerun_py/rerun_sdk/rerun_demo/demo.rrd

0 comments on commit e2bad45

Please sign in to comment.