Skip to content

Commit

Permalink
Merge pull request #15 from devoteamgcloud/feat/ci-checks
Browse files Browse the repository at this point in the history
Feat/ci checks
  • Loading branch information
hrialan authored Jun 13, 2024
2 parents 6b30e46 + b08dab2 commit 00314c0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pre-commit-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: pre-commit check
on:
pull_request:
branches:
- main
jobs:
pre-commit-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install pre-commit
- run: pre-commit run --all-files
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, main]
- repo: https://github.com/devoteamgcloud/pre-commit-dataform
rev: v1.0.2
rev: v1.1.3
hooks:
- id: dataform_format
- id: dataform_compile
2 changes: 1 addition & 1 deletion includes/data_completeness_assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const createDataCompletenessAssertion = (globalParams, filter, tableName, column
${ctx.ref(tableName)}
WHERE
${filter}
)
)
SELECT COUNT(*) AS total_rows,
SUM(CASE WHEN ${columnName} IS NULL THEN 1 ELSE 0 END) AS null_count
FROM filtering
Expand Down
5 changes: 2 additions & 3 deletions includes/data_freshness_assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const assertions = [];

const createDataFreshnessAssertion = (globalParams, filter, tableName, delayCondition, timeUnit, dateColumn, timeZone = "UTC") => {

const assertion = assert(`assert_freshness_${tableName}`)
.database(globalParams.database)
.schema(globalParams.schema)
Expand All @@ -35,8 +35,7 @@ const createDataFreshnessAssertion = (globalParams, filter, tableName, delayCond
${ctx.ref(tableName)}
WHERE
${filter}
),
),
freshness AS (
SELECT
${["DAY", "WEEK", "MONTH", "QUARTER", "YEAR"].includes(timeUnit)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 00314c0

Please sign in to comment.