From 35758be044da2712485f6dfb4ec7239594a39151 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 15:56:34 +0530 Subject: [PATCH 01/80] Added workflow command support --- .../+ciplugins/+github/BuildTaskGroupPlugin.m | 22 +++++++++++++++++++ .../+ciplugins/+github/getDefaultPlugins.m | 13 +++++++++++ src/buildtool.ts | 2 +- src/buildtool.unit.test.ts | 8 +++---- src/index.ts | 15 +++++-------- 5 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 plugins/+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m create mode 100644 plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m diff --git a/plugins/+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m b/plugins/+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m new file mode 100644 index 0000000..36ec081 --- /dev/null +++ b/plugins/+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m @@ -0,0 +1,22 @@ +classdef BuildTaskGroupPlugin < matlab.buildtool.plugins.BuildRunnerPlugin + +% Copyright 2024 The MathWorks, Inc. + + methods (Access=protected) + + function runTask(plugin, pluginData) + % Add Github worflow command for grouping the tasks + disp("::group::" + pluginData.TaskResults.Name + " - task"); + + runTask@matlab.buildtool.plugins.BuildRunnerPlugin(plugin, pluginData); + + % Add Github workflow command ::error:: if the task is failed + if pluginData.TaskResults.Failed + disp("::error::" + pluginData.TaskResults.Name + " - task"); + end + + % Complete the group command + disp("::endgroup::"); + end + end + end \ No newline at end of file diff --git a/plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m b/plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m new file mode 100644 index 0000000..014261a --- /dev/null +++ b/plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m @@ -0,0 +1,13 @@ +function plugins = getDefaultPlugins(pluginProviderData) + +% Copyright 2024 The MathWorks, Inc. + +arguments + pluginProviderData (1,1) struct = struct(); +end + +plugins = [ ... + matlab.buildtool.internal.getFactoryDefaultPlugins(pluginProviderData) ... + matlab.ciplugins.github.BuildTaskGroupPlugin() ... +]; +end \ No newline at end of file diff --git a/src/buildtool.ts b/src/buildtool.ts index 8bf2d07..0cc2cc7 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -6,7 +6,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "buildtool"; + let command: string = "addpath('"+ process.cwd() +"/plugins');buildtool"; if (options.Tasks) { command = command + " " + options.Tasks; } diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 12e3b3d..8aafec2 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -10,7 +10,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("buildtool") + expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -19,7 +19,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("buildtool compile test") + expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -29,7 +29,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("buildtool -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -39,6 +39,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("buildtool compile test -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool compile test -continueOnFailure -skip check") }); }); diff --git a/src/index.ts b/src/index.ts index 6c24f07..e1c56a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,23 +13,20 @@ async function run() { const architecture = process.arch; const workspaceDir = process.cwd(); + // Export env variable to inject the buildtool plugin + core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'matlab.ciplugins.github.getDefaultPlugins'); + const options: buildtool.RunBuildOptions = { Tasks: core.getInput("tasks"), BuildOptions: core.getInput("build-options"), }; + core.info("Running MATLAB Build"); const command = buildtool.generateCommand(options); const startupOptions = core.getInput("startup-options").split(" "); - const helperScript = await core.group("Generate script", async () => { - const helperScript = await matlab.generateScript(workspaceDir, command); - core.info("Successfully generated script"); - return helperScript; - }); - - await core.group("Run command", async () => { - await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); - }); + const helperScript = await matlab.generateScript(workspaceDir, command); + await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); } run().catch((e) => { From efdf3d67d4070f56c211d5461ae434a96b6f221b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 16:11:29 +0530 Subject: [PATCH 02/80] Added test case in bat.yml --- .github/workflows/bat.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1a94da6..a12c66c 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -170,3 +170,23 @@ jobs: grep "deploying" buildlog.txt ! grep "checking" buildlog.txt rm buildlog.txt + + - name: Verify group workflow command added for tasks in buildlog.txt + run: | + set -e + grep "erroring" buildlog.txt + grep "::error::" buildlog.txt + grep "::group::tests - task" + rm buildlog.txt + + - name: Verify Running MATLAB build is appearing in buildlog.txt + run: | + set -e + grep "Running MATLAB Build" buildlog.txt + rm buildlog.txt + + - name: Verify Successfully generated script is not appearing in buildlog.txt + run: | + set -e + ! grep "Successfully generated script" buildlog.txt + rm buildlog.txt \ No newline at end of file From 3438257ebd4214ee753c686df400f75d4b3660dc Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 16:20:22 +0530 Subject: [PATCH 03/80] updated test case in bat.yml --- .github/workflows/bat.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index a12c66c..b99b1b3 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,6 +171,11 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt + - name: Run build with multiple specified tasks + uses: ./ + with: + tasks: error deploy check + - name: Verify group workflow command added for tasks in buildlog.txt run: | set -e @@ -179,12 +184,22 @@ jobs: grep "::group::tests - task" rm buildlog.txt + - name: Run build with multiple specified tasks + uses: ./ + with: + tasks: error deploy check + - name: Verify Running MATLAB build is appearing in buildlog.txt run: | set -e grep "Running MATLAB Build" buildlog.txt rm buildlog.txt + - name: Run build with multiple specified tasks + uses: ./ + with: + tasks: error deploy check + - name: Verify Successfully generated script is not appearing in buildlog.txt run: | set -e From e32eb509a0cf3731af32bd9a3cdcdea8c709f583 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 16:29:36 +0530 Subject: [PATCH 04/80] updated test case in bat.yml --- .github/workflows/bat.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index b99b1b3..b2591ba 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -175,6 +175,7 @@ jobs: uses: ./ with: tasks: error deploy check + build-options: -continueOnFailure - name: Verify group workflow command added for tasks in buildlog.txt run: | @@ -188,6 +189,7 @@ jobs: uses: ./ with: tasks: error deploy check + build-options: -continueOnFailure - name: Verify Running MATLAB build is appearing in buildlog.txt run: | @@ -199,6 +201,7 @@ jobs: uses: ./ with: tasks: error deploy check + build-options: -continueOnFailure - name: Verify Successfully generated script is not appearing in buildlog.txt run: | From 439a1a064b206dff435fb9f582f8c64082aaf968 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 16:35:28 +0530 Subject: [PATCH 05/80] updated test case in bat.yml --- .github/workflows/bat.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index b2591ba..9b96fda 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -174,7 +174,7 @@ jobs: - name: Run build with multiple specified tasks uses: ./ with: - tasks: error deploy check + tasks: error deploy build-options: -continueOnFailure - name: Verify group workflow command added for tasks in buildlog.txt @@ -188,7 +188,7 @@ jobs: - name: Run build with multiple specified tasks uses: ./ with: - tasks: error deploy check + tasks: deploy build-options: -continueOnFailure - name: Verify Running MATLAB build is appearing in buildlog.txt @@ -200,7 +200,7 @@ jobs: - name: Run build with multiple specified tasks uses: ./ with: - tasks: error deploy check + tasks: deploy build-options: -continueOnFailure - name: Verify Successfully generated script is not appearing in buildlog.txt From 32c6af6e820ed32d894c5b7e6d4c2746d9d50d5c Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 17:46:42 +0530 Subject: [PATCH 06/80] updated test case in bat.yml --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 9b96fda..c3328fe 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -182,7 +182,7 @@ jobs: set -e grep "erroring" buildlog.txt grep "::error::" buildlog.txt - grep "::group::tests - task" + grep "::group::error - task" rm buildlog.txt - name: Run build with multiple specified tasks From 334bc6b9516089918ad6656c7cd2f79a06a86a63 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:00:13 +0530 Subject: [PATCH 07/80] updated test case in bat.yml --- .github/workflows/bat.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index c3328fe..1fbf5b4 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,20 +171,6 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt - - name: Run build with multiple specified tasks - uses: ./ - with: - tasks: error deploy - build-options: -continueOnFailure - - - name: Verify group workflow command added for tasks in buildlog.txt - run: | - set -e - grep "erroring" buildlog.txt - grep "::error::" buildlog.txt - grep "::group::error - task" - rm buildlog.txt - - name: Run build with multiple specified tasks uses: ./ with: From e9712ef39c8edb032da37dc6a6a4f8bc15b2f3f7 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:14:40 +0530 Subject: [PATCH 08/80] updated test case in bat.yml --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1fbf5b4..6d63708 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -180,7 +180,7 @@ jobs: - name: Verify Running MATLAB build is appearing in buildlog.txt run: | set -e - grep "Running MATLAB Build" buildlog.txt + gh run view context.payload.workflow_run.id --log | grep "Running MATLAB Build" buildlog.txt rm buildlog.txt - name: Run build with multiple specified tasks From d915d32ab66f7038e460cb72c5b06d9955cfb690 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:23:55 +0530 Subject: [PATCH 09/80] updated test case in bat.yml --- .github/workflows/bat.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 6d63708..7ed41e0 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -181,7 +181,8 @@ jobs: run: | set -e gh run view context.payload.workflow_run.id --log | grep "Running MATLAB Build" buildlog.txt - rm buildlog.txt + env: + GITHUB_TOKEN: ${{ github.token }} - name: Run build with multiple specified tasks uses: ./ From d322f1ef4148b96f96546c9bd129bffea4592026 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:30:14 +0530 Subject: [PATCH 10/80] updated test case in bat.yml --- .github/workflows/bat.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 7ed41e0..46bfef2 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -180,9 +180,7 @@ jobs: - name: Verify Running MATLAB build is appearing in buildlog.txt run: | set -e - gh run view context.payload.workflow_run.id --log | grep "Running MATLAB Build" buildlog.txt - env: - GITHUB_TOKEN: ${{ github.token }} + grep "Running MATLAB Build" - name: Run build with multiple specified tasks uses: ./ @@ -193,5 +191,4 @@ jobs: - name: Verify Successfully generated script is not appearing in buildlog.txt run: | set -e - ! grep "Successfully generated script" buildlog.txt - rm buildlog.txt \ No newline at end of file + ! grep "Successfully generated script" From c7699ff4b6086e195c6474ee8ea3dbe016a00603 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:36:32 +0530 Subject: [PATCH 11/80] updated test case in bat.yml --- .github/workflows/bat.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 46bfef2..70d597f 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,8 +171,8 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt - - name: Run build with multiple specified tasks - uses: ./ + - name: Run build with multiple specified taskss + uses: ./ | grep "Running MATLAB Build" with: tasks: deploy build-options: -continueOnFailure From 0541e2639f798dce1ec973de9e17047085f3d7cc Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:45:14 +0530 Subject: [PATCH 12/80] updated test case in bat.yml --- .github/workflows/bat.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 70d597f..060037d 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -172,10 +172,13 @@ jobs: rm buildlog.txt - name: Run build with multiple specified taskss - uses: ./ | grep "Running MATLAB Build" + uses: ./ with: tasks: deploy build-options: -continueOnFailure + run: | + set -e + grep "Running MATLAB Build" - name: Verify Running MATLAB build is appearing in buildlog.txt run: | From fa7ec7164d6fa9042ba25a4d85a01542b886e8eb Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Tue, 14 May 2024 18:47:37 +0530 Subject: [PATCH 13/80] updated test case in bat.yml --- .github/workflows/bat.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 060037d..cffa566 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,27 +171,3 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt - - name: Run build with multiple specified taskss - uses: ./ - with: - tasks: deploy - build-options: -continueOnFailure - run: | - set -e - grep "Running MATLAB Build" - - - name: Verify Running MATLAB build is appearing in buildlog.txt - run: | - set -e - grep "Running MATLAB Build" - - - name: Run build with multiple specified tasks - uses: ./ - with: - tasks: deploy - build-options: -continueOnFailure - - - name: Verify Successfully generated script is not appearing in buildlog.txt - run: | - set -e - ! grep "Successfully generated script" From 944e31d2515c61b059f6c42914c82cc32a1ea127 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 10:48:27 +0530 Subject: [PATCH 14/80] updated test case in bat.yml --- .github/workflows/bat.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index cffa566..dfe6286 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,3 +171,11 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt + - name: Verify workflow commands appear in buildlog.log + run: | + set -e + matlab -batch "buildtool deploy" -logfile buildlog.log + grep "::group::" buildlog.log + grep "Running MATLAB Build" buildlog.log + rm buildlog.log + From 8c40a9db8476f7dcd33f0ab6097364bbe1f1abe0 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:10:27 +0530 Subject: [PATCH 15/80] updated test case in bat.yml --- .github/workflows/bat.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index dfe6286..1198c06 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,11 +171,8 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt - - name: Verify workflow commands appear in buildlog.log + - name: Verify environment variable is setup for MATLAB plugin override run: | - set -e - matlab -batch "buildtool deploy" -logfile buildlog.log - grep "::group::" buildlog.log - grep "Running MATLAB Build" buildlog.log - rm buildlog.log + set -e | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" + set -e | grep "matlab.ciplugins.github.getDefaultPlugins" From 7fcae0de6ddc9fc8382cd72c396ddcfa420ead0e Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:17:35 +0530 Subject: [PATCH 16/80] updated test case in bat.yml --- .github/workflows/bat.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1198c06..06ee2fd 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -173,6 +173,6 @@ jobs: - name: Verify environment variable is setup for MATLAB plugin override run: | - set -e | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" - set -e | grep "matlab.ciplugins.github.getDefaultPlugins" + set | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" + set | grep "matlab.ciplugins.github.getDefaultPlugins" From 64e9061ddfc2107765bbe0ef5f1c60771c1b8967 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:27:59 +0530 Subject: [PATCH 17/80] updated test case in bat.yml --- .github/workflows/bat.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 06ee2fd..d2452f9 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -175,4 +175,17 @@ jobs: run: | set | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" set | grep "matlab.ciplugins.github.getDefaultPlugins" + + + - name: Verify if Running MATLAB Build is displayed + uses: ./ + with: + tasks: deploy + build-options: -continueOnFailure + run: | + set -e + gh run view ${{ github.run_id }} --log | grep "Running MATLAB Build" + env: + GITHUB_TOKEN: ${{ github.token }} + From e504311eb0eff2e95de1f3b8c2cb114efc591a32 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:31:32 +0530 Subject: [PATCH 18/80] updated test case in bat.yml --- .github/workflows/bat.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index d2452f9..dce2dcf 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -177,11 +177,13 @@ jobs: set | grep "matlab.ciplugins.github.getDefaultPlugins" - - name: Verify if Running MATLAB Build is displayed + - name: Verify specific task is run uses: ./ with: tasks: deploy build-options: -continueOnFailure + + - name: Verify if Running MATLAB Build is displayed run: | set -e gh run view ${{ github.run_id }} --log | grep "Running MATLAB Build" From aa1ecc759f7a5a9a25c2bb0facfced6e78b61d4d Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:32:59 +0530 Subject: [PATCH 19/80] updated test case in bat.yml --- .github/workflows/bat.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index dce2dcf..aa438d3 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -180,8 +180,8 @@ jobs: - name: Verify specific task is run uses: ./ with: - tasks: deploy - build-options: -continueOnFailure + tasks: deploy + build-options: -continueOnFailure - name: Verify if Running MATLAB Build is displayed run: | From 4b7b3df4332cc23d2c2536abd1531001a4875477 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:40:46 +0530 Subject: [PATCH 20/80] updated test case in bat.yml --- .github/workflows/bat.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index aa438d3..1032dc4 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -2,6 +2,18 @@ name: Build and Test on: [push] jobs: + get-job-id: + runs-on: ubuntu-latest + name: 'BAT-JOB' # change SET-A-NEW-NAME + steps: + - name: set id + id: set-job-id + uses: ayachensiyuan/get-action-job-id@v1.6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + job-name: 'BAT-JOB' # must be the same as 'get-job-id.name' + bat: name: Build and Test runs-on: ubuntu-latest @@ -177,6 +189,7 @@ jobs: set | grep "matlab.ciplugins.github.getDefaultPlugins" + - name: Verify specific task is run uses: ./ with: @@ -186,7 +199,7 @@ jobs: - name: Verify if Running MATLAB Build is displayed run: | set -e - gh run view ${{ github.run_id }} --log | grep "Running MATLAB Build" + gh run view ${{ steps.set-job-id.outputs.jobId }} --log | grep "Running MATLAB Build" env: GITHUB_TOKEN: ${{ github.token }} From 7602966a9bb41069547338ed2810fa4f77b3effd Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:45:06 +0530 Subject: [PATCH 21/80] updated test case in bat.yml --- .github/workflows/bat.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 1032dc4..2c27bd7 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -2,18 +2,6 @@ name: Build and Test on: [push] jobs: - get-job-id: - runs-on: ubuntu-latest - name: 'BAT-JOB' # change SET-A-NEW-NAME - steps: - - name: set id - id: set-job-id - uses: ayachensiyuan/get-action-job-id@v1.6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - job-name: 'BAT-JOB' # must be the same as 'get-job-id.name' - bat: name: Build and Test runs-on: ubuntu-latest @@ -199,7 +187,7 @@ jobs: - name: Verify if Running MATLAB Build is displayed run: | set -e - gh run view ${{ steps.set-job-id.outputs.jobId }} --log | grep "Running MATLAB Build" + gh run view ${{ github.job }} --log | grep "Running MATLAB Build" env: GITHUB_TOKEN: ${{ github.token }} From 9f7b1de037109461aafb28b5edf9c690cf99607b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:55:13 +0530 Subject: [PATCH 22/80] updated test case in bat.yml --- .github/workflows/bat.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 2c27bd7..f6d6e8c 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,10 +184,17 @@ jobs: tasks: deploy build-options: -continueOnFailure + - name: Get Current Job Log URL + uses: Tiryoh/gha-jobid-action@v0 + id: jobs + with: + github_token: ${{ github.token }} + job_name: ${{ github.job }} + - name: Verify if Running MATLAB Build is displayed run: | set -e - gh run view ${{ github.job }} --log | grep "Running MATLAB Build" + gh run view ${{ steps.jobs.outputs.html_url }} --log | grep "Running MATLAB Build" env: GITHUB_TOKEN: ${{ github.token }} From 277c90276c62e26aaf2a346ee1a794b60c31035d Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 11:59:49 +0530 Subject: [PATCH 23/80] updated test case in bat.yml --- .github/workflows/bat.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index f6d6e8c..06ee2fd 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -175,27 +175,4 @@ jobs: run: | set | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" set | grep "matlab.ciplugins.github.getDefaultPlugins" - - - - - name: Verify specific task is run - uses: ./ - with: - tasks: deploy - build-options: -continueOnFailure - - - name: Get Current Job Log URL - uses: Tiryoh/gha-jobid-action@v0 - id: jobs - with: - github_token: ${{ github.token }} - job_name: ${{ github.job }} - - - name: Verify if Running MATLAB Build is displayed - run: | - set -e - gh run view ${{ steps.jobs.outputs.html_url }} --log | grep "Running MATLAB Build" - env: - GITHUB_TOKEN: ${{ github.token }} - From 536a5b37d89d9f4b40d13eac0e081076c363c0ce Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Wed, 15 May 2024 12:23:56 +0530 Subject: [PATCH 24/80] updated test case in bat.yml --- .github/workflows/bat.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 06ee2fd..495335b 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -173,6 +173,5 @@ jobs: - name: Verify environment variable is setup for MATLAB plugin override run: | - set | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" - set | grep "matlab.ciplugins.github.getDefaultPlugins" - + set | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" | grep "matlab.ciplugins.github.getDefaultPlugins" + From f22faa88e0d082c32be7bf579a187c71d8d78441 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 11:35:02 +0530 Subject: [PATCH 25/80] updated as per review coments --- .../+github/WorkflowCommandsPlugin.m} | 0 .../+ciplugins/+github/getDefaultPlugins.m | 2 +- src/index.ts | 10 ++++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) rename plugins/{+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m => +ciplugins/+github/WorkflowCommandsPlugin.m} (100%) rename plugins/{+matlab => }/+ciplugins/+github/getDefaultPlugins.m (82%) diff --git a/plugins/+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m b/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m similarity index 100% rename from plugins/+matlab/+ciplugins/+github/BuildTaskGroupPlugin.m rename to plugins/+ciplugins/+github/WorkflowCommandsPlugin.m diff --git a/plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m b/plugins/+ciplugins/+github/getDefaultPlugins.m similarity index 82% rename from plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m rename to plugins/+ciplugins/+github/getDefaultPlugins.m index 014261a..1f3d93e 100644 --- a/plugins/+matlab/+ciplugins/+github/getDefaultPlugins.m +++ b/plugins/+ciplugins/+github/getDefaultPlugins.m @@ -8,6 +8,6 @@ plugins = [ ... matlab.buildtool.internal.getFactoryDefaultPlugins(pluginProviderData) ... - matlab.ciplugins.github.BuildTaskGroupPlugin() ... + ciplugins.github.WorkflowCommandsPlugin() ... ]; end \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e1c56a7..c7ae468 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,14 +14,20 @@ async function run() { const workspaceDir = process.cwd(); // Export env variable to inject the buildtool plugin - core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'matlab.ciplugins.github.getDefaultPlugins'); + let runBuildEnvVars = { + ...process.env, + MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE: 'ciplugins.github.getDefaultPlugins' + }; + + let options: exec.ExecOptions = { + env: runBuildEnvVars + }; const options: buildtool.RunBuildOptions = { Tasks: core.getInput("tasks"), BuildOptions: core.getInput("build-options"), }; - core.info("Running MATLAB Build"); const command = buildtool.generateCommand(options); const startupOptions = core.getInput("startup-options").split(" "); From 9fd251e3feb160147497f7aa1baf23eea003d3d6 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 11:38:19 +0530 Subject: [PATCH 26/80] updated as per review coments --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index c7ae468..710b24b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,7 @@ async function run() { MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE: 'ciplugins.github.getDefaultPlugins' }; - let options: exec.ExecOptions = { + exec.ExecOptions = { env: runBuildEnvVars }; From f99223af57a0fddc502e5b0e3ecb726094302dc5 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 11:45:10 +0530 Subject: [PATCH 27/80] updated as per review coments --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 710b24b..ad099cf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,7 @@ async function run() { MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE: 'ciplugins.github.getDefaultPlugins' }; - exec.ExecOptions = { + let opt: exec.ExecOptions = { env: runBuildEnvVars }; @@ -32,7 +32,7 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); + await matlab.runCommand(helperScript, platform, architecture, exec.exec(opt), startupOptions); } run().catch((e) => { From 86a78ac98f69714e3cbb8ee262d4c9508b9dfbad Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 11:46:45 +0530 Subject: [PATCH 28/80] updated as per review coments --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index ad099cf..b398f8b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - await matlab.runCommand(helperScript, platform, architecture, exec.exec(opt), startupOptions); + await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); } run().catch((e) => { From 0595577334df09bbf5f350d9a789e86c4024bebc Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:20:24 +0530 Subject: [PATCH 29/80] updated as per review coments --- .github/workflows/bat.yml | 4 ---- plugins/+ciplugins/+github/WorkflowCommandsPlugin.m | 2 +- src/index.ts | 9 +-------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 495335b..cffa566 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,7 +171,3 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt - - name: Verify environment variable is setup for MATLAB plugin override - run: | - set | grep "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE" | grep "matlab.ciplugins.github.getDefaultPlugins" - diff --git a/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m b/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m index 36ec081..b455bd3 100644 --- a/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m +++ b/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m @@ -5,7 +5,7 @@ methods (Access=protected) function runTask(plugin, pluginData) - % Add Github worflow command for grouping the tasks + % Add Github workflow command for grouping the tasks disp("::group::" + pluginData.TaskResults.Name + " - task"); runTask@matlab.buildtool.plugins.BuildRunnerPlugin(plugin, pluginData); diff --git a/src/index.ts b/src/index.ts index b398f8b..bcf544f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,14 +14,7 @@ async function run() { const workspaceDir = process.cwd(); // Export env variable to inject the buildtool plugin - let runBuildEnvVars = { - ...process.env, - MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE: 'ciplugins.github.getDefaultPlugins' - }; - - let opt: exec.ExecOptions = { - env: runBuildEnvVars - }; + core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); const options: buildtool.RunBuildOptions = { Tasks: core.getInput("tasks"), From 3d02c04667ecab102ac0ce1f2b51bb742f34283c Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:35:20 +0530 Subject: [PATCH 30/80] updated as per review coments --- plugins/+ciplugins/+github/WorkflowCommandsPlugin.m | 2 +- scripts/setupdeps.sh | 4 ++++ src/buildtool.ts | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m b/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m index b455bd3..c5b45f6 100644 --- a/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m +++ b/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m @@ -1,4 +1,4 @@ -classdef BuildTaskGroupPlugin < matlab.buildtool.plugins.BuildRunnerPlugin +classdef WorkflowCommandsPlugin < matlab.buildtool.plugins.BuildRunnerPlugin % Copyright 2024 The MathWorks, Inc. diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index e324d94..2f07389 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -7,6 +7,10 @@ SUPPORTED_OS=('win64' 'maci64' 'maca64' 'glnxa64') DISTDIR="$(pwd)/dist/bin" mkdir -p $DISTDIR +# Create plugin DIR and copy plugin code +PLUGINDIR="$(pwd)/dist/plugins" +cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ + # Download and extract in a temporary directory WORKINGDIR=$(mktemp -d -t rmc_build.XXXXXX) cd $WORKINGDIR diff --git a/src/buildtool.ts b/src/buildtool.ts index 0cc2cc7..63d026e 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -1,4 +1,5 @@ // Copyright 2022-2024 The MathWorks, Inc. +import * as path from "path"; export interface RunBuildOptions { Tasks?: string; @@ -6,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "addpath('"+ process.cwd() +"/plugins');buildtool"; + let command: string = "addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } From 3a7de8d6070f1577cb0dccf8f674eddf89a279c2 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:39:21 +0530 Subject: [PATCH 31/80] updated as per review coments --- src/buildtool.unit.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 8aafec2..5193028 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -10,7 +10,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -19,7 +19,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool compile test") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -29,7 +29,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -39,6 +39,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ process.cwd() +"/plugins');buildtool compile test -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") }); }); From a1e87bda6031971ea4ca4b38566b46b1916b1317 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:41:01 +0530 Subject: [PATCH 32/80] updated as per review coments --- src/buildtool.unit.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 5193028..035fabd 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -1,5 +1,6 @@ // Copyright 2022-2024 The MathWorks, Inc. +import * as path from "path"; import * as buildtool from "./buildtool"; describe("command generation", () => { From e66e7e67c29679a3ae59bbb82c5bf311db58c33a Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:46:11 +0530 Subject: [PATCH 33/80] updated as per review coments --- src/buildtool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 63d026e..1239fa5 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "disp('nnn"+__dirname+"')addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } From 16f5c137729aedc2eefe2134fb73ad7ebcfe6ef1 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:47:35 +0530 Subject: [PATCH 34/80] updated as per review coments --- src/buildtool.unit.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 035fabd..6353630 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -11,7 +11,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -20,7 +20,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") + // expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -30,7 +30,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -40,6 +40,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") }); }); From 2abbe1f9a5d9836e191675e8b03af14aac8c5f26 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:51:02 +0530 Subject: [PATCH 35/80] updated as per review coments --- src/buildtool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 1239fa5..00767e5 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "disp('nnn"+__dirname+"')addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "disp('nnn"+__dirname+"'),addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } From 028ee8a9ed3b19a8f6efed4ace32186c75f4c516 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 12:58:07 +0530 Subject: [PATCH 36/80] updated as per review coments --- scripts/setupdeps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index 2f07389..381d08f 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -9,6 +9,7 @@ mkdir -p $DISTDIR # Create plugin DIR and copy plugin code PLUGINDIR="$(pwd)/dist/plugins" +mkdir -p $PLUGINDIR cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ # Download and extract in a temporary directory From bc14d9a3a5993ab0a49bd941eb9cce0eb1bd7cf3 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:07:15 +0530 Subject: [PATCH 37/80] updated as per review coments --- src/buildtool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 00767e5..1737268 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "disp('nnn"+__dirname+"'),addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "ls "+__dirname+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } From 814a293c38416eead37c37c91e9941801c95499d Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:12:39 +0530 Subject: [PATCH 38/80] updated as per review coments --- scripts/setupdeps.sh | 2 +- src/buildtool.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index 381d08f..42d70be 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -8,7 +8,7 @@ DISTDIR="$(pwd)/dist/bin" mkdir -p $DISTDIR # Create plugin DIR and copy plugin code -PLUGINDIR="$(pwd)/dist/plugins" +PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" mkdir -p $PLUGINDIR cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ diff --git a/src/buildtool.ts b/src/buildtool.ts index 1737268..74d5e74 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "ls "+__dirname+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "ls "+path.join(__dirname, "plugins")+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } From 47f2b89ee0f900efcf70dcfd39f8013d6a56cd5d Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:41:36 +0530 Subject: [PATCH 39/80] updated exec option --- scripts/setupdeps.sh | 2 +- src/buildtool.ts | 2 +- src/buildtool.unit.test.ts | 8 ++++---- src/index.ts | 5 ++++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index 42d70be..7909604 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -7,7 +7,7 @@ SUPPORTED_OS=('win64' 'maci64' 'maca64' 'glnxa64') DISTDIR="$(pwd)/dist/bin" mkdir -p $DISTDIR -# Create plugin DIR and copy plugin code +# Create plugin directory and copy plugin code PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" mkdir -p $PLUGINDIR cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ diff --git a/src/buildtool.ts b/src/buildtool.ts index 74d5e74..63d026e 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "ls "+path.join(__dirname, "plugins")+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 6353630..035fabd 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -11,7 +11,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -20,7 +20,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - // expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -30,7 +30,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -40,6 +40,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") }); }); diff --git a/src/index.ts b/src/index.ts index bcf544f..69fd801 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,10 @@ async function run() { const workspaceDir = process.cwd(); // Export env variable to inject the buildtool plugin - core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); + exec.ExecOptions = { + env: {[key: "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE"]: "ciplugins.github.getDefaultPlugins"} + }; + //core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); const options: buildtool.RunBuildOptions = { Tasks: core.getInput("tasks"), From a547663b1573202ce13779d584d3af4c747b052e Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:44:53 +0530 Subject: [PATCH 40/80] updated exec option --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 69fd801..44a38f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ async function run() { // Export env variable to inject the buildtool plugin exec.ExecOptions = { - env: {[key: "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE"]: "ciplugins.github.getDefaultPlugins"} + env: [key: "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE"]: "ciplugins.github.getDefaultPlugins" }; //core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); From 33586a9c234657831c2bc9a39e961e0b155ffeef Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:47:55 +0530 Subject: [PATCH 41/80] updated exec option --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 44a38f4..b4a97a2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ async function run() { // Export env variable to inject the buildtool plugin exec.ExecOptions = { - env: [key: "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE"]: "ciplugins.github.getDefaultPlugins" + env: "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE": "ciplugins.github.getDefaultPlugins" }; //core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); From 01c80249613b6e4082e9f61d685f3c9d7fe21072 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:54:29 +0530 Subject: [PATCH 42/80] updated exec option --- src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index b4a97a2..442613a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,8 +14,13 @@ async function run() { const workspaceDir = process.cwd(); // Export env variable to inject the buildtool plugin - exec.ExecOptions = { - env: "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE": "ciplugins.github.getDefaultPlugins" + let pluginEnvVar = { + ...process.env, + MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE: 'ciplugins.github.getDefaultPlugins' + }; + + let buildEnv: exec.ExecOptions = { + env: pluginEnvVar }; //core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); @@ -28,7 +33,7 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); + await matlab.runCommand(helperScript, platform, architecture, exec.exec('',[],buildEnv), startupOptions); } run().catch((e) => { From 64f6a93c7852105e17fb1a78bbe89714018a339e Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 13:55:42 +0530 Subject: [PATCH 43/80] updated exec option --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 442613a..5e6263c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,7 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - await matlab.runCommand(helperScript, platform, architecture, exec.exec('',[],buildEnv), startupOptions); + await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); } run().catch((e) => { From 9722d2481e65697955bad4fdf36299d6d04e8992 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 14:01:29 +0530 Subject: [PATCH 44/80] updated exec option --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5e6263c..a5982e1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,13 +14,13 @@ async function run() { const workspaceDir = process.cwd(); // Export env variable to inject the buildtool plugin - let pluginEnvVar = { + const pluginEnvVar = { ...process.env, - MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE: 'ciplugins.github.getDefaultPlugins' + 'MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE': 'ciplugins.github.getDefaultPlugins', }; - let buildEnv: exec.ExecOptions = { - env: pluginEnvVar + const buildEnv: exec.ExecOptions = { + env: pluginEnvVar, }; //core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); From 44487b8f7fd8e56cdcf151ef8fe1e05ca8c0f507 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 14:14:53 +0530 Subject: [PATCH 45/80] updated exec option --- src/index.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/index.ts b/src/index.ts index a5982e1..bcf544f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,15 +14,7 @@ async function run() { const workspaceDir = process.cwd(); // Export env variable to inject the buildtool plugin - const pluginEnvVar = { - ...process.env, - 'MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE': 'ciplugins.github.getDefaultPlugins', - }; - - const buildEnv: exec.ExecOptions = { - env: pluginEnvVar, - }; - //core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); + core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); const options: buildtool.RunBuildOptions = { Tasks: core.getInput("tasks"), From 9b55a5a3abb10e81263c7aacbb51627f398db865 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 16:35:32 +0530 Subject: [PATCH 46/80] Added test to parse log --- .github/workflows/bat.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index cffa566..469da2e 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -171,3 +171,12 @@ jobs: ! grep "checking" buildlog.txt rm buildlog.txt + - name: Verify grep + run: | + set -e + gh run view --job ${{ github.run_id }} --log | grep "##[group]build - deploy" + env: + GITHUB_TOKEN: ${{ github.token }} + + + From 4851124cfbb3d34f15f0d1788d92c8896aaae46d Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 16:41:43 +0530 Subject: [PATCH 47/80] Added test to parse log --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 469da2e..a239044 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -174,7 +174,7 @@ jobs: - name: Verify grep run: | set -e - gh run view --job ${{ github.run_id }} --log | grep "##[group]build - deploy" + gh run view ${{ github.run_id }} --log | grep "##[group]build - deploy" env: GITHUB_TOKEN: ${{ github.token }} From 8c149e8ce92c728372b9e3fab8de2447a0533de8 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 16:51:50 +0530 Subject: [PATCH 48/80] Testing grep --- .github/workflows/bat.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index a239044..f5c36cf 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -172,11 +172,17 @@ jobs: rm buildlog.txt - name: Verify grep - run: | - set -e - gh run view ${{ github.run_id }} --log | grep "##[group]build - deploy" env: GITHUB_TOKEN: ${{ github.token }} + run: | + URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" + AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}" + ACCEPT_HEADER="Accept: application/vnd.github.v3+json" + # Fetch job details and parse the JOB_ID + JOB_ID=$(curl -s -H "${AUTH_HEADER}" -H "${ACCEPT_HEADER}" "${URL}" | jq --arg JOB_NAME "$JOB_NAME" '.jobs[] | select(.name==$JOB_NAME) | .id') + echo "JOB_ID: $JOB_ID" + + From 62ea9ca82399f3c1cf5105e89a2af155fe1daa3f Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 16:58:09 +0530 Subject: [PATCH 49/80] Testing grep --- .github/workflows/bat.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index f5c36cf..98b9086 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -175,7 +175,8 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" + JOB_NAME="example" + URL="https://api.github.com/repos/run-build/actions/runs/${{ github.run_id }}/jobs" AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}" ACCEPT_HEADER="Accept: application/vnd.github.v3+json" # Fetch job details and parse the JOB_ID From 3a43c1f15904f8d21cc5a59d04fcde5ead4f3fb1 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:09:46 +0530 Subject: [PATCH 50/80] Testing grep --- .github/workflows/bat.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 98b9086..02340f3 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -175,15 +175,18 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} run: | - JOB_NAME="example" - URL="https://api.github.com/repos/run-build/actions/runs/${{ github.run_id }}/jobs" - AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}" - ACCEPT_HEADER="Accept: application/vnd.github.v3+json" - # Fetch job details and parse the JOB_ID - JOB_ID=$(curl -s -H "${AUTH_HEADER}" -H "${ACCEPT_HEADER}" "${URL}" | jq --arg JOB_NAME "$JOB_NAME" '.jobs[] | select(.name==$JOB_NAME) | .id') - echo "JOB_ID: $JOB_ID" + OWNER=${{ github.repository_owner }} + REPO=${{ github.repository }} + RUN_ID=${{ github.run_id }} + PATTERN="Error Message" + TOKEN=$GITHUB_TOKEN + curl -H "Authorization: token $TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ + -L -o logs.zip + unzip logs.zip -d ./logs + grep -R "group" ./logs - From fac0db31dd007b5c439be7b698a6a1f7aef0be1b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:15:18 +0530 Subject: [PATCH 51/80] Testing grep --- .github/workflows/bat.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 02340f3..a25082b 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,8 +184,9 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ -L -o logs.zip - unzip logs.zip -d ./logs - grep -R "group" ./logs + unzip logs.zip + ls + grep -R "group" From 1c187fc3a5162fe2ba37bd132a5347c27925966b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:19:31 +0530 Subject: [PATCH 52/80] Testing grep --- .github/workflows/bat.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index a25082b..c53c9cc 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,7 +184,6 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ -L -o logs.zip - unzip logs.zip ls grep -R "group" From 52147e972a656acf908d81152ed48f9f393bd5ae Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:31:51 +0530 Subject: [PATCH 53/80] Testing grep --- .github/workflows/bat.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index c53c9cc..86576a2 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,8 +184,7 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ -L -o logs.zip - ls - grep -R "group" + unzip logs.zip From d38df4dc3e562315688db0c8e1b6f63cc4870300 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:40:57 +0530 Subject: [PATCH 54/80] Testing grep --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 86576a2..da691fc 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,7 +184,7 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ -L -o logs.zip - unzip logs.zip + jar xvf logs.zip From 5c14e549052bb6646052967470dc9c671a10cd3b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:48:52 +0530 Subject: [PATCH 55/80] Testing grep --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index da691fc..33baaa9 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,7 +184,7 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ -L -o logs.zip - jar xvf logs.zip + gunzip logs.zip From 71b6f33828a44220acf9323be23433c157e8c86b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 17:57:19 +0530 Subject: [PATCH 56/80] Testing grep --- .github/workflows/bat.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 33baaa9..fea0a21 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -184,7 +184,9 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ -L -o logs.zip - gunzip logs.zip + gzip logs.zip + tar -xvf logs.zip.gz + ls From d01a23c2c0c1239fd73c530156c6e1d31b4cb3ce Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 18:04:12 +0530 Subject: [PATCH 57/80] reverted log changes --- .github/workflows/bat.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index fea0a21..7d4fb71 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -170,23 +170,6 @@ jobs: grep "deploying" buildlog.txt ! grep "checking" buildlog.txt rm buildlog.txt - - - name: Verify grep - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - OWNER=${{ github.repository_owner }} - REPO=${{ github.repository }} - RUN_ID=${{ github.run_id }} - PATTERN="Error Message" - TOKEN=$GITHUB_TOKEN - curl -H "Authorization: token $TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs" \ - -L -o logs.zip - gzip logs.zip - tar -xvf logs.zip.gz - ls From 1166e0fbacb1201637e83d33f9dad34c63a97e20 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 19:45:50 +0530 Subject: [PATCH 58/80] Added tests using log read --- .github/workflows/bat.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 7d4fb71..cce5fb6 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -170,6 +170,18 @@ jobs: grep "deploying" buildlog.txt ! grep "checking" buildlog.txt rm buildlog.txt + + - name: Run build with startup options + uses: ./ + with: + tasks: deploy + startup-options: -logfile console.log + + - name: Verify workflow command is added + run: | + grep "[group]build - deploy" console.log + rm console.log + From a6529407e8f5bcabd239b20f84500e2d27408bd8 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 19:54:28 +0530 Subject: [PATCH 59/80] Added tests using log read --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index cce5fb6..9e338cf 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -179,7 +179,7 @@ jobs: - name: Verify workflow command is added run: | - grep "[group]build - deploy" console.log + grep "[group]deploy - task" console.log rm console.log From d85a848ab57b6940ae45822270e664a3f6a21150 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 20:03:39 +0530 Subject: [PATCH 60/80] Added tests using log read --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 9e338cf..7e546a9 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -179,7 +179,7 @@ jobs: - name: Verify workflow command is added run: | - grep "[group]deploy - task" console.log + grep "deploy - task" console.log rm console.log From 652eccf858743e04e4f436aead91442518feaa42 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 20:10:48 +0530 Subject: [PATCH 61/80] Added tests using log read --- .github/workflows/bat.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 7e546a9..d1a7cdc 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -174,12 +174,14 @@ jobs: - name: Run build with startup options uses: ./ with: - tasks: deploy + tasks: error deploy + build-options: -continueOnFailure startup-options: -logfile console.log - name: Verify workflow command is added run: | grep "deploy - task" console.log + grep "::error::" console.log rm console.log From 3eb7edc40a9f44d5d60c312a2f9803a5a825c922 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 20:16:08 +0530 Subject: [PATCH 62/80] Added tests using log read --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index d1a7cdc..128405f 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -181,7 +181,7 @@ jobs: - name: Verify workflow command is added run: | grep "deploy - task" console.log - grep "::error::" console.log + grep "Error: error - task" console.log rm console.log From 717f10122e04266fce01c60bc5c61b43a8d9ef79 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 20:29:56 +0530 Subject: [PATCH 63/80] Added tests using log read --- .github/workflows/bat.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 128405f..d2411ee 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -172,6 +172,7 @@ jobs: rm buildlog.txt - name: Run build with startup options + continue-on-error: true uses: ./ with: tasks: error deploy @@ -181,7 +182,7 @@ jobs: - name: Verify workflow command is added run: | grep "deploy - task" console.log - grep "Error: error - task" console.log + grep "[error]error - task" console.log rm console.log From 693f9b6c5dd2eab2d53b208d95fe71be9c973bce Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 20:36:36 +0530 Subject: [PATCH 64/80] Added tests using log read --- .github/workflows/bat.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index d2411ee..75d018a 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -175,14 +175,14 @@ jobs: continue-on-error: true uses: ./ with: - tasks: error deploy + tasks: deploy error build-options: -continueOnFailure startup-options: -logfile console.log - name: Verify workflow command is added run: | grep "deploy - task" console.log - grep "[error]error - task" console.log + grep "::error::" console.log rm console.log From 85aa216c26419dd134982150cd5300577b412fae Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 20:41:16 +0530 Subject: [PATCH 65/80] Added tests using log read --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index 75d018a..bc261d0 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -181,7 +181,7 @@ jobs: - name: Verify workflow command is added run: | - grep "deploy - task" console.log + grep "::group::deploy - task" console.log grep "::error::" console.log rm console.log From 2d9adefe9dc6579aa866715c9c3d6d6995a2a238 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 21:32:31 +0530 Subject: [PATCH 66/80] Updated review comments --- .github/workflows/bat.yml | 9 ++------- scripts/setupdeps.sh | 7 ++++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index bc261d0..b5e4ff2 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -182,10 +182,5 @@ jobs: - name: Verify workflow command is added run: | grep "::group::deploy - task" console.log - grep "::error::" console.log - rm console.log - - - - - + grep "::error::error - task" console.log + rm console.log \ No newline at end of file diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index 7909604..81429fa 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -8,9 +8,10 @@ DISTDIR="$(pwd)/dist/bin" mkdir -p $DISTDIR # Create plugin directory and copy plugin code -PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" -mkdir -p $PLUGINDIR -cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ +#PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" +#mkdir -p $PLUGINDIR +#cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ +cp -R plugins $DISTDIR/ # Download and extract in a temporary directory WORKINGDIR=$(mktemp -d -t rmc_build.XXXXXX) From 23bb592db55a6473e502b81c6f4878f2d98444b5 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 21:46:05 +0530 Subject: [PATCH 67/80] changed copy path --- src/buildtool.ts | 2 +- src/buildtool.unit.test.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 63d026e..1737268 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "ls "+__dirname+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 035fabd..6a6ed04 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -11,7 +11,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -20,7 +20,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -30,7 +30,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -40,6 +40,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") + //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") }); }); From 971d2608b0d9f9304f16ad26245986e756262c0c Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 21:52:09 +0530 Subject: [PATCH 68/80] changed copy path --- src/buildtool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 1737268..181d73d 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "ls "+__dirname+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "ls "+path.join(__dirname, "bin")+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } From 02c1f8e4761c5ac797116bd31442cb29d81871ac Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 22:01:18 +0530 Subject: [PATCH 69/80] Reverted copy changes --- src/buildtool.ts | 2 +- src/buildtool.unit.test.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 181d73d..63d026e 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,7 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "ls "+path.join(__dirname, "bin")+",addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + let command: string = "addpath('"+ path.join(__dirname, "plugins") +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 6a6ed04..035fabd 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -11,7 +11,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -20,7 +20,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -30,7 +30,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -40,6 +40,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - //expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") }); }); From a89b9ebc71c546f685bceb25c25c796a6c49d3d1 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Thu, 16 May 2024 22:01:53 +0530 Subject: [PATCH 70/80] Reverted copy changes --- scripts/setupdeps.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index 81429fa..1aca884 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -8,10 +8,10 @@ DISTDIR="$(pwd)/dist/bin" mkdir -p $DISTDIR # Create plugin directory and copy plugin code -#PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" -#mkdir -p $PLUGINDIR -#cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ -cp -R plugins $DISTDIR/ +PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" +mkdir -p $PLUGINDIR +cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ + # Download and extract in a temporary directory WORKINGDIR=$(mktemp -d -t rmc_build.XXXXXX) From 0785f297d2018f5cd489bf4043509656340b0f6d Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Fri, 17 May 2024 12:14:58 +0530 Subject: [PATCH 71/80] Changed -cp strategy and plugin name --- .../+github/{WorkflowCommandsPlugin.m => GitHubLogPlugin.m} | 4 ++-- plugins/+ciplugins/+github/getDefaultPlugins.m | 2 +- scripts/setupdeps.sh | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) rename plugins/+ciplugins/+github/{WorkflowCommandsPlugin.m => GitHubLogPlugin.m} (87%) diff --git a/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m b/plugins/+ciplugins/+github/GitHubLogPlugin.m similarity index 87% rename from plugins/+ciplugins/+github/WorkflowCommandsPlugin.m rename to plugins/+ciplugins/+github/GitHubLogPlugin.m index c5b45f6..7e7efd8 100644 --- a/plugins/+ciplugins/+github/WorkflowCommandsPlugin.m +++ b/plugins/+ciplugins/+github/GitHubLogPlugin.m @@ -1,4 +1,4 @@ -classdef WorkflowCommandsPlugin < matlab.buildtool.plugins.BuildRunnerPlugin +classdef GitHubLogPlugin < matlab.buildtool.plugins.BuildRunnerPlugin % Copyright 2024 The MathWorks, Inc. @@ -12,7 +12,7 @@ function runTask(plugin, pluginData) % Add Github workflow command ::error:: if the task is failed if pluginData.TaskResults.Failed - disp("::error::" + pluginData.TaskResults.Name + " - task"); + disp("::error::" + pluginData.TaskResults.Name + " task failed"); end % Complete the group command diff --git a/plugins/+ciplugins/+github/getDefaultPlugins.m b/plugins/+ciplugins/+github/getDefaultPlugins.m index 1f3d93e..cf16bd5 100644 --- a/plugins/+ciplugins/+github/getDefaultPlugins.m +++ b/plugins/+ciplugins/+github/getDefaultPlugins.m @@ -8,6 +8,6 @@ plugins = [ ... matlab.buildtool.internal.getFactoryDefaultPlugins(pluginProviderData) ... - ciplugins.github.WorkflowCommandsPlugin() ... + ciplugins.github.GitHubLogPlugin() ... ]; end \ No newline at end of file diff --git a/scripts/setupdeps.sh b/scripts/setupdeps.sh index 1aca884..af8590b 100755 --- a/scripts/setupdeps.sh +++ b/scripts/setupdeps.sh @@ -8,10 +8,7 @@ DISTDIR="$(pwd)/dist/bin" mkdir -p $DISTDIR # Create plugin directory and copy plugin code -PLUGINDIR="$(pwd)/dist/plugins/+ciplugins/+github" -mkdir -p $PLUGINDIR -cp -R plugins/+ciplugins/+github/*.m $PLUGINDIR/ - +cp -R plugins $(pwd)/dist/ # Download and extract in a temporary directory WORKINGDIR=$(mktemp -d -t rmc_build.XXXXXX) From 2f562cd24f2ad16ebdf869d38734a4bce648750e Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Fri, 17 May 2024 12:34:16 +0530 Subject: [PATCH 72/80] Updated the test case --- .github/workflows/bat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index b5e4ff2..cb7d98c 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -182,5 +182,5 @@ jobs: - name: Verify workflow command is added run: | grep "::group::deploy - task" console.log - grep "::error::error - task" console.log + grep "::error::error task failed" console.log rm console.log \ No newline at end of file From a4225dd70ff668f2110fdf9de6840b776e32675a Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Fri, 17 May 2024 14:22:48 +0530 Subject: [PATCH 73/80] Updated task name in group display --- .github/workflows/bat.yml | 2 +- plugins/+ciplugins/+github/GitHubLogPlugin.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bat.yml b/.github/workflows/bat.yml index cb7d98c..8518446 100644 --- a/.github/workflows/bat.yml +++ b/.github/workflows/bat.yml @@ -181,6 +181,6 @@ jobs: - name: Verify workflow command is added run: | - grep "::group::deploy - task" console.log + grep "::group::deploy" console.log grep "::error::error task failed" console.log rm console.log \ No newline at end of file diff --git a/plugins/+ciplugins/+github/GitHubLogPlugin.m b/plugins/+ciplugins/+github/GitHubLogPlugin.m index 7e7efd8..c547a5e 100644 --- a/plugins/+ciplugins/+github/GitHubLogPlugin.m +++ b/plugins/+ciplugins/+github/GitHubLogPlugin.m @@ -6,7 +6,7 @@ function runTask(plugin, pluginData) % Add Github workflow command for grouping the tasks - disp("::group::" + pluginData.TaskResults.Name + " - task"); + disp("::group::" + pluginData.TaskResults.Name); runTask@matlab.buildtool.plugins.BuildRunnerPlugin(plugin, pluginData); From b194eed6a5d1eee41ee2eb2548d09bec9fc6555c Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Sat, 18 May 2024 00:38:50 +0530 Subject: [PATCH 74/80] Changed env variable setting --- src/buildtool.ts | 3 ++- src/buildtool.unit.test.ts | 8 ++++---- src/index.ts | 6 ++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/buildtool.ts b/src/buildtool.ts index 63d026e..29890f7 100644 --- a/src/buildtool.ts +++ b/src/buildtool.ts @@ -7,7 +7,8 @@ export interface RunBuildOptions { } export function generateCommand(options: RunBuildOptions): string { - let command: string = "addpath('"+ path.join(__dirname, "plugins") +"');buildtool" + const pluginsPath = path.join(__dirname,"plugins").replace("'","''"); + let command: string = "addpath('"+ pluginsPath +"');buildtool" if (options.Tasks) { command = command + " " + options.Tasks; } diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index 035fabd..f5f9a5a 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -11,7 +11,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool") }); it("buildtool invocation with tasks specified", () => { @@ -20,7 +20,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool compile test") }); it("buildtool invocation with only build options", () => { @@ -30,7 +30,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -40,6 +40,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins") +"');buildtool compile test -continueOnFailure -skip check") + expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool compile test -continueOnFailure -skip check") }); }); diff --git a/src/index.ts b/src/index.ts index bcf544f..73e324f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,9 +13,6 @@ async function run() { const architecture = process.arch; const workspaceDir = process.cwd(); - // Export env variable to inject the buildtool plugin - core.exportVariable('MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE', 'ciplugins.github.getDefaultPlugins'); - const options: buildtool.RunBuildOptions = { Tasks: core.getInput("tasks"), BuildOptions: core.getInput("build-options"), @@ -25,7 +22,8 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - await matlab.runCommand(helperScript, platform, architecture, exec.exec, startupOptions); + const execOptions = {env:{"MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins"}}; + await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); } run().catch((e) => { From 28879952ece019bec647ae52ad0dc677cbbbadbc Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Sat, 18 May 2024 00:48:34 +0530 Subject: [PATCH 75/80] Changed env variable setting --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 73e324f..fdc34ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,7 +22,7 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - const execOptions = {env:{"MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins"}}; + const execOptions = {process.env,env:{"MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins"}}; await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); } From 943f02db1f14910a18156a52deb7197e49b52e9b Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Sat, 18 May 2024 00:52:37 +0530 Subject: [PATCH 76/80] Changed env variable setting --- src/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index fdc34ac..194010b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,7 +22,15 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - const execOptions = {process.env,env:{"MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins"}}; + const customEnv = { + ...process.env, + "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins", + }; + + const execOptions: exec.ExecOptions = { + env: customEnv, + }; + const execOptions = {process.env,env:{}}; await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); } From c6323a0e47b5193edee442248b736ec6d4502ae3 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Sat, 18 May 2024 00:54:14 +0530 Subject: [PATCH 77/80] Changed env variable setting --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 194010b..d1fcd66 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,7 +30,7 @@ async function run() { const execOptions: exec.ExecOptions = { env: customEnv, }; - const execOptions = {process.env,env:{}}; + await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); } From 4d892201ef9d925308f686263d11f50fe1887095 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Sat, 18 May 2024 01:00:43 +0530 Subject: [PATCH 78/80] Changed env variable setting --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d1fcd66..b656808 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,13 +22,13 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - const customEnv = { + const envVars = { ...process.env, "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins", }; const execOptions: exec.ExecOptions = { - env: customEnv, + env: envVars, }; await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); From 38ed051df18f43a3f04e6f66c1da944a941e39c8 Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Mon, 20 May 2024 11:50:22 +0530 Subject: [PATCH 79/80] Changed env variable setting --- src/index.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index b656808..0e42b05 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,15 +22,11 @@ async function run() { const startupOptions = core.getInput("startup-options").split(" "); const helperScript = await matlab.generateScript(workspaceDir, command); - const envVars = { + const execOptions = { env: { ...process.env, "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins", - }; - - const execOptions: exec.ExecOptions = { - env: envVars, - }; - + }}; + await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); } From 286b8991eef50061d27f6fd99046df09023cea5c Mon Sep 17 00:00:00 2001 From: Nikhil Bhoski <47204011+nbhoski@users.noreply.github.com> Date: Mon, 20 May 2024 22:06:07 +0530 Subject: [PATCH 80/80] Refactored test variables --- src/buildtool.unit.test.ts | 9 +++++---- src/index.ts | 10 ++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/buildtool.unit.test.ts b/src/buildtool.unit.test.ts index f5f9a5a..f8432e7 100644 --- a/src/buildtool.unit.test.ts +++ b/src/buildtool.unit.test.ts @@ -4,6 +4,7 @@ import * as path from "path"; import * as buildtool from "./buildtool"; describe("command generation", () => { +const command = "addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool" it("buildtool invocation with unspecified tasks and build options", () => { const options: buildtool.RunBuildOptions = { Tasks: "", @@ -11,7 +12,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool") + expect(actual).toBe(command) }); it("buildtool invocation with tasks specified", () => { @@ -20,7 +21,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool compile test") + expect(actual).toBe(command + " compile test") }); it("buildtool invocation with only build options", () => { @@ -30,7 +31,7 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool -continueOnFailure -skip check") + expect(actual).toBe(command + " -continueOnFailure -skip check") }); it("buildtool invocation with specified tasks and build options", () => { @@ -40,6 +41,6 @@ describe("command generation", () => { }; const actual = buildtool.generateCommand(options); - expect(actual).toBe("addpath('"+ path.join(__dirname, "plugins").replace("'","''") +"');buildtool compile test -continueOnFailure -skip check") + expect(actual).toBe(command + " compile test -continueOnFailure -skip check") }); }); diff --git a/src/index.ts b/src/index.ts index 0e42b05..af78399 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,8 +26,14 @@ async function run() { ...process.env, "MW_MATLAB_BUILDTOOL_DEFAULT_PLUGINS_FCN_OVERRIDE":"ciplugins.github.getDefaultPlugins", }}; - - await matlab.runCommand(helperScript, platform, architecture, (cmd,args)=>exec.exec(cmd,args,execOptions), startupOptions); + + await matlab.runCommand( + helperScript, + platform, + architecture, + (cmd,args)=>exec.exec(cmd,args,execOptions), + startupOptions + ); } run().catch((e) => {