Repository navigation
81 lines (68 loc) · 2.98 KB
/
Copy pathstackql-assert.yml
File metadata and controls
81 lines (68 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: 'StackQL Assert'
on:
push:
branches:
- main
pull_request:
jobs:
stackql-exec-google-example:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{matrix.os}}
name: 'Assert test '
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prep Google Creds (Windows)
if: ${{ matrix.os == 'windows-latest'}}
run: | ## use the secret to create json file
$GoogleCreds = [System.Environment]::GetEnvironmentVariable("GOOGLE_CREDS_ENV")
$GoogleCredsDecoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($GoogleCreds))
Write-Output $GoogleCredsDecoded | Set-Content sa-key.json
shell: pwsh
env:
GOOGLE_CREDS_ENV: ${{ secrets.GOOGLE_CREDS }}
- name: Prep Google Creds (bash)
if: ${{ matrix.os != 'windows-latest' }}
shell: bash
run: | ## use the base64 encoded secret to create json file
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
- name: Use test query string and expected results string with auth object
uses: ./
with:
auth_obj_path: './.github/workflows/workflow_scripts/auth.json'
test_query: |
REGISTRY PULL google v23.01.00116;
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"}]'
- 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"}]'
- 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
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"}]'
- 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"}]'
- name: Use test query string and expected rows, with auth object
uses: ./
with:
auth_str: '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
test_query_file_path: './.github/workflows/workflow_scripts/google-example.iql'
expected_rows: 1