Skip to content

Commit

Permalink
Merge pull request #5 from DataRecce/ci/staging-daily-job
Browse files Browse the repository at this point in the history
[Chore] Add recce staging env preparation workflow
  • Loading branch information
wcchang1115 authored May 20, 2024
2 parents 2c2dc03 + 8f3bf78 commit c80542c
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/recce-staging-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: OSO Recce Staging CI

on:
workflow_dispatch:
schedule:
- cron: '0 18 * * *' # run at 2 AM (UTC + 8) everyday
pull_request:
types: [closed]
branches: [main, dev]
paths:
- warehouse/dbt/**

env:
# dbt env variables used in your dbt profiles.yml
DBT_PROFILES_DIR: ./
DBT_GOOGLE_PROJECT: ${{ vars.DBT_GOOGLE_PROJECT }}
DBT_GOOGLE_DATASET: ${{ vars.DBT_GOOGLE_DATASET }}
DBT_GOOGLE_KEYFILE: /tmp/google/google-service-account.json
PACKAGES_YAML: ${{ vars.PACKAGES_YAML }}
KEYFILE_CONTENTS: ${{ secrets.KEYFILE_CONTENTS }}

jobs:
prepare-recce-staging-env:
name: Prepare Recce staging env
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12.x"

- name: Install dependencies
run: |
pipx install poetry==1.7.1
poetry install
source $(poetry env info --path)/bin/activate
which dbt
- name: Add packages.yml file
run: |
echo '${{ vars.PACKAGES_YAML }}' > packages.yml
- name: Prep Google keyfile
run: |
mkdir -p "$(dirname $DBT_GOOGLE_KEYFILE)"
echo "$KEYFILE_CONTENTS" > $DBT_GOOGLE_KEYFILE
- name: Prepare dbt Base environment
run: |
source $(poetry env info --path)/bin/activate
dbt deps
dbt build --target ${{ env.DBT_BASE_TARGET }}
dbt docs generate --target ${{ env.DBT_BASE_TARGET }}
env:
DBT_BASE_TARGET: "playground"

- name: Archive DBT artifacts
uses: actions/upload-artifact@v4
with:
name: dbt-artifacts
path: |
target/manifest.json
target/catalog.json

0 comments on commit c80542c

Please sign in to comment.