forked from opensource-observer/oso
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (58 loc) · 1.95 KB
/
recce-staging-daily.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
if: github.event.pull_request.merged == true || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
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