Skip to content

Commit e7c5f45

Browse files
committed
ci: set up validation test
1 parent d3391b1 commit e7c5f45

File tree

11 files changed

+271
-55
lines changed

11 files changed

+271
-55
lines changed

.github/workflows/dev.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ jobs:
4040
runs-on: ubuntu-latest
4141

4242
steps:
43-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
43+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4444
with:
4545
fetch-depth: 0
4646
persist-credentials: false
4747

48-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
48+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
4949
with:
5050
cache-dependency-path: go/go.sum
5151
check-latest: true
@@ -59,7 +59,7 @@ jobs:
5959
run: pip install pre-commit
6060

6161
- name: pre-commit (cache)
62-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
62+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
6363
with:
6464
path: ~/.cache/pre-commit
6565
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

.github/workflows/dev_pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ubuntu-slim
4444

4545
steps:
46-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
46+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4747
with:
4848
fetch-depth: 1
4949
persist-credentials: false

.github/workflows/generate.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
# limitations under the License.
1414

1515
driver = "databricks"
16+
environment = "azure-prod"
1617

1718
[lang]
1819
go = true
20+
21+
[secrets]
22+
DATABRICKS_HOST = { secret = "DATABRICKS_HOST", contexts = ["validate"] }
23+
DATABRICKS_ACCESSTOKEN = { secret = "DATABRICKS_TOKEN", contexts = ["validate"] }
24+
DATABRICKS_HTTPPATH = { secret = "TEST_PECO_WAREHOUSE_HTTP_PATH", contexts = ["validate"] }
25+
DATABRICKS_OAUTH_CLIENT_ID = { secret = "DATABRICKS_TEST_CLIENT_ID", contexts = ["validate"] }
26+
DATABRICKS_OAUTH_CLIENT_SECRET = { secret = "DATABRICKS_TEST_CLIENT_SECRET", contexts = ["validate"] }

.github/workflows/go_release.yaml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ on:
3737

3838
workflow_dispatch: {}
3939

40-
4140
concurrency:
4241
# Must share concurrency group with release workflow since it also builds/tests
4342
group: ${{ github.repository }}-${{ github.ref }}-ci
@@ -58,6 +57,7 @@ jobs:
5857
- { platform: linux, arch: amd64, runner: ubuntu-latest }
5958
- { platform: macos, arch: arm64, runner: macos-latest }
6059
- { platform: win, arch: amd64, runner: windows-latest }
60+
environment: azure-prod
6161
permissions:
6262
contents: read
6363
steps:
@@ -68,12 +68,12 @@ jobs:
6868
# https://github.com/actions/runner-images/issues/2840
6969
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
7070
71-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
71+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7272
with:
7373
fetch-depth: 0
7474
persist-credentials: false
7575

76-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
76+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
7777
with:
7878
cache-dependency-path: go/go.sum
7979
check-latest: true
@@ -118,11 +118,6 @@ jobs:
118118
fi
119119
set +a
120120
121-
if [[ -n "${{ secrets.environment }}" ]]; then
122-
echo "Loading secret environment variables"
123-
eval "${{ secrets.environment }}"
124-
fi
125-
126121
if [[ -f ci/scripts/pre-test.sh ]]; then
127122
echo "Loading pre-test"
128123
./ci/scripts/pre-test.sh
@@ -155,6 +150,7 @@ jobs:
155150
include:
156151
# I think we only need to test one platform, but we can change that later
157152
- { platform: linux, arch: amd64, runner: ubuntu-latest }
153+
environment: azure-prod
158154
permissions:
159155
contents: read
160156
steps:
@@ -165,12 +161,12 @@ jobs:
165161
# https://github.com/actions/runner-images/issues/2840
166162
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
167163
168-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
164+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
169165
with:
170166
fetch-depth: 0
171167
persist-credentials: false
172168

