2424 - name : Setup Bun
2525 uses : oven-sh/setup-bun@v2
2626 with :
27- bun-version : " 1.3.6 "
27+ bun-version : " 1.3.10 "
2828
2929 - name : Install dependencies
3030 run : bun install --frozen-lockfile
@@ -101,6 +101,11 @@ jobs:
101101 input : " test-action/input.js"
102102 output : " test-action/output.min.js"
103103 compressor : " terser"
104+ auto : ' false'
105+ patterns : ' '
106+ output-dir : ' dist'
107+ ignore : ' '
108+ dry-run : ' false'
104109
105110 - name : Verify terser outputs
106111 env :
@@ -137,6 +142,11 @@ jobs:
137142 output : " test-action/output.esbuild.js"
138143 compressor : " esbuild"
139144 type : " js"
145+ auto : ' false'
146+ patterns : ' '
147+ output-dir : ' dist'
148+ ignore : ' '
149+ dry-run : ' false'
140150
141151 - name : Compare results
142152 env :
@@ -217,6 +227,11 @@ jobs:
217227 output : " test-action/output.min.css"
218228 compressor : " lightningcss"
219229 type : " css"
230+ auto : ' false'
231+ patterns : ' '
232+ output-dir : ' dist'
233+ ignore : ' '
234+ dry-run : ' false'
220235
221236 - name : Verify CSS output
222237 run : |
@@ -231,10 +246,161 @@ jobs:
231246
232247 cat test-action/output.min.css
233248
249+ test-zero-config :
250+ name : Test Zero Config (Auto Mode)
251+ runs-on : ubuntu-latest
252+ needs : build-action
253+ steps :
254+ - uses : actions/checkout@v4
255+
256+ - name : Download built action
257+ uses : actions/download-artifact@v4
258+ with :
259+ name : action-dist
260+ path : packages/action/dist/
261+
262+ - name : Setup Node.js
263+ uses : actions/setup-node@v4
264+ with :
265+ node-version : " 20"
266+
267+ - name : Install compressors
268+ run : |
269+ mkdir -p /tmp/compressors && cd /tmp/compressors
270+ npm init -y
271+ npm install @node-minify/terser @node-minify/lightningcss
272+ mkdir -p $GITHUB_WORKSPACE/node_modules
273+ cp -r /tmp/compressors/node_modules/* $GITHUB_WORKSPACE/node_modules/
274+
275+ - name : Create test files
276+ run : |
277+ mkdir -p src
278+ cat > src/app.js << 'EOF'
279+ function hello() { console.log("hello world"); }
280+ EOF
281+
282+ cat > src/utils.js << 'EOF'
283+ export const add = (a, b) => a + b;
284+ EOF
285+
286+ cat > src/styles.css << 'EOF'
287+ body { margin: 0; padding: 0; }
288+ EOF
289+
290+ - name : Run auto mode
291+ uses : ./
292+ with :
293+ auto : " true"
294+ output-dir : " dist"
295+
296+ - name : Verify outputs
297+ run : |
298+ test -f dist/src/app.js || (echo "dist/src/app.js not found" && exit 1)
299+ test -f dist/src/utils.js || (echo "dist/src/utils.js not found" && exit 1)
300+ test -f dist/src/styles.css || (echo "dist/src/styles.css not found" && exit 1)
301+ echo "All output files created successfully"
302+
303+ test-zero-config-dry-run :
304+ name : Test Zero Config Dry Run
305+ runs-on : ubuntu-latest
306+ needs : build-action
307+ steps :
308+ - uses : actions/checkout@v4
309+
310+ - name : Download built action
311+ uses : actions/download-artifact@v4
312+ with :
313+ name : action-dist
314+ path : packages/action/dist/
315+
316+ - name : Setup Node.js
317+ uses : actions/setup-node@v4
318+ with :
319+ node-version : " 20"
320+
321+ - name : Install compressor
322+ run : |
323+ mkdir -p /tmp/compressors && cd /tmp/compressors
324+ npm init -y
325+ npm install @node-minify/terser
326+ mkdir -p $GITHUB_WORKSPACE/node_modules
327+ cp -r /tmp/compressors/node_modules/* $GITHUB_WORKSPACE/node_modules/
328+
329+ - name : Create test file
330+ run : |
331+ mkdir -p src
332+ cat > src/app.js << 'EOF'
333+ function test() { return 42; }
334+ EOF
335+
336+ - name : Run dry-run mode
337+ uses : ./
338+ with :
339+ auto : " true"
340+ dry-run : " true"
341+ output-dir : " dist"
342+
343+ - name : Verify no output created
344+ run : |
345+ test ! -d dist || (echo "dist/ should not exist in dry-run" && exit 1)
346+ echo "Dry-run passed - no output created"
347+
348+ test-zero-config-custom-patterns :
349+ name : Test Zero Config Custom Patterns
350+ runs-on : ubuntu-latest
351+ needs : build-action
352+ steps :
353+ - uses : actions/checkout@v4
354+
355+ - name : Download built action
356+ uses : actions/download-artifact@v4
357+ with :
358+ name : action-dist
359+ path : packages/action/dist/
360+
361+ - name : Setup Node.js
362+ uses : actions/setup-node@v4
363+ with :
364+ node-version : " 20"
365+
366+ - name : Install compressor
367+ run : |
368+ mkdir -p /tmp/compressors && cd /tmp/compressors
369+ npm init -y
370+ npm install @node-minify/terser
371+ mkdir -p $GITHUB_WORKSPACE/node_modules
372+ cp -r /tmp/compressors/node_modules/* $GITHUB_WORKSPACE/node_modules/
373+
374+ - name : Create files in custom directory
375+ run : |
376+ mkdir -p custom/path
377+ cat > custom/path/main.js << 'EOF'
378+ console.log("custom location");
379+ EOF
380+
381+ - name : Run with custom patterns
382+ uses : ./
383+ with :
384+ auto : " true"
385+ patterns : " custom/**/*.js"
386+ output-dir : " dist"
387+
388+ - name : Verify custom output
389+ run : |
390+ test -f dist/custom/path/main.js || (echo "dist/custom/path/main.js not found" && exit 1)
391+ echo "Custom patterns worked correctly"
392+
234393 test-summary :
235394 name : Summary
236395 runs-on : ubuntu-latest
237- needs : [test-js-minification, test-css-minification]
396+ needs :
397+ [
398+ test-js-minification,
399+ test-css-minification,
400+ test-zero-config,
401+ test-zero-config-dry-run,
402+ test-zero-config-custom-patterns,
403+ ]
238404 steps :
239405 - name : All tests passed
240406 run : echo "All node-minify action tests passed!"
0 commit comments