treefmt-check
checks.x86_64-linux.treefmt
· build #1002
· raw
1treefmt v2.6.0traversed 983 files2emitted 414 files for processing3formatted 414 files (1 changed) in 21.796s4 M nix/docs/image-size-analyzer-usage.md5diff --git a/nix/docs/image-size-analyzer-usage.md b/nix/docs/image-size-analyzer-usage.md6index bef0fc7..02d80bb 1006447--- a/nix/docs/image-size-analyzer-usage.md8+++ b/nix/docs/image-size-analyzer-usage.md9@@ -68,36 +68,36 @@ diff before.json after.json10 Add a job that fails if images exceed a size threshold:11 12 ```yaml13- check-size-threshold:14- runs-on: ubuntu-latest15- steps:16- - uses: actions/checkout@v417-18- - name: Install Nix19- uses: cachix/install-nix-action@v2720- with:21- extra_nix_config: |22- extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com23- extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=24-25- - name: Check image sizes26- run: |27- nix run .#image-size-analyzer -- --json > sizes.json28-29- # Set threshold (2.5 GB in bytes)30- THRESHOLD=268435456031-32- # Check each image33- for dockerfile in Dockerfile-15 Dockerfile-17 Dockerfile-orioledb-17; do34- size=$(jq -r ".images[] | select(.dockerfile == \"$dockerfile\") | .total_size_bytes" sizes.json)35- if [ "$size" -gt "$THRESHOLD" ]; then36- echo "ERROR: $dockerfile exceeds size threshold"37- echo " Size: $((size / 1048576)) MB"38- echo " Threshold: $((THRESHOLD / 1048576)) MB"39- exit 140- fi41- echo "OK: $dockerfile = $((size / 1048576)) MB"42- done43+check-size-threshold:44+ runs-on: ubuntu-latest45+ steps:46+ - uses: actions/checkout@v447+48+ - name: Install Nix49+ uses: cachix/install-nix-action@v2750+ with:51+ extra_nix_config: |52+ extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com53+ extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=54+55+ - name: Check image sizes56+ run: |57+ nix run .#image-size-analyzer -- --json > sizes.json58+59+ # Set threshold (2.5 GB in bytes)60+ THRESHOLD=268435456061+62+ # Check each image63+ for dockerfile in Dockerfile-15 Dockerfile-17 Dockerfile-orioledb-17; do64+ size=$(jq -r ".images[] | select(.dockerfile == \"$dockerfile\") | .total_size_bytes" sizes.json)65+ if [ "$size" -gt "$THRESHOLD" ]; then66+ echo "ERROR: $dockerfile exceeds size threshold"67+ echo " Size: $((size / 1048576)) MB"68+ echo " Threshold: $((THRESHOLD / 1048576)) MB"69+ exit 170+ fi71+ echo "OK: $dockerfile = $((size / 1048576)) MB"72+ done73 ```74 75 ### Size Regression Check76@@ -105,49 +105,49 @@ Add a job that fails if images exceed a size threshold:77 Compare against a baseline to catch size regressions:78 79 ```yaml80- check-size-regression:81- runs-on: ubuntu-latest82- steps:83- - uses: actions/checkout@v484- with:85- fetch-depth: 0 # Need full history for base branch86-87- - name: Install Nix88- uses: cachix/install-nix-action@v2789- with:90- extra_nix_config: |91- extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com92- extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=93-94- - name: Analyze PR branch95- run: |96- nix run .#image-size-analyzer -- --image Dockerfile-17 --json > pr-sizes.json97-98- - name: Analyze base branch99- run: |100- git checkout ${{ github.base_ref }}101- nix run .#image-size-analyzer -- --image Dockerfile-17 --json > base-sizes.json102- git checkout -103-104- - name: Compare sizes105- run: |106- PR_SIZE=$(jq -r '.images[0].total_size_bytes' pr-sizes.json)107- BASE_SIZE=$(jq -r '.images[0].total_size_bytes' base-sizes.json)108-109- DIFF=$((PR_SIZE - BASE_SIZE))110- DIFF_MB=$((DIFF / 1048576))111-112- # Allow up to 50MB increase113- MAX_INCREASE=52428800114-115- if [ "$DIFF" -gt "$MAX_INCREASE" ]; then116- echo "ERROR: Image size increased by ${DIFF_MB}MB (max allowed: 50MB)"117- echo "Base: $((BASE_SIZE / 1048576))MB"118- echo "PR: $((PR_SIZE / 1048576))MB"119- exit 1120- fi121-122- echo "Size change: ${DIFF_MB}MB"123+check-size-regression:124+ runs-on: ubuntu-latest125+ steps:126+ - uses: actions/checkout@v4127+ with:128+ fetch-depth: 0 # Need full history for base branch129+130+ - name: Install Nix131+ uses: cachix/install-nix-action@v27132+ with:133+ extra_nix_config: |134+ extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com135+ extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=136+137+ - name: Analyze PR branch138+ run: |139+ nix run .#image-size-analyzer -- --image Dockerfile-17 --json > pr-sizes.json140+141+ - name: Analyze base branch142+ run: |143+ git checkout ${{ github.base_ref }}144+ nix run .#image-size-analyzer -- --image Dockerfile-17 --json > base-sizes.json145+ git checkout -146+147+ - name: Compare sizes148+ run: |149+ PR_SIZE=$(jq -r '.images[0].total_size_bytes' pr-sizes.json)150+ BASE_SIZE=$(jq -r '.images[0].total_size_bytes' base-sizes.json)151+152+ DIFF=$((PR_SIZE - BASE_SIZE))153+ DIFF_MB=$((DIFF / 1048576))154+155+ # Allow up to 50MB increase156+ MAX_INCREASE=52428800157+158+ if [ "$DIFF" -gt "$MAX_INCREASE" ]; then159+ echo "ERROR: Image size increased by ${DIFF_MB}MB (max allowed: 50MB)"160+ echo "Base: $((BASE_SIZE / 1048576))MB"161+ echo "PR: $((PR_SIZE / 1048576))MB"162+ exit 1163+ fi164+165+ echo "Size change: ${DIFF_MB}MB"166 ```167 168 ---