173-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
169+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
174170
with:
175171
cache-dependency-path: go/go.sum
176172
check-latest: true
@@ -212,6 +208,12 @@ jobs:
212208
213209
- name: Validate
214210
if: runner.os == 'Linux'
211+
env:
212+
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
213+
DATABRICKS_ACCESSTOKEN: ${{ secrets.DATABRICKS_TOKEN }}
214+
DATABRICKS_HTTPPATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
215+
DATABRICKS_OAUTH_CLIENT_ID: ${{ secrets.DATABRICKS_TEST_CLIENT_ID }}
216+
DATABRICKS_OAUTH_CLIENT_SECRET: ${{ secrets.DATABRICKS_TEST_CLIENT_SECRET }}
215217
working-directory: go
216218
run: |
217219
set -a
@@ -223,11 +225,6 @@ jobs:
223225
fi
224226
set +a
225227
226-
if [[ -n "${{ secrets.environment }}" ]]; then
227-
echo "Loading secret environment variables"
228-
eval "${{ secrets.environment }}"
229-
fi
230-
231228
if [[ -f ci/scripts/pre-test.sh ]]; then
232229
echo "Loading pre-test"
233230
./ci/scripts/pre-test.sh
@@ -268,12 +265,12 @@ jobs:
268265
packages: read
269266

270267
steps:
271-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
268+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
272269
with:
273270
fetch-depth: 0
274271
persist-credentials: false
275272

276-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
273+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
277274
with:
278275
cache-dependency-path: go/go.sum
279276
check-latest: true
@@ -321,12 +318,12 @@ jobs:
321318
contents: read
322319

323320
steps:
324-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
321+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
325322
with:
326323
fetch-depth: 0
327324
persist-credentials: false
328325

329-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
326+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
330327
with:
331328
check-latest: true
332329
go-version: "stable"
@@ -388,12 +385,12 @@ jobs:
388385
contents: write
389386

390387
steps:
391-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
388+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
392389
with:
393390
fetch-depth: 0
394391
persist-credentials: false
395392

396-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
393+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
397394
with:
398395
check-latest: true
399396
go-version: "stable"

.github/workflows/go_test.yaml

Lines changed: 89 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,27 @@ on:
3939
- "go/**"
4040
- .github/workflows/go_test.yaml
4141

42-
workflow_dispatch: {}
43-
42+
workflow_call:
43+
inputs:
44+
repository:
45+
description: "The repository to checkout (in owner/repo short format)"
46+
required: true
47+
type: string
48+
ref:
49+
description: "The ref to checkout"
50+
required: true
51+
type: string
52+
secrets:
53+
DATABRICKS_HOST:
54+
required: true
55+
DATABRICKS_TOKEN:
56+
required: true
57+
TEST_PECO_WAREHOUSE_HTTP_PATH:
58+
required: true
59+
DATABRICKS_TEST_CLIENT_ID:
60+
required: true
61+
DATABRICKS_TEST_CLIENT_SECRET:
62+
required: true
4463

4564
concurrency:
4665
# Must share concurrency group with release workflow since it also builds/tests
@@ -62,6 +81,7 @@ jobs:
6281
- { platform: linux, arch: amd64, runner: ubuntu-latest }
6382
- { platform: macos, arch: arm64, runner: macos-latest }
6483
- { platform: win, arch: amd64, runner: windows-latest }
84+
environment: azure-prod
6585
permissions:
6686
contents: read
6787
steps:
@@ -72,12 +92,22 @@ jobs:
7292
# https://github.com/actions/runner-images/issues/2840
7393
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
7494
75-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
95+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
96+
if: github.event_name != 'workflow_dispatch'
7697
with:
7798
fetch-depth: 0
7899
persist-credentials: false
79100

80-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
101+
- name: "checkout remote"
102+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
103+
if: github.event_name == 'workflow_dispatch'
104+
with:
105+
repository: ${{ inputs.repository }}
106+
ref: ${{ inputs.ref }}
107+
fetch-depth: 0
108+
persist-credentials: false
109+
110+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
81111
with:
82112
cache-dependency-path: go/go.sum
83113
check-latest: true
@@ -122,11 +152,6 @@ jobs:
122152
fi
123153
set +a
124154
125-
if [[ -n "${{ secrets.environment }}" ]]; then
126-
echo "Loading secret environment variables"
127-
eval "${{ secrets.environment }}"
128-
fi
129-
130155
if [[ -f ci/scripts/pre-test.sh ]]; then
131156
echo "Loading pre-test"
132157
./ci/scripts/pre-test.sh
@@ -159,6 +184,7 @@ jobs:
159184
include:
160185
# I think we only need to test one platform, but we can change that later
161186
- { platform: linux, arch: amd64, runner: ubuntu-latest }
187+
environment: azure-prod
162188
permissions:
163189
contents: read
164190
steps:
@@ -169,12 +195,22 @@ jobs:
169195
# https://github.com/actions/runner-images/issues/2840
170196
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
171197
172-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
198+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
199+
if: github.event_name != 'workflow_dispatch'
173200
with:
174201
fetch-depth: 0
175202
persist-credentials: false
176203

