Skip to content

chore: Run migrate before pack #55

chore: Run migrate before pack

chore: Run migrate before pack #55

name: "Test AWS Cost Policies: Postgres"
on:
pull_request:
paths:
- "transformations/aws/cost/**"
- ".github/workflows/transformations_aws_cost_postgres.yml"
- "transformations/aws/macros/**"
- "transformations/aws/models/**"
- "transformations/macros/**"
- "scripts/dbt-pack/**"
push:
branches:
- main
paths:
- "transformations/aws/cost/**"
- ".github/workflows/transformations_aws_cost_postgres.yml"
- "transformations/aws/macros/**"
- "transformations/aws/models/**"
- "transformations/macros/**"
- "scripts/dbt-pack/**"
jobs:
transformations-aws-cost:
name: transformations/aws/cost
timeout-minutes: 30
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./transformations/aws/cost
services:
postgres:
image: postgres:11
env:
POSTGRES_PASSWORD: pass
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "./transformations/aws/cost/requirements.txt"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Setup CloudQuery
uses: cloudquery/setup-cloudquery@v3
with:
version: v4.0.0
# Test unpacked version
- name: Migrate DB
run: cloudquery migrate tests/postgres.yml
env:
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres
- name: Run Policies
run: |
dbt run --target dev-pg --profiles-dir ./tests
# Test packed version
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: scripts/dbt-pack/package-lock.json
- name: Install Dependencies
run: npm ci
working-directory: ./scripts/dbt-pack
- name: Pack DBT
working-directory: ./scripts/dbt-pack
run: node index.js dbt-pack --project-dir=../../transformations/aws/cost
- name: Unzip Packed DBT
run: unzip -o build/aws_cost.zip -d build/aws_cost
- name: Run Unpacked DBT
working-directory: ./transformations/aws/cost/build/aws_cost
run: |
dbt run --target dev-pg --profiles-dir ../../tests