From e97eabbe73750040f3ccdd5d57b1dfbaa81ac491 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:13:36 +0400 Subject: [PATCH 01/12] Add action directory test --- .github/.workflows/test.yml | 21 +++++++++++++++++++++ tests/action/directory/a/a_test.js | 7 +++++++ tests/action/directory/a/a_test.min.js | 1 + tests/action/directory/b/b_test.js | 7 +++++++ tests/action/directory/b/b_test.min.js | 1 + tests/action/directory/c/c_test.js | 7 +++++++ tests/action/directory/c/c_test.min.js | 1 + tests/action/directory/main_test.js | 7 +++++++ tests/action/directory/main_test.min.js | 1 + 9 files changed, 53 insertions(+) create mode 100644 .github/.workflows/test.yml create mode 100644 tests/action/directory/a/a_test.js create mode 100644 tests/action/directory/a/a_test.min.js create mode 100644 tests/action/directory/b/b_test.js create mode 100644 tests/action/directory/b/b_test.min.js create mode 100644 tests/action/directory/c/c_test.js create mode 100644 tests/action/directory/c/c_test.min.js create mode 100644 tests/action/directory/main_test.js create mode 100644 tests/action/directory/main_test.min.js diff --git a/.github/.workflows/test.yml b/.github/.workflows/test.yml new file mode 100644 index 0000000..06b41ca --- /dev/null +++ b/.github/.workflows/test.yml @@ -0,0 +1,21 @@ +on: + push: + pull_request: + branches: + - master + +jobs: + action/directory: + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Targets the specified directory + uses: ./ + with: + directory: 'tests/action/directory/*' + + - name: Compare the minified files + run: | + git diff --exit-code diff --git a/tests/action/directory/a/a_test.js b/tests/action/directory/a/a_test.js new file mode 100644 index 0000000..1fd79f6 --- /dev/null +++ b/tests/action/directory/a/a_test.js @@ -0,0 +1,7 @@ +function print_hello() { + console.log('hello world from a'); +} + +window.addEventListener('load', function () { + print_hello(); +}); diff --git a/tests/action/directory/a/a_test.min.js b/tests/action/directory/a/a_test.min.js new file mode 100644 index 0000000..4cd27e2 --- /dev/null +++ b/tests/action/directory/a/a_test.min.js @@ -0,0 +1 @@ +function print_hello(){console.log("hello world from a")}window.addEventListener("load",function(){print_hello()}); diff --git a/tests/action/directory/b/b_test.js b/tests/action/directory/b/b_test.js new file mode 100644 index 0000000..1bdde8d --- /dev/null +++ b/tests/action/directory/b/b_test.js @@ -0,0 +1,7 @@ +function print_hello() { + console.log('hello world from b'); +} + +window.addEventListener('load', function () { + print_hello(); +}); diff --git a/tests/action/directory/b/b_test.min.js b/tests/action/directory/b/b_test.min.js new file mode 100644 index 0000000..5ad2966 --- /dev/null +++ b/tests/action/directory/b/b_test.min.js @@ -0,0 +1 @@ +function print_hello(){console.log("hello world from b")}window.addEventListener("load",function(){print_hello()}); diff --git a/tests/action/directory/c/c_test.js b/tests/action/directory/c/c_test.js new file mode 100644 index 0000000..cb9803a --- /dev/null +++ b/tests/action/directory/c/c_test.js @@ -0,0 +1,7 @@ +function print_hello() { + console.log('hello world from c'); +} + +window.addEventListener('load', function () { + print_hello(); +}); diff --git a/tests/action/directory/c/c_test.min.js b/tests/action/directory/c/c_test.min.js new file mode 100644 index 0000000..25d7111 --- /dev/null +++ b/tests/action/directory/c/c_test.min.js @@ -0,0 +1 @@ +function print_hello(){console.log("hello world from c")}window.addEventListener("load",function(){print_hello()}); diff --git a/tests/action/directory/main_test.js b/tests/action/directory/main_test.js new file mode 100644 index 0000000..7f7762e --- /dev/null +++ b/tests/action/directory/main_test.js @@ -0,0 +1,7 @@ +function print_hello() { + console.log('hello world from main'); +} + +window.addEventListener('load', function () { + print_hello(); +}); diff --git a/tests/action/directory/main_test.min.js b/tests/action/directory/main_test.min.js new file mode 100644 index 0000000..9f85b6f --- /dev/null +++ b/tests/action/directory/main_test.min.js @@ -0,0 +1 @@ +function print_hello(){console.log("hello world from main")}window.addEventListener("load",function(){print_hello()}); From 4ae905149ca8539fc0802de3c4fbe766f6abc311 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:34:53 +0400 Subject: [PATCH 02/12] Switch workflow to push only --- .github/.workflows/test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/.workflows/test.yml b/.github/.workflows/test.yml index 06b41ca..73e7099 100644 --- a/.github/.workflows/test.yml +++ b/.github/.workflows/test.yml @@ -1,8 +1,4 @@ -on: - push: - pull_request: - branches: - - master +on: [push] jobs: action/directory: From 5df71b45694e604d124f764010559391c43f2a58 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:38:32 +0400 Subject: [PATCH 03/12] Switch workflow to include pull_request --- .github/.workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/.workflows/test.yml b/.github/.workflows/test.yml index 73e7099..5459220 100644 --- a/.github/.workflows/test.yml +++ b/.github/.workflows/test.yml @@ -1,4 +1,6 @@ -on: [push] +on: + push: + pull_request: jobs: action/directory: From fb8750a48751fb61ad1c5fab8a0d260aaf762edb Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:42:55 +0400 Subject: [PATCH 04/12] Test workflow by using action --- .github/.workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/.workflows/test.yml b/.github/.workflows/test.yml index 5459220..0805fca 100644 --- a/.github/.workflows/test.yml +++ b/.github/.workflows/test.yml @@ -10,7 +10,7 @@ jobs: uses: actions/checkout@v4 - name: Targets the specified directory - uses: ./ + uses: nizarmah@auto-minify with: directory: 'tests/action/directory/*' From c4d2e3ff3c839edb01ea645efe2b5645a4337442 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:44:50 +0400 Subject: [PATCH 05/12] Add workflow manual trigger --- .github/.workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/.workflows/test.yml b/.github/.workflows/test.yml index 0805fca..e5c1911 100644 --- a/.github/.workflows/test.yml +++ b/.github/.workflows/test.yml @@ -1,6 +1,7 @@ on: push: pull_request: + workflow_dispatch: jobs: action/directory: From 40ef3f490f335e7d0330b7d3a7833fb7f6c459c2 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:50:14 +0400 Subject: [PATCH 06/12] Try to fix the workflow again --- .github/.workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/.workflows/test.yml b/.github/.workflows/test.yml index e5c1911..b45f99c 100644 --- a/.github/.workflows/test.yml +++ b/.github/.workflows/test.yml @@ -1,10 +1,12 @@ on: push: + branches: ["master"] pull_request: + branches: ["master"] workflow_dispatch: jobs: - action/directory: + action-directory: runs-on: ubuntu-latest steps: - name: Checkout the repository From 3bec39b9680cd2331246528914b3ebcd8545ff51 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:52:09 +0400 Subject: [PATCH 07/12] Fix workflows directory naming --- .github/{.workflows => workflows}/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/{.workflows => workflows}/test.yml (95%) diff --git a/.github/.workflows/test.yml b/.github/workflows/test.yml similarity index 95% rename from .github/.workflows/test.yml rename to .github/workflows/test.yml index b45f99c..bd94fc2 100644 --- a/.github/.workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - action-directory: + action/directory: runs-on: ubuntu-latest steps: - name: Checkout the repository From 1890539926643011266a00eec503f6d98d2817ad Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 16:53:21 +0400 Subject: [PATCH 08/12] Revert to action path in workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd94fc2..4909920 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Targets the specified directory - uses: nizarmah@auto-minify + uses: ./ with: directory: 'tests/action/directory/*' From c25cf0fc1bd6e99a9f09d9e014ee1677b0821f7b Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 17:02:19 +0400 Subject: [PATCH 09/12] Fix job naming --- .github/workflows/test.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4909920..ec7ed2b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,5 @@ +name: Test workflow + on: push: branches: ["master"] @@ -6,17 +8,23 @@ on: workflow_dispatch: jobs: - action/directory: + action: runs-on: ubuntu-latest + + strategy: + matrix: + include: + - test: directory + params: + directory: 'tests/action/directory/*' + steps: - name: Checkout the repository uses: actions/checkout@v4 - name: Targets the specified directory uses: ./ - with: - directory: 'tests/action/directory/*' + with: ${{ toJSON(matrix.params) }} - name: Compare the minified files - run: | - git diff --exit-code + run: git diff --exit-code From c540376e8b5629712d58d0a2e8572582b9792972 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 17:15:45 +0400 Subject: [PATCH 10/12] Fix strategy matrix usage --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec7ed2b..7616322 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,22 +9,25 @@ on: jobs: action: + name: "Tests the action inputs" + runs-on: ubuntu-latest strategy: matrix: include: - - test: directory - params: + - name: "Targets the specified directory" + with: directory: 'tests/action/directory/*' steps: - name: Checkout the repository uses: actions/checkout@v4 - - name: Targets the specified directory + - name: ${{ matrix.name }} uses: ./ - with: ${{ toJSON(matrix.params) }} + with: + directory: ${{ matrix.with.directory }} - name: Compare the minified files run: git diff --exit-code From 774bd5e973867c6004b7055666c2eafc66ab8d48 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 17:44:32 +0400 Subject: [PATCH 11/12] Separate matrices to jobs --- .github/workflows/test.yml | 17 +++-------------- tests/action/directory/a/{a_test.js => a.js} | 0 .../directory/a/{a_test.min.js => a.min.js} | 2 +- tests/action/directory/b/{b_test.js => b.js} | 0 tests/action/directory/b/b_test.min.js | 1 - tests/action/directory/c/c_test.js | 7 ------- tests/action/directory/c/c_test.min.js | 1 - tests/action/directory/main_test.js | 7 ------- tests/action/directory/main_test.min.js | 1 - 9 files changed, 4 insertions(+), 32 deletions(-) rename tests/action/directory/a/{a_test.js => a.js} (100%) rename tests/action/directory/a/{a_test.min.js => a.min.js} (55%) rename tests/action/directory/b/{b_test.js => b.js} (100%) delete mode 100644 tests/action/directory/b/b_test.min.js delete mode 100644 tests/action/directory/c/c_test.js delete mode 100644 tests/action/directory/c/c_test.min.js delete mode 100644 tests/action/directory/main_test.js delete mode 100644 tests/action/directory/main_test.min.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7616322..b46827b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,3 @@ -name: Test workflow - on: push: branches: ["master"] @@ -8,26 +6,17 @@ on: workflow_dispatch: jobs: - action: - name: "Tests the action inputs" - + directory: runs-on: ubuntu-latest - strategy: - matrix: - include: - - name: "Targets the specified directory" - with: - directory: 'tests/action/directory/*' - steps: - name: Checkout the repository uses: actions/checkout@v4 - - name: ${{ matrix.name }} + - name: Targets specific directory uses: ./ with: - directory: ${{ matrix.with.directory }} + directory: "tests/action/directory/a/*" - name: Compare the minified files run: git diff --exit-code diff --git a/tests/action/directory/a/a_test.js b/tests/action/directory/a/a.js similarity index 100% rename from tests/action/directory/a/a_test.js rename to tests/action/directory/a/a.js diff --git a/tests/action/directory/a/a_test.min.js b/tests/action/directory/a/a.min.js similarity index 55% rename from tests/action/directory/a/a_test.min.js rename to tests/action/directory/a/a.min.js index 4cd27e2..e939a8a 100644 --- a/tests/action/directory/a/a_test.min.js +++ b/tests/action/directory/a/a.min.js @@ -1 +1 @@ -function print_hello(){console.log("hello world from a")}window.addEventListener("load",function(){print_hello()}); +function print_hello(){console.log("hello world from a")}window.addEventListener("load",function(){print_hello()}); \ No newline at end of file diff --git a/tests/action/directory/b/b_test.js b/tests/action/directory/b/b.js similarity index 100% rename from tests/action/directory/b/b_test.js rename to tests/action/directory/b/b.js diff --git a/tests/action/directory/b/b_test.min.js b/tests/action/directory/b/b_test.min.js deleted file mode 100644 index 5ad2966..0000000 --- a/tests/action/directory/b/b_test.min.js +++ /dev/null @@ -1 +0,0 @@ -function print_hello(){console.log("hello world from b")}window.addEventListener("load",function(){print_hello()}); diff --git a/tests/action/directory/c/c_test.js b/tests/action/directory/c/c_test.js deleted file mode 100644 index cb9803a..0000000 --- a/tests/action/directory/c/c_test.js +++ /dev/null @@ -1,7 +0,0 @@ -function print_hello() { - console.log('hello world from c'); -} - -window.addEventListener('load', function () { - print_hello(); -}); diff --git a/tests/action/directory/c/c_test.min.js b/tests/action/directory/c/c_test.min.js deleted file mode 100644 index 25d7111..0000000 --- a/tests/action/directory/c/c_test.min.js +++ /dev/null @@ -1 +0,0 @@ -function print_hello(){console.log("hello world from c")}window.addEventListener("load",function(){print_hello()}); diff --git a/tests/action/directory/main_test.js b/tests/action/directory/main_test.js deleted file mode 100644 index 7f7762e..0000000 --- a/tests/action/directory/main_test.js +++ /dev/null @@ -1,7 +0,0 @@ -function print_hello() { - console.log('hello world from main'); -} - -window.addEventListener('load', function () { - print_hello(); -}); diff --git a/tests/action/directory/main_test.min.js b/tests/action/directory/main_test.min.js deleted file mode 100644 index 9f85b6f..0000000 --- a/tests/action/directory/main_test.min.js +++ /dev/null @@ -1 +0,0 @@ -function print_hello(){console.log("hello world from main")}window.addEventListener("load",function(){print_hello()}); From 15834cd31e32d89165acc2bd489ff3d6c75097b6 Mon Sep 17 00:00:00 2001 From: Nizar Date: Sun, 17 Mar 2024 17:45:37 +0400 Subject: [PATCH 12/12] Update workflow name --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b46827b..b0712d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,5 @@ +name: test + on: push: branches: ["master"]