Skip to content

Commit

Permalink
chore: Better publish process (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
erezrokah authored Nov 24, 2023
1 parent f19a76c commit 687842f
Show file tree
Hide file tree
Showing 208 changed files with 2,596 additions and 74 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: "Test Azure Compliance Policies: Postgres"
name: "Test Azure Compliance Free Policies: Postgres"

on:
pull_request:
paths:
- "transformations/azure_compliance/**"
- ".github/workflows/transformations_azure_compliance_postgres.yml"
- "transformations/azure/compliance-free/**"
- ".github/workflows/transformations_azure_compliance_free_postgres.yml"
push:
branches:
- main
paths:
- "transformations/azure_compliance/**"
- ".github/workflows/transformations_azure_compliance_postgres.yml"
- "transformations/azure/compliance-free/**"
- ".github/workflows/transformations_azure_compliance_free_postgres.yml"

jobs:
test-policies:
transformations-azure-compliance-free:
name: transformations/azure/compliance-free
timeout-minutes: 30
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./transformations/azure_compliance
working-directory: ./transformations/azure/compliance-free
services:
postgres:
image: postgres:11
Expand All @@ -41,17 +42,17 @@ jobs:
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "./transformations/azure_compliance/requirements.txt"
cache-dependency-path: "./transformations/azure/compliance-free/requirements.txt"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Setup CloudQuery
uses: cloudquery/setup-cloudquery@v3
with:
version: v4.0.0
- name: Migrate DB
run: cloudquery migrate tests/azure.yml tests/pg.yml
run: cloudquery migrate tests/azure.yml tests/pg.yml
env:
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres
- name: DBT dependencies
run: |
dbt deps --target dev-pg --profiles-dir ./tests
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Test Azure Compliance Premium Policies: Postgres"

on:
pull_request:
paths:
- "transformations/azure/compliance-premium/**"
- ".github/workflows/transformations_azure_compliance_premium_postgres.yml"
push:
branches:
- main
paths:
- "transformations/azure/compliance-premium/**"
- ".github/workflows/transformations_azure_compliance_premium_postgres.yml"

jobs:
transformations-azure-compliance-premium:
name: transformations/azure/compliance-premium
timeout-minutes: 30
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./transformations/azure/compliance-premium
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/azure/compliance-premium/requirements.txt"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Setup CloudQuery
uses: cloudquery/setup-cloudquery@v3
with:
version: v3.29.1
- name: Migrate DB
run: cloudquery migrate tests/azure.yml tests/pg.yml
env:
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres
- name: DBT dependencies
run: |
dbt deps --target dev-pg --profiles-dir ./tests
- name: Run Policies
run: |
dbt run --target dev-pg --profiles-dir ./tests
4 changes: 0 additions & 4 deletions release-please-config-free.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"component": "transformation-aws-compliance-free",
"changelog-path": "CHANGELOG-free.md"
},
"transformations/azure_compliance": {
"component": "transformation-azure-compliance-free",
"changelog-path": "CHANGELOG-free.md"
},
"transformations/gcp_compliance": {
"component": "transformation-gcp-compliance-free",
"changelog-path": "CHANGELOG-free.md"
Expand Down
4 changes: 0 additions & 4 deletions release-please-config-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"component": "transformation-aws-compliance-premium",
"changelog-path": "CHANGELOG-premium.md"
},
"transformations/azure_compliance": {
"component": "transformation-azure-compliance-premium",
"changelog-path": "CHANGELOG-premium.md"
},
"transformations/gcp_compliance": {
"component": "transformation-gcp-compliance-premium",
"changelog-path": "CHANGELOG-premium.md"
Expand Down
13 changes: 13 additions & 0 deletions scripts/dbt-pack/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["unicorn"],
extends: ["eslint:recommended", "prettier", "plugin:unicorn/recommended"],
env: {
es2021: true,
node: true,
},
};
1 change: 1 addition & 0 deletions scripts/dbt-pack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions scripts/dbt-pack/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
20 changes: 20 additions & 0 deletions scripts/dbt-pack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# dbt-pack

A utility to pack a dbt project into a single zip file.

## Prerequisites

- [Node.js LTS](https://nodejs.org/en/)

## Setup

```bash
npm ci
```

## Usage

```bash
node index.js dbt-pack --project-dir=../../transformations/azure/compliance-free
node index.js dbt-pack --project-dir=../../transformations/azure/compliance-premium
```
26 changes: 26 additions & 0 deletions scripts/dbt-pack/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node
import path from "node:path";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { pack } from "./src/index.js";

yargs(hideBin(process.argv))
.command(
"dbt-pack",
"Package dbt project into a single zip",
() => {},
async ({ projectDir }) => {
await pack({
projectDir: path.resolve(projectDir),
});
},
)
.option("project-dir", {
alias: "p",
type: "string",
description: "Path to dbt project directory",
demandOption: true,
})
.demandCommand(1)
.strict()
.parse();
Loading

0 comments on commit 687842f

Please sign in to comment.