Compare commits

...

30 Commits

Author SHA1 Message Date
Bryan Maass
6c2862e556 fix functions in options already 2025-07-10 11:49:32 -06:00
Bryan Maass
813a68c70c Merge branch 'optimize-docs-images' of github.com:metabase/metabase into optimize-docs-images 2025-07-09 17:02:12 -06:00
Bryan Maass
7d11438e18 remove test pics 2025-07-09 17:01:05 -06:00
Metabase Automation
d2d2dc4607 Optimized 2 images, saved 333.0 KB (46.1% smaller) 2025-07-09 23:00:15 +00:00
Bryan Maass
58750bfe0f bump images 2025-07-09 16:58:35 -06:00
Bryan Maass
3af95b5934 Merge branch 'optimize-docs-images' of github.com:metabase/metabase into optimize-docs-images 2025-07-09 16:57:29 -06:00
Bryan Maass
f3847e21bd include % difference when possible 2025-07-09 16:56:58 -06:00
Metabase Automation
5bd839bd96 Optimized 2 images, saved 260.3 KB 2025-07-09 22:50:55 +00:00
Bryan Maass
411bf6aeff Merge branch 'optimize-docs-images' of github.com:metabase/metabase into optimize-docs-images 2025-07-09 16:48:59 -06:00
Bryan Maass
ada18c3c97 update workflow + churn images 2025-07-09 16:48:21 -06:00
Metabase Automation
bc1581d396 Auto-optimize PNG images with pngcrush 2025-07-09 22:38:07 +00:00
Bryan Maass
821068fa3c Merge branch 'optimize-docs-images' of github.com:metabase/metabase into optimize-docs-images 2025-07-09 16:36:01 -06:00
Bryan Maass
b5212907e1 test nine 2025-07-09 16:33:47 -06:00
Bryan Maass
db7ec0cd5f switch to pngcrush 2025-07-09 16:33:01 -06:00
Metabase Automation
376da2e65d Auto-optimize PNG images with ImageMagick 2025-07-09 22:12:53 +00:00
bryan
1dc0374023 Merge branch 'master' into optimize-docs-images 2025-07-09 16:10:53 -06:00
Bryan Maass
92d65b5c1a remove test image 2025-07-09 16:10:07 -06:00
Metabase Automation
c9914dc9c5 Auto-optimize PNG images with ImageMagick 2025-07-09 22:06:08 +00:00
Bryan Maass
1e2722cfbc add yet another image 2025-07-09 16:05:14 -06:00
Bryan Maass
f44ca48f0a finally fix optimize images script 2025-07-09 16:01:17 -06:00
Bryan Maass
90f089a563 add an uncompressed image 2025-07-09 16:00:48 -06:00
Bryan Maass
adf29f76f1 add test png
improve workflow output

properly detect staged changes instead of working directory changes

remove test png

readd test png

fix glob expansion

remove test png

readd test png

fix script

bump

switch to push

update change detection

rename unmogrified test.png -> test2.png

git add the staged files directly (shell expansion?)

docs/test2.png -> docs/test3.png

match the username + email to CLA-signed 'user'

add test5 (unmogged)

