-
Notifications
You must be signed in to change notification settings - Fork 228
144 lines (123 loc) · 4.21 KB
/
release-internal.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
132
133
134
135
136
137
138
139
140
141
142
143
144
# What?
#
# Tag and release an arbitrary ref. Uploads to an internal archive for further processing.
#
# How?
#
# After checking out and testing the provided ref, the image is built and uploaded.
#
# When?
#
# Manual trigger.
name: "Release to Cloud"
run-name: "Release to Cloud off of ${{ inputs.ref }}"
on:
workflow_dispatch:
inputs:
ref:
description: "The ref (sha or branch name) to use"
type: string
default: "main"
required: true
package_test_command:
description: "Package test command"
type: string
default: "python -c \"import dbt.adapters.spark\""
required: true
skip_tests:
description: "Should the tests be skipped? (default to false)"
type: boolean
required: true
default: false
defaults:
run:
shell: "bash"
env:
PYTHON_TARGET_VERSION: 3.8
jobs:
run-unit-tests:
name: "Unit tests"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Check out the repository"
uses: actions/checkout@v4
- name: "Set up Python ${{ env.PYTHON_TARGET_VERSION }}"
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_TARGET_VERSION }}"
- name: Install python dependencies
run: |
sudo apt-get update
sudo apt-get install libsasl2-dev
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install -r requirements.txt
python -m pip install -r dev-requirements.txt
python -m pip install -e .
- name: Run unit tests
run: python -m pytest --color=yes --csv unit_results.csv -v tests/unit
run-integration-tests:
name: "${{ matrix.test }}"
needs: [run-unit-tests]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test:
- "apache_spark"
- "spark_session"
- "databricks_sql_endpoint"
- "databricks_cluster"
- "databricks_http_cluster"
env:
DBT_INVOCATION_ENV: github-actions
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_SITE: datadoghq.com
DD_ENV: ci
DD_SERVICE: ${{ github.event.repository.name }}
DBT_DATABRICKS_CLUSTER_NAME: ${{ secrets.DBT_DATABRICKS_CLUSTER_NAME }}
DBT_DATABRICKS_HOST_NAME: ${{ secrets.DBT_DATABRICKS_HOST_NAME }}
DBT_DATABRICKS_ENDPOINT: ${{ secrets.DBT_DATABRICKS_ENDPOINT }}
DBT_DATABRICKS_TOKEN: ${{ secrets.DBT_DATABRICKS_TOKEN }}
DBT_DATABRICKS_USER: ${{ secrets.DBT_DATABRICKS_USERNAME }}
DBT_TEST_USER_1: "[email protected]"
DBT_TEST_USER_2: "[email protected]"
DBT_TEST_USER_3: "[email protected]"
steps:
- name: Check out the repository
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false
# explicitly checkout the branch for the PR,
# this is necessary for the `pull_request` event
- name: Check out the repository (PR)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.ref }}
# the python version used here is not what is used in the tests themselves
- name: Set up Python for dagger
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install python dependencies
run: |
python -m pip install --user --upgrade pip
python -m pip --version
python -m pip install -r dagger/requirements.txt
- name: "Run tests for ${{ matrix.test }}"
run: python dagger/run_dbt_spark_tests.py --profile ${{ matrix.test }}
invoke-reusable-workflow:
name: "Create cloud release"
needs: [run-integration-tests]
uses: "dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@main"
with:
package_test_command: "${{ inputs.package_test_command }}"
dbms_name: "spark"
ref: "${{ inputs.ref }}"
skip_tests: "${{ inputs.skip_tests }}"
secrets: "inherit"