Skip to content

Commit 7ba7c98

Browse files
Merge pull request #7 from stackql/develop-v1
Merge develop-v1 to main
2 parents 535c7d4 + d8366c6 commit 7ba7c98

20 files changed

+21856
-59
lines changed

.github/set-up-stackql.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Setup StackQL'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'develop-**'
8+
pull_request:
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
stackql-tests:
16+
name: 'Stackql Examples'
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
23+
- name: Setup stackql
24+
uses: ./
25+
with:
26+
use_wrapper: 'true'
27+
28+
29+
- name: Validate Stackql Version
30+
run: |
31+
stackql --version
32+
33+
- name: Use GitHub Provider
34+
run: |
35+
stackql exec -i ./examples/github-example.iql --auth="${AUTH}"
36+
env:
37+
AUTH: ${{ vars.AUTH }} ##'{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
38+
STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
39+
40+
- name: Use Google Provider
41+
run: | ## use the secret to create json file
42+
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
43+
stackql exec -i ./examples/google-example.iql --auth="${AUTH}"
44+
env:
45+
AUTH: ${{ vars.AUTH }} ## '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
46+
47+
##### uncomment the step to see error handling
48+
# - name: Handle error
49+
# run: | ## use the secret to create json file
50+
# stackql exec -i ./examples/github-example.iql --auth="${INVALID_AUTH}"
51+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run build && git add dist/ && git add wrapper/

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# setup-stackql
2+
3+
The `stackql/setup-stackql` action is a JavaScript action that sets up StackQL CLI in your GitHub Actions workflow by:
4+
5+
- Downloading a latest Stackql CLI and adding it to the `PATH`.
6+
- Setup AUTH env var in the Github Action
7+
8+
# Auth
9+
[Learn more](https://stackql.io/docs/getting-started/authenticating) about authentication setup when running stackql
10+
11+
### Basic Example
12+
1. Set Auth variable, for example:
13+
```
14+
{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }
15+
```
16+
2. create the github token as a secret
17+
3. In the execution step, pass the secret as environment variable with name "STACKQL_GITHUB_CREDS"
18+
19+
Check the "Use GitHub Provider" step in `.github/workflows/example-workflows.yml` for the working example
20+
21+
### json File Auth example
22+
23+
1. Set Auth variable, for example:
24+
```
25+
{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}
26+
```
27+
2. encode the key json file into base64 string
28+
3. in execution step, run `sudo echo ${{ secrets.<name of the secret> }} | base64 -d > sa-key.json`
29+
30+
Check the "Use Google Provider" step in `.github/workflows/example-workflows.yml` for the working example

action.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@ name: 'StackQL Studio - Setup StackQL'
22
description: 'Sets up StackQL CLI in your GitHub Actions workflow.'
33
author: 'Yuncheng Yang, StackQL'
44
inputs:
5-
platform:
6-
description: 'Platform that function is running on'
7-
required: true
8-
# authentications_object_string:
9-
# description: 'The authentication object'
10-
# required: true
11-
# stackql_wrapper:
12-
# description: 'Whether or not to install a wrapper to wrap subsequent calls of the `stackql` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.'
13-
# default: 'true'
14-
# required: false
5+
use_wrapper:
6+
description: 'Whether or not to install a wrapper to wrap subsequent calls of the `stackql` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.'
7+
default: 'true'
8+
required: false
9+
1510
runs:
1611
using: 'node16'
17-
main: 'index.js'
12+
main: 'dist/index.js'
1813
branding:
1914
icon: 'terminal'
2015
color: 'purple'

0 commit comments

Comments
 (0)