-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
532 changed files
with
41,282 additions
and
35,238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
*.sql linguist-detectable=true | ||
*.sql linguist-detectable=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
--- | ||
name: Deployment | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
env: | ||
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | ||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | ||
|
@@ -14,49 +13,42 @@ env: | |
BASEDOSDADOS_CREDENTIALS_PROD: ${{ secrets.BASEDOSDADOS_CREDENTIALS_PROD }} | ||
BASEDOSDADOS_CREDENTIALS_STAGING: ${{ secrets.BASEDOSDADOS_CREDENTIALS_STAGING }} | ||
IMAGE_NAME: ghcr.io/basedosdados/queries-basedosdados | ||
|
||
|
||
jobs: | ||
build-container: | ||
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main') | ||
if: (github.event.pull_request.merged == true && github.event.pull_request.base.ref | ||
== 'main') | ||
name: Deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Google Cloud CLI | ||
uses: google-github-actions/[email protected] | ||
with: | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
export_default_credentials: true | ||
|
||
- name: Get GKE credentials | ||
uses: google-github-actions/[email protected] | ||
with: | ||
cluster_name: ${{ env.GKE_CLUSTER }} | ||
location: ${{ env.GKE_REGION }} | ||
credentials: ${{ secrets.GCP_SA_KEY }} | ||
|
||
- name: Build and publish image | ||
run: | | ||
docker build -t $IMAGE_NAME:$GITHUB_SHA . | ||
echo $GH_PAT | docker login ghcr.io -u gabriel-milan --password-stdin | ||
docker push $IMAGE_NAME:$GITHUB_SHA | ||
- name: Set up Kustomize | ||
run: |- | ||
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64 | ||
chmod u+x ./kustomize | ||
- name: Deploy | ||
run: |- | ||
./kustomize edit set image gcr.io/PROJECT_ID/IMAGE_DBT:TAG=$IMAGE_NAME:$GITHUB_SHA | ||
./kustomize build . | kubectl apply -n prefect-agent-basedosdados -f - | ||
kubectl rollout status -w -n prefect-agent-basedosdados deployment/dbt-rpc-dev | ||
kubectl rollout status -w -n prefect-agent-basedosdados deployment/dbt-rpc-prod | ||
table-approve: | ||
if: contains(github.event.pull_request.labels.*.name, 'table-approve') | ||
needs: build-container | ||
|
@@ -65,51 +57,42 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get all changed files using a comma separator | ||
id: changed-files | ||
uses: tj-actions/changed-files@v35 | ||
with: | ||
separator: ',' | ||
|
||
- name: Setup Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
- name: Run script for approving table | ||
run: | | ||
python .github/workflows/scripts/table_approve.py --modified-files ${{ steps.changed-files.outputs.all_modified_files }} --graphql-url ${{ secrets.BACKEND_GRAPHQL_URL }} --source-bucket-name ${{ secrets.SOURCE_BUCKET_NAME }} --destination-bucket-name ${{ secrets.DESTINATION_BUCKET_NAME }} --backup-bucket-name ${{ secrets.BACKUP_BUCKET_NAME }} --prefect-backend-token ${{ secrets.PREFECT_BACKEND_TOKEN }} --materialization-mode ${{ secrets.MATERIALIZATION_MODE }} --materialization-label ${{ secrets.MATERIALIZATION_LABEL }} | ||
change-metadata-status: | ||
needs: table-approve | ||
name: Change metadata status to "production" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get all changed files using a comma separator | ||
id: changed-files | ||
uses: tj-actions/changed-files@v35 | ||
with: | ||
separator: ',' | ||
|
||
- name: Setup Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
- name: Run script for changing metadata status | ||
run: | | ||
run: |- | ||
python .github/workflows/scripts/change_metadata_status.py --modified-files ${{ steps.changed-files.outputs.all_modified_files }} --graphql-url ${{ secrets.BACKEND_GRAPHQL_URL }} --status published --email ${{ secrets.BACKEND_EMAIL }} --password ${{ secrets.BACKEND_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,41 @@ | ||
--- | ||
name: Deploy docs | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
env: | ||
DBT_SA: ${{ secrets.DBT_SA }} | ||
|
||
jobs: | ||
docs: | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref | ||
== 'main' | ||
name: Deploy docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9.x" | ||
|
||
python-version: 3.9.x | ||
- name: Upgrade pip | ||
run: | | ||
pip install -U pip | ||
- name: Install dependencies | ||
run: | | ||
pip3 install -r requirements-docs.txt -r requirements.txt | ||
- name: Setup credentials | ||
run: | | ||
echo $DBT_SA | base64 --decode > dbt-sa.json | ||
python3 .github/workflows/scripts/modify_profiles.py | ||
- name: Generate docs | ||
run: | | ||
dbt docs generate --profiles-dir . | ||
- name: Delete credentials | ||
run: | | ||
rm dbt-sa.json | ||
- name: Deploy docs | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: target | ||
folder: target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
--- | ||
name: Lint Dockerfile | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
docker_lint: | ||
name: Lint Dockerfile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from argparse import ArgumentParser | ||
|
||
from backend import Backend | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Change credentials path to current path | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from argparse import ArgumentParser | ||
from copy import deepcopy | ||
import json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
import sys | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from pathlib import Path | ||
from typing import List, Tuple, Union | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.