Auto-optimize PNG images with ImageMagick
2025-07-09 16:00:33 -06:00
Bryan Maass
62bd10a166 Merge remote-tracking branch 'origin/master' into optimize-docs-images 2025-07-08 12:07:00 -06:00
Aleksandr Lesnenko
d3f5cd9ea9 filters in dashcards tracking (#60517)
* filters in dashcards tracking

* update tracking according to spec
2025-07-08 12:06:25 -06:00
Jeff Bruemmer
6f7ddfc379 docs - compress images (#60579)
* compress images

* more images
2025-07-08 12:06:25 -06:00
Aleksandr Lesnenko
faa726ff58 show active y-axis split lines on hover (#60238)
* show y-axis split line on hover

* fix axis split line visibility on hover

* review
2025-07-08 12:06:25 -06:00
Romeo Van Snick
0914133343 Preview native query with snippet (#60559)
* Allow previewing query that only has snippets

* Add e2e test
2025-07-08 12:06:25 -06:00
bryan
bdda10cbab Update .github/workflows/optimize-images.yml
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2025-07-07 15:31:37 -06:00
Bryan Maass
6b66cd24fa tweak script 2025-07-07 14:52:50 -06:00
Bryan Maass
c827f48325 add image optimizer
- This runs when there is a png file in /docs commited. For all such
files, when it can be optimized via ImageMagick's `mogrify`, adds it to
the PR.
2025-07-07 14:45:57 -06:00
5 changed files with 137 additions and 1 deletions

132
.github/workflows/optimize-images.yml vendored Normal file
View File

@@ -0,0 +1,132 @@
name: Auto-Optimize Docs PNG Images
on:
push:
paths:
- 'docs/**/*.png'
jobs:
optimize-images:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install pngcrush and bc
run: |
sudo apt-get update
sudo apt-get install -y pngcrush bc
- name: Get changed PNG files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
docs/**/*.png
- name: Optimize changed PNG files
if: steps.changed-files.outputs.any_changed == 'true'
id: optimize
run: |
echo "Optimizing PNG files with pngcrush..."
echo "Branch:" $(git_current_branch)
# Initialize tracking variables
total_files=0
total_before=0
total_after=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Processing: $file"
before_size=$(stat -c%s "$file")
# Use pngcrush with maximum lossless compression settings
# -rem alla removes all ancillary chunks (metadata)
# -brute tries all filter types and compression levels
# -ow overwrites the original file
pngcrush -rem alla -brute -ow "$file"
after_size=$(stat -c%s "$file")
echo " > Before: ${before_size} bytes, After: ${after_size} bytes"
# Track totals
total_files=$((total_files + 1))
total_before=$((total_before + before_size))
total_after=$((total_after + after_size))
done
# Calculate savings
total_saved=$((total_before - total_after))
# Output results for use in commit message
echo "files_optimized=${total_files}" >> "$GITHUB_OUTPUT"
echo "bytes_saved=${total_saved}" >> "$GITHUB_OUTPUT"
echo "total_before=${total_before}" >> "$GITHUB_OUTPUT"
echo "total_after=${total_after}" >> "$GITHUB_OUTPUT"
echo "Optimization complete"
echo "Files processed: ${total_files}"
echo "Total bytes saved: ${total_saved} (${total_before} -> ${total_after})"
- name: Check for changes after optimization
if: steps.changed-files.outputs.any_changed == 'true'
id: check_changes
run: |
git add ${{ steps.changed-files.outputs.all_changed_files }}
if git diff --quiet --cached; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
echo "No changes detected after optimization"
else
echo "has_changes=true" >> "$GITHUB_OUTPUT"
echo "Changes detected after optimization"
git diff --cached --stat
fi
- name: Commit optimized images
if: steps.changed-files.outputs.any_changed == 'true' && steps.check_changes.outputs.has_changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
run: |
git config --global user.email "github-automation@metabase.com"
git config --global user.name "Metabase Automation"
git add docs/**/*.png
# Format bytes saved for human readability
bytes_saved="${{ steps.optimize.outputs.bytes_saved }}"
bytes_before="${{ steps.optimize.outputs.total_before }}"
if [ "$bytes_saved" -gt 1048576 ]; then
# Convert to MB
size_saved=$(echo "scale=1; $bytes_saved / 1048576" | bc)
size_unit="MB"
elif [ "$bytes_saved" -gt 1024 ]; then
# Convert to KB
size_saved=$(echo "scale=1; $bytes_saved / 1024" | bc)
size_unit="KB"
else
size_saved="$bytes_saved"
size_unit="bytes"
fi
# Calculate percentage reduction
if [ "$bytes_before" -gt 0 ]; then
percentage=$(echo "scale=1; $bytes_saved * 100 / $bytes_before" | bc)
git commit -m "Optimized ${{ steps.optimize.outputs.files_optimized }} images, saved ${size_saved} ${size_unit} (${percentage}% smaller)"
else
git commit -m "Optimized ${{ steps.optimize.outputs.files_optimized }} images, saved ${size_saved} ${size_unit}"
fi
git push
echo 'Files optimized:'
echo ${{ steps.changed-files.outputs.all_changed_files }}
echo 'Applied: pngcrush -rem alla -brute -ow'
- name: Output summary
if: steps.changed-files.outputs.any_changed == 'true'
run: |
if [ "${{ steps.check_changes.outputs.has_changes }}" = "false" ]; then
echo "PNG files were already optimized - no changes needed"
else
echo "PNG files optimized and committed successfully"
fi

View File

@@ -144,6 +144,7 @@ For effective REPL usage:
- End all files with a newline.
- When editing tabular code, where the columns line up, try to keep them aligned.
- Spaces on a line with nothing after it is not allowed
## Critical REPL Usage Rules

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 628 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -72,7 +72,10 @@
[{:keys [options arg-schema] :as current-task}]
(try
(check-print-help current-task)
(let [*error-hit? (atom false)
(let [;; options are defined in bb.edn, as data,
;; so we need to eval them to get any functions to work
options #_:clj-kondo/ignore (eval options)
*error-hit? (atom false)
{:keys [summary]
option-errors :errors
:as parsed-opts} (tools.cli/parse-opts *command-line-args* options)