This repository was archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
74 lines (61 loc) · 2.23 KB
/
Copy pathpr-comparison-job.yml
File metadata and controls
74 lines (61 loc) · 2.23 KB
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
68
69
70
71
72
73
name: PR Transformation and Comparison
on:
pull_request:
types: [opened, synchronize, reopened]
branches: ['main']
paths:
- models/**
- seeds/**
- tests/**
env:
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_ROLE }}
SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
SNOWFLAKE_SCHEMA: ${{ secrets.SNOWFLAKE_SCHEMA }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup DBT + Piperider
run: |
pip install dbt-snowflake
pip install piperider['snowflake']
- name: Run DBT on PR environment
run: dbt build --target jaffle_shop_pr
- name: Profile on PR environment
run: piperider run --datasource jaffle_shop_pr --dbt-state target -o /tmp/pr-report/
- name: Profile on PROD environment
run: piperider run --datasource jaffle_shop -o /tmp/prod-report/
- name: Compare and Prepare
run: |
piperider compare-reports \
--debug \
--base /tmp/prod-report/run.json \
--target /tmp/pr-report/run.json \
--output comparison-report/ \
--tables-from target-only
zip -r comparison-report.zip comparison-report/
- uses: actions/upload-artifact@v3
with:
name: comparison-report-artifact
path: comparison-report.zip
- name: Prepare Comparison Summary
run: |
echo "# :bar_chart: Piperider Comparison Summary" > summary.md
cat comparison-report/summary.md >> summary.md
echo -e "\n" >> summary.md
echo "## :paperclip: Generated Comparison Report ZIP" >> summary.md
echo "Find it in the [Github Action Runs Page](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> summary.md
- name: Create PR Comment
uses: peter-evans/create-or-update-comment@v2.1.0
with:
issue-number: ${{ github.event.number }}
body-file: summary.md