1+ name : dbt basic ci (GHCR)
2+
3+ # Run the workflow when a commit is pushed to any branch except main.
4+ on :
5+ pull_request :
6+ push :
7+ branches :
8+ - ' !main'
9+
10+ jobs :
11+ run :
12+ runs-on : ubuntu-latest
13+ container :
14+ image : ghcr.io/dbt-labs/dbt-core:1.7.2
15+
16+ steps :
17+ # -----------------------------------------------
18+ # check-out repo, find PR and setup python
19+ # -----------------------------------------------
20+ - name : Checkout repo
21+ uses : actions/checkout@v3
22+
23+ # Retrieve the PR number using the hash for the current commit. This
24+ # guarantees that the workflow works for push events, too.
25+ # https://github.com/jwalton/gh-find-current-pr
26+ - name : Find current pull request
27+ uses : jwalton/gh-find-current-pr@v1.3.2
28+ id : findPR
29+ with :
30+ state : open
31+ sha : ${{ github.event.pull_request.head.sha }}
32+ - run : echo "Running for PR \#${PR}"
33+ if : success() && steps.findPr.outputs.number
34+ env :
35+ PR : ${{ steps.findPr.outputs.pr }}
36+
37+ - name : Install dbt pre-reqs
38+ id : pre-reqs
39+ working-directory : ./
40+ run : pip install dbt-materialize | tee $RUNNER_TEMP/dev_prereqs
41+ # -----------------------------------------------
42+ # dbt
43+ # -----------------------------------------------
44+ # - Create CI environment associated with the PR
45+ #
46+ # - Run and test all dbt models (i.e. full run)
47+ # -----------------------------------------------
48+ - name : Build dbt
49+ env :
50+ MZ_HOST : ${{ secrets.MZ_HOST }}
51+ MZ_USER : ${{ secrets.MZ_USER }}
52+ MZ_PASSWORD : ${{ secrets.MZ_PASSWORD }}
53+ CI_TAG : " ${{ format('{0}_{1}', 'gh_ci', steps.findPr.outputs.pr) }}"
54+ run : |
55+ dbt run-operation create_environment
56+ dbt build --profiles-dir ./ | tee $RUNNER_TEMP/build_dev_hot
57+
58+ - name : write summary
59+ id : write-summary
60+ if : always()
61+ run : |
62+ echo "#### DBT Development Deploy Status" >> $GITHUB_STEP_SUMMARY
0 commit comments