-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add cicd pipeline and ci scripts
- Loading branch information
Jo Lares
authored and
Jo Lares
committed
Feb 19, 2024
1 parent
9a4ae42
commit 1afa96e
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: cicd | ||
|
||
on: [push] | ||
|
||
jobs: | ||
elt: | ||
runs-on: ubuntu-latest | ||
env: | ||
DBT_PROJECT_NAME: 'dbt_demo' | ||
DBT_PROFILES_DIR: '' | ||
steps: | ||
- run: echo "${{ github.actor }} is testing out GitHub Actions 🚀." | ||
|
||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | ||
|
||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | ||
|
||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
|
||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | ||
|
||
- run: echo "🖥️ The workflow is now ready to test your code on the runner." | ||
|
||
- name: List files in the repository | ||
run: | | ||
ls ${{ github.workspace }} | ||
- run: echo "🍏 This job's status is ${{ job.status }}." | ||
|
||
- run: sh setup.sh | ||
working-directory: ${{ env.DBT_PROJECT_NAME }} | ||
|
||
- run: sh run.sh | ||
working-directory: ${{ env.DBT_PROJECT_NAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Run the elt pipeline using dbt | ||
|
||
dbt run --profiles-dir=$DBT_PROFILES_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
## | ||
## Validate runner configuration | ||
## | ||
|
||
if [[ -z "${DBT_PROJECT_NAME}" ]]; then | ||
echo "Environment variable DBT_PROJECT_NAME is not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${DBT_PROFILES_DIR}" ]]; then | ||
# Note: the value used by dbt when --profiles-dir is not is "/Users/<USER>/.dbt" | ||
echo "Environment variable DBT_PROFILES_DIR is not set" | ||
exit 1 | ||
fi | ||
|
||
## | ||
## Install system dependencies | ||
## | ||
|
||
# Upgrade pip | ||
python -m pip install --upgrade pip | ||
|
||
pip --version | ||
|
||
# Install virtualenv | ||
# pip install virtualenv | ||
|
||
# Create a virtual environment | ||
python -m venv .venv | ||
|
||
# Activate virtual environment | ||
source .venv/bin/activate | ||
|
||
## | ||
## Install project dependencies | ||
## | ||
|
||
## Install dbt packages | ||
|
||
# Install the dbt-<warehouse_provider> library using pip | ||
pip install dbt-snowflake | ||
|
||
# Confirm that the dbt installation was successful. | ||
dbt --version | ||
|
||
dbt init $DBT_PROJECT_NAME --profiles-dir=$DBT_PROFILES_DIR | ||
|
||
## | ||
## Setup dbt connection profile to data warehouse | ||
## | ||
|
||
# TODO | ||
# ... | ||
|
||
# Verify dbt connection profile to data warehouse | ||
dbt debug |