From 1221d3c675c96cc63431c60fd7447da0dd7ee40e Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Tue, 26 Sep 2023 14:32:18 -0700 Subject: [PATCH 1/5] draft PR job --- .github/workflows/pr_job.yml | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/pr_job.yml diff --git a/.github/workflows/pr_job.yml b/.github/workflows/pr_job.yml new file mode 100644 index 0000000..a00960b --- /dev/null +++ b/.github/workflows/pr_job.yml @@ -0,0 +1,65 @@ +name: dbt pull request job + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + push: + branches: + - '!master' # TODO: change to your main branch name + +env: + #TODO(developer): update PROJECT_ID + PROJECT_ID: "dbt-demo-386220" + DBT_PROFILES_DIR: ./ + GOOGLE_APPLICATION_CREDENTIALS: ./service_account.json + +jobs: + run: + runs-on: ubuntu-20.04 + if: ${{ !github.event.pull_request.draft }} + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: + - name: checkout + uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: install requirements + run: pip install -q -r requirements.txt + + - name: install datafold-sdk + run: pip install -q datafold-sdk + + - name: Authenticate dbt to BigQuery + run: 'echo "$KEYFILE" > ./service_account.json' # persist file in root dir + shell: bash + env: + KEYFILE: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} # TODO: add a github secret + + - name: dbt deps + run: dbt deps + + - name: Find Current Pull Request + uses: jwalton/gh-find-current-pr@v1.3.0 + id: findPR + + - name: dbt build + run: dbt build --full-refresh --profiles-dir ./ + + # TODO: update the --config-id to your config id + - name: submit artifacts to datafold to compare to the production manifest + run: | + set -ex + datafold dbt upload --ci-config-id 272 --run-type ${DATAFOLD_RUN_TYPE} --commit-sha ${GIT_SHA} + env: + DATAFOLD_APIKEY: ${{ secrets.DATAFOLD_APIKEY }} + DATAFOLD_RUN_TYPE: "${{ 'pull_request' }}" + GIT_SHA: "${{ github.event.pull_request.head.sha }}" From e271e394ace68edd0282e430e92d5a345a2d88ff Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Tue, 26 Sep 2023 14:33:29 -0700 Subject: [PATCH 2/5] simple change --- models/core/fct_orders.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core/fct_orders.sql b/models/core/fct_orders.sql index b534278..759cccc 100644 --- a/models/core/fct_orders.sql +++ b/models/core/fct_orders.sql @@ -41,4 +41,4 @@ final as ( ) -select * from final +select * from final limit 5 \ No newline at end of file From 4cc56dca56695d426466da9df79e1a6e4bf966e2 Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Tue, 26 Sep 2023 14:50:35 -0700 Subject: [PATCH 3/5] add TODO --- .github/workflows/prod_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prod_job.yml b/.github/workflows/prod_job.yml index 05d65fb..5d716d3 100644 --- a/.github/workflows/prod_job.yml +++ b/.github/workflows/prod_job.yml @@ -49,4 +49,4 @@ jobs: env: DATAFOLD_APIKEY: ${{ secrets.DATAFOLD_APIKEY }} DATAFOLD_RUN_TYPE: "${{ github.ref == 'refs/heads/master' && 'production' || 'pull_request' }}" - GIT_SHA: "${{ github.ref == 'refs/heads/master' && github.sha || github.event.pull_request.head.sha }}" + GIT_SHA: "${{ github.ref == 'refs/heads/master' && github.sha || github.event.pull_request.head.sha }}" # TODO: update refs/heads/master for your main branch name From cda2da15266b57325d0afb953f5bbd35e70a7379 Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Tue, 26 Sep 2023 14:56:28 -0700 Subject: [PATCH 4/5] quick change --- models/core/fct_orders.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core/fct_orders.sql b/models/core/fct_orders.sql index 759cccc..e873dd3 100644 --- a/models/core/fct_orders.sql +++ b/models/core/fct_orders.sql @@ -41,4 +41,4 @@ final as ( ) -select * from final limit 5 \ No newline at end of file +select * from final limit 6 \ No newline at end of file From f838dc5e72ab2c88c976b56a3b14e4e7beaf7783 Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Tue, 26 Sep 2023 15:16:05 -0700 Subject: [PATCH 5/5] add simple pr example change --- models/core/fct_orders.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core/fct_orders.sql b/models/core/fct_orders.sql index e873dd3..a3ab5f5 100644 --- a/models/core/fct_orders.sql +++ b/models/core/fct_orders.sql @@ -41,4 +41,4 @@ final as ( ) -select * from final limit 6 \ No newline at end of file +select * from final limit 10 \ No newline at end of file