-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Off Circle CI / To Github Actions + dagger.io #923
Changes from all commits
fd6f6f0
795e40a
ff39c5d
1505fc6
44fe33f
2655631
915f67e
f0ef215
e8457df
842466a
0738f2d
277bef1
8d5853d
919528a
15e48fd
ab90c4c
31cb05e
31eceb5
fd54d7f
8de8339
e85232f
fe3300e
b37e14b
51511ec
98607b6
e6ec414
05a2c08
a89ec58
2a18fad
1481396
31b427c
15ba1da
ca33a23
6274d77
0ba91a2
f092026
b968985
8a49567
7723e8d
ea5ebfa
610e5e9
b4411ab
cae6c8a
0c68972
b2f63bd
80eb7e4
4bbfa71
b1d2020
38fda3d
6b599a1
0976c4f
42f2784
4f11291
1384084
543e321
307a9af
f380d46
c334f32
19dcff3
01b0c0c
d3d2844
94af018
72daf90
4f63a3c
b43c9d1
91715d2
943a8dc
3d0dece
080b816
c8477ce
c0a37ae
9b9dc79
8c6a745
6a6b4ce
1ae321a
6361429
6bca5dc
f4293e0
d398065
6108d44
d472f3b
ce92bcf
0c4ed9e
56b14bc
9849c1c
f9a4c58
bbe17a8
3f44e96
afd3866
259ebc7
a8a7010
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Add GitHub action for integration testing and use dagger-io to run tests. Remove CircleCI workflow. | ||
time: 2023-09-29T16:12:18.968755+02:00 | ||
custom: | ||
Author: JCZuurmond, colin-rogers-dbt | ||
Issue: "719" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -e | ||
set -e | ||
|
||
git_branch=$1 | ||
target_req_file="dev-requirements.txt" | ||
core_req_sed_pattern="s|dbt-core.git.*#egg=dbt-core|dbt-core.git@${git_branch}#egg=dbt-core|g" | ||
tests_req_sed_pattern="s|dbt-core.git.*#egg=dbt-tests|dbt-core.git@${git_branch}#egg=dbt-tests|g" | ||
if [[ "$OSTYPE" == darwin* ]]; then | ||
# mac ships with a different version of sed that requires a delimiter arg | ||
sed -i "" "$core_req_sed_pattern" $target_req_file | ||
sed -i "" "$tests_req_sed_pattern" $target_req_file | ||
else | ||
sed -i "$core_req_sed_pattern" $target_req_file | ||
sed -i "$tests_req_sed_pattern" $target_req_file | ||
fi | ||
core_version=$(curl "https://raw.githubusercontent.com/dbt-labs/dbt-core/${git_branch}/core/dbt/version.py" | grep "__version__ = *"|cut -d'=' -f2) | ||
bumpversion --allow-dirty --new-version "$core_version" major |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# **what?** | ||
# Runs integration tests. | ||
|
||
# **why?** | ||
# Ensure code runs as expected. | ||
|
||
# **when?** | ||
# This will run for all PRs, when code is pushed to a release | ||
# branch, and when manually triggered. | ||
|
||
name: Adapter Integration Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "*.latest" | ||
|
||
pull_request_target: | ||
paths-ignore: | ||
- ".changes/**" | ||
- ".flake8" | ||
- ".gitignore" | ||
- "**.md" | ||
|
||
workflow_dispatch: | ||
inputs: | ||
dbt-core-branch: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ ❤️ ❤️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we get there are we going to also add inputs for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good call out when we update all the adapters to use those packages we should update these to include them |
||
description: "branch of dbt-core to use in dev-requirements.txt" | ||
required: false | ||
type: string | ||
|
||
# explicitly turn off permissions for `GITHUB_TOKEN` | ||
permissions: read-all | ||
|
||
# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request_target') && github.event.pull_request.head.ref || github.sha }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
test: | ||
name: ${{ matrix.test }} | ||
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: "buildbot+dbt_test_user_1@dbtlabs.com" | ||
DBT_TEST_USER_2: "buildbot+dbt_test_user_2@dbtlabs.com" | ||
DBT_TEST_USER_3: "buildbot+dbt_test_user_3@dbtlabs.com" | ||
|
||
steps: | ||
- name: Check out the repository | ||
if: github.event_name != 'pull_request_target' | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
# explicitly checkout the branch for the PR, | ||
# this is necessary for the `pull_request` event | ||
colin-rogers-dbt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Check out the repository (PR) | ||
if: github.event_name == 'pull_request_target' | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
Comment on lines
+86
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This defeats the purpose of using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you expand on this? Looks like this is what all our other integration test workflows do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read up a bit more adn this does not defeat the purpose of I understand this is how it's done in the other adapter repos but I'm not sure it's necessary. From the actions/checkout docs
So this feels like a over-complication of checkout. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed offline and we will create a ticket to explain the logic here but leave it as is to follow patterns in adapter repos. |
||
# the python version used here is not what is used in the tests themselves | ||
- name: Set up Python for dagger | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not using a python matrix here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be tested against all supported python versions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so the python version being used is actually configured based off the base image dagger uses for the test container as specified here: https://github.com/dbt-labs/dbt-spark/pull/923/files#diff-ca1b9f8fafcab3a8c6df7e520e725035642f58e54df0d88402a7a61fac5578b6R95 Since I don't think we're doing that in CircleCI today I don't think that's a blocker but I agree we should add that |
||
|
||
- 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: Update dev_requirements.txt | ||
if: inputs.dbt-core-branch != '' | ||
run: | | ||
pip install bumpversion | ||
./.github/scripts/update_dbt_core_branch.sh ${{ inputs.dbt-core-branch }} | ||
|
||
- name: Run tests for ${{ matrix.test }} | ||
run: python dagger/run_dbt_spark_tests.py --profile ${{ matrix.test }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,5 @@ test.env | |
.hive-metastore/ | ||
.spark-warehouse/ | ||
dbt-integration-tests | ||
/.tool-versions | ||
/.hypothesis/* |
emmyoop marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,6 @@ | |
<a href="https://github.com/dbt-labs/dbt-spark/actions/workflows/main.yml"> | ||
<img src="https://github.com/dbt-labs/dbt-spark/actions/workflows/main.yml/badge.svg?event=push" alt="Unit Tests Badge"/> | ||
</a> | ||
<a href="https://circleci.com/gh/dbt-labs/dbt-spark/?branch=main"> | ||
<img src="https://circleci.com/gh/dbt-labs/dbt-spark/tree/main.svg?style=shield" alt="Integration Tests Badge"/> | ||
</a> | ||
Comment on lines
-8
to
-10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
</p> | ||
|
||
**[dbt](https://www.getdbt.com/)** enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dagger-io~=0.8.0 | ||
python-dotenv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ you've inspired me dbt-labs/dbt-core#9355