From 7e730512dde2f550480238fe654d1bc2100be7ab Mon Sep 17 00:00:00 2001 From: Yuncheng Date: Wed, 1 Mar 2023 20:47:17 +1100 Subject: [PATCH 1/2] use github action path --- action.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 10fb424..a060ade 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,9 @@ runs: uses: actions/github-script@v6 with: script: | - const {setupAuth} = require('./lib/utils.js') + const path = require('path'); + const utilsPath = path.join(process.env.GITHUB_ACTION_PATH, 'lib', 'utils.js') + const {setupAuth} = require(utilsPath) setupAuth(core) env: AUTH_FILE_PATH: ${{ inputs.auth_obj_path }} @@ -59,7 +61,9 @@ runs: uses: actions/github-script@v6 with: script: | - const {getStackqlCommand} = require('./lib/utils.js') + const path = require('path'); + const utilsPath = path.join(process.env.GITHUB_ACTION_PATH, 'lib', 'utils.js') + const {getStackqlCommand} = require(utilsPath) getStackqlCommand(core) env: QUERY_FILE_PATH: ${{ inputs.test_query_file_path }} @@ -76,7 +80,9 @@ runs: uses: actions/github-script@v6 with: script: | - const {assertResult} = require('./stackql-assert.js') + const path = require('path'); + const assertPath = path.join(process.env.GITHUB_ACTION_PATH, 'stackql-assert.js') + const {assertResult} = require(assertPath) assertResult(core) env: RESULT: ${{steps.exec-query.outputs.stdout}} From 155f662c313f0e5e274e5f494e3db801980c52df Mon Sep 17 00:00:00 2001 From: Yuncheng Date: Wed, 1 Mar 2023 22:54:05 +1100 Subject: [PATCH 2/2] remove status to pass tests --- .github/workflows/stackql-assert.yml | 12 ++++++------ .../workflows/workflow_scripts/expected_results.json | 2 +- .../workflows/workflow_scripts/google-example.iql | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/stackql-assert.yml b/.github/workflows/stackql-assert.yml index a4b2152..7921540 100644 --- a/.github/workflows/stackql-assert.yml +++ b/.github/workflows/stackql-assert.yml @@ -40,17 +40,17 @@ jobs: auth_obj_path: './.github/workflows/workflow_scripts/auth.json' test_query: | REGISTRY PULL google v23.01.00116; - SELECT name, status + SELECT name FROM google.compute.instances WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001'; - expected_results_str: ' [{"name":"stackql-demo-001","status":"TERMINATED"}]' + expected_results_str: ' [{"name":"stackql-demo-001"}]' - name: Use test query file and expected result string with auth object uses: ./ with: auth_obj_path: './.github/workflows/workflow_scripts/auth.json' test_query_file_path: './.github/workflows/workflow_scripts/google-example.iql' - expected_results_str: ' [{"name":"stackql-demo-001","status":"TERMINATED"}]' + expected_results_str: ' [{"name":"stackql-demo-001"}]' - name: Use test query string and expected results string, with auth string uses: ./ @@ -58,17 +58,17 @@ jobs: auth_str: '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}' test_query: | REGISTRY PULL google v23.01.00116; - SELECT name, status + SELECT name FROM google.compute.instances WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001'; - expected_results_str: '[{"name":"stackql-demo-001","status":"TERMINATED"}]' + expected_results_str: '[{"name":"stackql-demo-001"}]' - name: Use test query string and expected results file, with auth object uses: ./ with: auth_obj_path: './.github/workflows/workflow_scripts/auth.json' test_query_file_path: './.github/workflows/workflow_scripts/google-example.iql' - expected_results_str: '[{"name":"stackql-demo-001","status":"TERMINATED"}]' + expected_results_str: '[{"name":"stackql-demo-001"}]' - name: Use test query string and expected rows, with auth object uses: ./ diff --git a/.github/workflows/workflow_scripts/expected_results.json b/.github/workflows/workflow_scripts/expected_results.json index 030276f..8f652aa 100644 --- a/.github/workflows/workflow_scripts/expected_results.json +++ b/.github/workflows/workflow_scripts/expected_results.json @@ -1 +1 @@ -[{"name":"stackql-demo-001","status":"TERMINATED"}] \ No newline at end of file +[{"name":"stackql-demo-001"}] \ No newline at end of file diff --git a/.github/workflows/workflow_scripts/google-example.iql b/.github/workflows/workflow_scripts/google-example.iql index 9fafac1..69e8d58 100644 --- a/.github/workflows/workflow_scripts/google-example.iql +++ b/.github/workflows/workflow_scripts/google-example.iql @@ -1,4 +1,4 @@ REGISTRY PULL google v23.01.00116; -SELECT name, status +SELECT name FROM google.compute.instances WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001'; \ No newline at end of file