Skip to content

Commit

Permalink
feat: CI PR setup (#3)
Browse files Browse the repository at this point in the history
* feat: CI PR setup

* fix: dbt not found

* fix: 'SQLSERVER_DATABASE' is already defined

* fix: Install dependencies failed

* fix: cp: cannot stat 'profiles/profiles.yml': No such file or directory

* fix: Could not find profile named 'integration_tests_dbt_translate'

* feat: add dbt docs to main site

* feat: add badge [skip ci]
  • Loading branch information
datnguye authored Apr 9, 2023
1 parent 7e8d561 commit 8a6d780
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 15 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ on:
workflow_dispatch:

jobs:
dbt-msft:
integration-tests-sqlserver:
runs-on: ubuntu-latest
strategy:
matrix:
msodbc_version: ["18"]
sqlserver_version: ["2022"]
sqlserver_version: ["2017", "2019", "2022"]
container:
image: ghcr.io/dbt-msft/dbt-sqlserver:CI-3.9-msodbc${{ matrix.msodbc_version }}
image: ghcr.io/dbt-msft/dbt-sqlserver:CI-3.10-msodbc18
services:
sqlserver:
image: ghcr.io/dbt-msft/dbt-sqlserver:server-${{ matrix.sqlserver_version }}
Expand All @@ -23,14 +22,23 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: pip install dbt-sqlserver

- name: Copy profiles
run: |
mkdir -p ~/.dbt
cp integration_tests/profiles/profiles.yml ~/.dbt/profiles.yml
- name: Run integration test
run: |
dbt deps -t sqlserver
dbt build -t sqlserver
working-directory: integration_tests
env:
SQLSERVER_HOST: localhost
SQLSERVER_HOST: sqlserver
SQLSERVER_PORT: 1433
SQLSERVER_DATABASE:
SQLSERVER_DATABASE: msdb
SQLSERVER_USER: sa
SQLSERVER_PASSWORD: 5atyaNadell@
SQLSERVER_SCHEMA: PRCI_${{ github.sha }}
33 changes: 31 additions & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Deploy MkDocs Site
name: deploy documentation site

on:
release:
Expand All @@ -9,6 +9,18 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
sqlserver_version: ["2022"]
container:
image: ghcr.io/dbt-msft/dbt-sqlserver:CI-3.10-msodbc18
services:
sqlserver:
image: ghcr.io/dbt-msft/dbt-sqlserver:server-${{ matrix.sqlserver_version }}
env:
ACCEPT_EULA: 'Y'
SA_PASSWORD: 5atyaNadell@

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
Expand All @@ -25,7 +37,24 @@ jobs:
path: .cache

- name: Install dependencies
run: pip install mkdocs mkdocs-material mkdocs-minify-plugin
run: |
pip install dbt-sqlserver
pip install mkdocs mkdocs-material mkdocs-minify-plugin mkdocs-simple-hooks
- name: Build dbt docs site
run: |
mkdir -p ~/.dbt
cp profiles/profiles.yml ~/.dbt/profiles.yml
dbt deps -t sqlserver
dbt docs generate -t sqlserver
working-directory: integration_tests
env:
SQLSERVER_HOST: sqlserver
SQLSERVER_PORT: 1433
SQLSERVER_DATABASE: msdb
SQLSERVER_USER: sa
SQLSERVER_PASSWORD: 5atyaNadell@
SQLSERVER_SCHEMA: docs

- name: Build site
run: |
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

<img align="right" width="200" height="200" src="https://raw.githubusercontent.com/datnguye/dbt-translate/main/docs/assets/img/resp.jpg">

[![dbt-translate](https://img.shields.io/badge/official--documentation--site-visit-blueviolet)](https://dbt-translate.datnguyen.de/)

[![dbt](https://img.shields.io/badge/dbt-packages-FF694B?logo=dbt&logoColor=FF694B)](https://hub.getdbt.com/datnguye/dbt_translate/latest/)
[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![GitHub repo](https://img.shields.io/badge/inspired--by-mssql--num2words-brightgreen)](https://github.com/datnguye/mssql-num2words)

[![conitinous integration test](https://github.com/datnguye/dbt-translate/actions/workflows/ci-pr.yml/badge.svg)](https://github.com/datnguye/dbt-translate/actions/workflows/ci-pr.yml)


✨ Helps to convert **Numbers** to **Words**

Currently supporting:
Expand Down
8 changes: 8 additions & 0 deletions docs/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pathlib import Path
import shutil
import os

def copy_dbt_docs(config, **kwargs):
site_dir = config['site_dir']
print(Path.cwd())
shutil.copytree("integration_tests/target/", os.path.join(site_dir, 'dbt-docs'))
5 changes: 3 additions & 2 deletions integration_tests/profiles/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config:
send_anonymous_usage_stats: False
use_colors: True

integration_tests:
integration_tests_dbt_translate:
target: snowflake
outputs:
snowflake:
Expand All @@ -25,7 +25,8 @@ integration_tests:
schema: "{{env_var('SQLSERVER_SCHEMA')}}"
user: "{{env_var('SQLSERVER_USER')}}"
password: "{{env_var('SQLSERVER_PASSWORD')}}"
threads: 10
threads: 4
encrypt: true
trust_cert: True

postgres:
Expand Down
11 changes: 6 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: Numbers to Words in dbt
site_name: Numbers to Words in dbt
site_url: https://datnguye.github.io/dbt-translate/
site_author: Dat Nguyen
site_description: Offical documentation of `dbt-translate` dbt package
Expand Down Expand Up @@ -63,9 +63,13 @@ plugins:
- minify:
minify_html: true
- offline
- mkdocs-simple-hooks:
hooks:
on_post_build: "docs.hooks:copy_dbt_docs"

nav:
- dbt-translate: index.md
- ✨dbt-translate: index.md
- 👉dbt docs: dbt-docs/index.html # managed by hooks.copy_dbt_docs
- Development:
- nav/development/contributing-guide.md
- nav/development/release-notes.md
Expand All @@ -75,9 +79,6 @@ nav:
extra:
annotate:
json: [.s2]
# analytics:
# provider: google
# property: !ENV GOOGLE_ANALYTICS_KEY
social:
- icon: fontawesome/brands/github
link: https://github.com/datnguye
Expand Down

0 comments on commit 8a6d780

Please sign in to comment.