-
Notifications
You must be signed in to change notification settings - Fork 16
131 lines (121 loc) · 4.24 KB
/
ci-pre-release-test-testpypi-Windows.yml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: CI Pre Release Test TestPyPi WINDOWS
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'dbt-teradata version from TestPyPi'
required: true
workflow_run:
workflows: ["CD Release TESTPYPI"]
types:
- completed
jobs:
trigger:
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
env-name: ${{ steps.define-environment-name.outputs.env-name }}
RegularDB: ${{ steps.create-csae-environments.outputs.teradata-server-name }}
name: CreateInstance
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Define CSAE env name
id: define-environment-name
run: |
PYTHON_VERSION=$(echo -n "$PYTHON_VERSION" | tr -d '.') # remove dots from version
echo "env-name=dbt-ci-$PYTHON_VERSION-$(date +%s%N)" >> $GITHUB_OUTPUT
env:
PYTHON_VERSION: 3.9
- name: Create CSAE environments
id: create-csae-environments
shell: bash
run: |
chmod 777 .github/workflows/scripts/createTestEnvironments.sh
./.github/workflows/scripts/createTestEnvironments.sh
env:
CSAE_TOKEN: ${{ secrets.CSAE_TOKEN_DEVTOOLS }}
CSAE_ENV_PASSWORD: ${{ secrets.CSAE_ENV_PASSWORD }}
CSAE_ENV_NAME: ${{ steps.define-environment-name.outputs.env-name}}
Testing-Pre-Release:
runs-on: windows-latest
needs: trigger
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dbt-teradata
shell: pwsh
run: |
python -m pip install --upgrade pip
pip install --index-url https://test.pypi.org/simple/ dbt-teradata==$env:RELEASE_VERSION --extra-index-url https://pypi.org/simple
if ($env:RELEASE_VERSION -match '^1\.8' -or [version]$env:RELEASE_VERSION -ge [version]'1.8.0') {
pip install dbt-core>=1.8.0
}
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
- name: Clone JaffleShop DBT Project
shell: pwsh
run: |
git clone https://github.com/Teradata/jaffle_shop-dev.git jaffle_shop
- name: Setup profiles.yml
shell: pwsh
run: |
$TERADATA_SERVER_NAME = $env:DBT_TERADATA_SERVER_NAME
$TERADATA_USERNAME = $env:DBT_TERADATA_USERNAME
$TERADATA_PASSWORD = $env:DBT_TERADATA_PASSWORD
mkdir .dbt
$content= @"
jaffle_shop:
outputs:
dev:
type: teradata
host: $TERADATA_SERVER_NAME
user: $TERADATA_USERNAME
password: $TERADATA_PASSWORD
logmech: TD2
schema: jaffle_shop
tmode: ANSI
threads: 1
timeout_seconds: 300
priority: interactive
retries: 1
target: dev
"@
$content | Out-File -FilePath .dbt\profiles.yml
env:
DBT_TERADATA_SERVER_NAME: ${{ needs.trigger.outputs.RegularDB }}
DBT_TERADATA_USERNAME: dbc
DBT_TERADATA_PASSWORD: ${{ secrets.CSAE_ENV_PASSWORD }}
- name: Running jaffle_shop project
shell: pwsh
run: |
cd jaffle_shop
ls
Get-Content "..\.dbt\profiles.yml"
$env:DBT_PROFILES_DIR= "..\.dbt"
dbt debug
dbt seed
dbt run
dbt test
dbt docs generate
Delete_instance:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [trigger, Testing-Pre-Release]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Delete CSAE environment
if: always()
run: |
chmod 777 .github/workflows/scripts/deleteTestEnvironments.sh
./.github/workflows/scripts/deleteTestEnvironments.sh
env:
CSAE_TOKEN: '${{ secrets.CSAE_TOKEN_DEVTOOLS }}'
CSAE_ENV_NAME: '${{ needs.trigger.outputs.env-name}}'