177-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
204+
- name: "checkout remote"
205+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
206+
if: github.event_name == 'workflow_dispatch'
207+
with:
208+
repository: ${{ inputs.repository }}
209+
ref: ${{ inputs.ref }}
210+
fetch-depth: 0
211+
persist-credentials: false
212+
213+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
178214
with:
179215
cache-dependency-path: go/go.sum
180216
check-latest: true
@@ -216,6 +252,12 @@ jobs:
216252
217253
- name: Validate
218254
if: runner.os == 'Linux'
255+
env:
256+
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
257+
DATABRICKS_ACCESSTOKEN: ${{ secrets.DATABRICKS_TOKEN }}
258+
DATABRICKS_HTTPPATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
259+
DATABRICKS_OAUTH_CLIENT_ID: ${{ secrets.DATABRICKS_TEST_CLIENT_ID }}
260+
DATABRICKS_OAUTH_CLIENT_SECRET: ${{ secrets.DATABRICKS_TEST_CLIENT_SECRET }}
219261
working-directory: go
220262
run: |
221263
set -a
@@ -227,11 +269,6 @@ jobs:
227269
fi
228270
set +a
229271
230-
if [[ -n "${{ secrets.environment }}" ]]; then
231-
echo "Loading secret environment variables"
232-
eval "${{ secrets.environment }}"
233-
fi
234-
235272
if [[ -f ci/scripts/pre-test.sh ]]; then
236273
echo "Loading pre-test"
237274
./ci/scripts/pre-test.sh
@@ -272,12 +309,22 @@ jobs:
272309
packages: read
273310

274311
steps:
275-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
312+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
313+
if: github.event_name != 'workflow_dispatch'
276314
with:
277315
fetch-depth: 0
278316
persist-credentials: false
279317

280-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
318+
- name: "checkout remote"
319+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
320+
if: github.event_name == 'workflow_dispatch'
321+
with:
322+
repository: ${{ inputs.repository }}
323+
ref: ${{ inputs.ref }}
324+
fetch-depth: 0
325+
persist-credentials: false
326+
327+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
281328
with:
282329
cache-dependency-path: go/go.sum
283330
check-latest: true
@@ -325,12 +372,22 @@ jobs:
325372
contents: read
326373

327374
steps:
328-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
375+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
376+
if: github.event_name != 'workflow_dispatch'
329377
with:
330378
fetch-depth: 0
331379
persist-credentials: false
332380

333-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
381+
- name: "checkout remote"
382+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
383+
if: github.event_name == 'workflow_dispatch'
384+
with:
385+
repository: ${{ inputs.repository }}
386+
ref: ${{ inputs.ref }}
387+
fetch-depth: 0
388+
persist-credentials: false
389+
390+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
334391
with:
335392
check-latest: true
336393
go-version: "stable"
@@ -392,12 +449,22 @@ jobs:
392449
contents: read
393450

394451
steps:
395-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
452+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
453+
if: github.event_name != 'workflow_dispatch'
454+
with:
455+
fetch-depth: 0
456+
persist-credentials: false
457+
458+
- name: "checkout remote"
459+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
460+
if: github.event_name == 'workflow_dispatch'
396461
with:
462+
repository: ${{ inputs.repository }}
463+
ref: ${{ inputs.ref }}
397464
fetch-depth: 0
398465
persist-credentials: false
399466

400-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
467+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
401468
with:
402469
check-latest: true
403470
go-version: "stable"

0 commit comments

Comments
 (0)