-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create ci.yml (#1) * Create ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * ut: fix all unit test * add endpoint to ci.yml * fix ExampleManager_RunQuery * Set CI timezone=Asia/Shanghai * try to fix sqldriver_test * bugfix * chore: fix accord by review * fix: fix Example_tunnel_upload_arrow * fix: fix Example_tunnel_upload_arrow * fix: fix Example_tunnel_upload_arrow
- Loading branch information
1 parent
475b91f
commit c7b6985
Showing
12 changed files
with
214 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: CI | ||
|
||
on: | ||
workflow_dispatch: # 支持手动触发 | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # 获取 oidc token 的权限 | ||
steps: | ||
- name: get credentials | ||
id: get-credentials | ||
uses: aliyun/[email protected] | ||
with: | ||
role-to-assume: '${{ secrets.ROLE_ARN }}' | ||
oidc-provider-arn: '${{ secrets.OIDC_ARN }}' | ||
audience: 'actions.github.com' # default value | ||
|
||
- name: Set up environment | ||
run: | | ||
echo "ALIBABA_CLOUD_ACCESS_KEY_ID=${{ steps.get-credentials.outputs.aliyun-access-key-id }}" >> $GITHUB_ENV | ||
echo "ALIBABA_CLOUD_ACCESS_KEY_SECRET=${{ steps.get-credentials.outputs.aliyun-access-key-secret }}" >> $GITHUB_ENV | ||
echo "ALIBABA_CLOUD_SECURITY_TOKEN=${{ steps.get-credentials.outputs.aliyun-security-token }}" >> $GITHUB_ENV | ||
echo "odps_endpoint=${{ secrets.ENDPOINT }}" >> $GITHUB_ENV | ||
echo "TZ=Asia/Shanghai" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.15' | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test (Expect Arrow Package) | ||
run: go test -v $(go list ./... | grep -v './arrow') |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,12 +24,13 @@ import ( | |
"log" | ||
) | ||
|
||
var account = account2.AliyunAccountFromEnv() | ||
var account = account2.AccountFromEnv() | ||
var endpoint = restclient.LoadEndpointFromEnv() | ||
var restClient = restclient.NewOdpsRestClient(account, endpoint) | ||
var projectName = "go_sdk_regression_testing" | ||
|
||
func ExampleManager_GetSecurityConfig() { | ||
sm := security.NewSecurityManager(restClient, "project_1") | ||
sm := security.NewSecurityManager(restClient, projectName) | ||
sc, err := sm.GetSecurityConfig(true) | ||
if err != nil { | ||
log.Fatalf("%+v", err) | ||
|
@@ -41,9 +42,9 @@ func ExampleManager_GetSecurityConfig() { | |
} | ||
|
||
func ExampleManager_CheckPermissionV1() { | ||
sm := security.NewSecurityManager(restClient, "project_1") | ||
sm := security.NewSecurityManager(restClient, projectName) | ||
p := security.NewPermission( | ||
"project_1", | ||
projectName, | ||
security.ObjectTypeTable, | ||
"sale_detail", | ||
security.ActionTypeAll, | ||
|
@@ -61,7 +62,7 @@ func ExampleManager_CheckPermissionV1() { | |
} | ||
|
||
func ExampleManager_CheckPermissionV0() { | ||
sm := security.NewSecurityManager(restClient, "project_1") | ||
sm := security.NewSecurityManager(restClient, projectName) | ||
|
||
r, err := sm.CheckPermissionV0( | ||
security.ObjectTypeTable, | ||
|
@@ -78,7 +79,7 @@ func ExampleManager_CheckPermissionV0() { | |
} | ||
|
||
func ExampleManager_GetPolicy() { | ||
sm := security.NewSecurityManager(restClient, "project_1") | ||
sm := security.NewSecurityManager(restClient, projectName) | ||
policy, err := sm.GetPolicy() | ||
if err != nil { | ||
log.Fatalf("%+v", err) | ||
|
@@ -89,7 +90,7 @@ func ExampleManager_GetPolicy() { | |
} | ||
|
||
func ExampleManager_ListUsers() { | ||
sm := security.NewSecurityManager(restClient, "project_1") | ||
sm := security.NewSecurityManager(restClient, projectName) | ||
users, err := sm.ListUsers() | ||
if err != nil { | ||
log.Fatalf("%+v", err) | ||
|
@@ -103,8 +104,8 @@ func ExampleManager_ListUsers() { | |
} | ||
|
||
func ExampleManager_RunQuery() { | ||
sm := security.NewSecurityManager(restClient, "project_1") | ||
result, err := sm.RunQuery("show grants for [email protected];", true, "") | ||
sm := security.NewSecurityManager(restClient, projectName) | ||
result, err := sm.RunQuery("whoami;", true, "") | ||
if err != nil { | ||
log.Fatalf("%+v", err) | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.