use stackql-exec #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
# | |
# Pull required providers | |
# | |
- name: pull required providers | |
uses: stackql/[email protected] | |
with: | |
is_command: true | |
query: "REGISTRY PULL google; REGISTRY PULL github" | |
# | |
# Example `test_query` with `expected_rows` | |
# | |
- name: Use test query string and expected rows | |
uses: ./ | |
with: | |
test_query: | | |
SELECT name | |
FROM google.compute.instances | |
WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001'; | |
expected_rows: 1 | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
# | |
# Example `test_query_file_path` with `expected_results_str` | |
# | |
- name: Use test query file and expected result string | |
uses: ./ | |
with: | |
test_query_file_path: './.github/workflows/workflow_scripts/google-example.iql' | |
expected_results_str: '[{"name":"stackql-demo-001"}]' | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
# | |
# Example `test_query_file_path` with `expected_results_file_path` supplying `vars` using an inline `jsonnet` config block | |
# | |
- name: Use test query file and expected results file path using inline jsonnet config block and external vars | |
uses: ./ | |
with: | |
test_query_file_path: './.github/workflows/workflow_scripts/google-example-inline-jsonnet.iql' | |
expected_results_file_path: './.github/workflows/workflow_scripts/google-example-inline-jsonnet-results.json' | |
vars: GOOGLE_PROJECT=${{ env.GOOGLE_PROJECT }},GOOGLE_ZONE=${{ env.GOOGLE_ZONE }} | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} | |
GOOGLE_PROJECT: ${{ vars.GOOGLE_PROJECT }} | |
GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }} | |
# | |
# Example `test_query_file_path` with `expected_rows` supplying `vars` using `jsonnet` config provided using `data_file_path` | |
# | |
- name: Use test query file with a jsonnet data file sourcing external vars and an expected row count | |
uses: ./ | |
with: | |
test_query_file_path: './.github/workflows/workflow_scripts/github-example.iql' | |
data_file_path: './.github/workflows/workflow_scripts/github-example-data.jsonnet' | |
vars: TEST_ORG=${{ env.TEST_ORG }},TEST_REPO=${{ env.TEST_REPO }} | |
expected_rows: 1 | |
env: | |
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }} | |
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }} | |
TEST_ORG: ${{ vars.TEST_ORG }} | |
TEST_REPO: ${{ vars.TEST_REPO }} |