forked from opensource-observer/oso
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from DataRecce/ci/staging-daily-job
[Chore] Add recce staging env preparation workflow
- Loading branch information
Showing
1 changed file
with
66 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,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 |