Skip to content

Commit

Permalink
work on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayrnt committed Nov 4, 2024
1 parent da2eea6 commit 47ad382
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/sqlmesh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ on:
types:
- synchronize
- opened
# GitHub secrets
env:
#DBT_PROFILES_DIR: ./dbt_project
GITHUB_SHA_OVERRIDE: ${{ github.event.pull_request.head.sha }} # We need the commit hash of the pull request branch's head, the GITHUB_SHA env var is always the base branch in a pull_request_target trigger
DBT_ENV_SECRET_BIGQUERY_TEST_SERVICE_ACCOUNT: ${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_SERVICE_ACCOUNT }}
DBT_ENV_SECRET_BIGQUERY_TEST_STORAGE_PROJECT: ${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_STORAGE_PROJECT }}
DBT_ENV_SECRET_BIGQUERY_TEST_EXECUTION_PROJECT: ${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_EXECUTION_PROJECT }}
DBT_ENV_SECRET_BIGQUERY_TEST_LOCATION: ${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_LOCATION }}
GOOGLE_APPLICATION_CREDENTIALS: "./keyfile.json"
# The latest commit is the one that will be used to create the PR environment and deploy to production
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
Expand All @@ -23,15 +32,27 @@ jobs:
# Required to merge
pull-requests: write
steps:
- name: Setup Python
uses: actions/setup-python@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Write keyfile if secret is defined
run: |
if [ -z "${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_SERVICE_ACCOUNT }}" ]; then
echo "Error: DBT_ENV_SECRET_BIGQUERY_TEST_SERVICE_ACCOUNT is not defined."
else
echo ${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_SERVICE_ACCOUNT }} | base64 -d > keyfile.json
fi
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.pull_request && github.event.issue.number || github.event.pull_request.number }}/merge
- name: Install SQLMesh + Dependencies
run: pip install -r requirements.txt
shell: bash
- name: Check dbt debug
run: |
cd dbt_project && pwd && dbt debug
- name: Run CI/CD Bot
run: |
sqlmesh_cicd -p ${{ github.workspace }}/dbt_project -p ${{ github.workspace }}/sqlmesh_project github --token ${{ secrets.GITHUB_TOKEN }} run-all
cd ${{ github.workspace }} && pwd && sqlmesh_cicd -p ${{ github.workspace }}/dbt_project -p ${{ github.workspace }}/sqlmesh_project github --token ${{ secrets.GITHUB_TOKEN }} run-all

0 comments on commit 47ad382

Please sign in to comment.