Skip to content

use github action path #18

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/stackql-assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,35 @@ 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: ./
with:
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: ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workflow_scripts/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"stackql-demo-001","status":"TERMINATED"}]
[{"name":"stackql-demo-001"}]
2 changes: 1 addition & 1 deletion .github/workflows/workflow_scripts/google-example.iql
Original file line number Diff line number Diff line change
@@ -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';
12 changes: 9 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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}}
Expand Down