diff --git a/.github/workflows/recce_ci.yml b/.github/workflows/recce_ci.yml new file mode 100644 index 0000000..d661522 --- /dev/null +++ b/.github/workflows/recce_ci.yml @@ -0,0 +1,90 @@ +name: Recce CI + +on: + pull_request: + branches: [main] + +jobs: + check-pull-request: + name: Check pull request by Recce CI + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Python, Poetry and Dependencies + uses: packetcoders/action-setup-cache-python-poetry@main + with: + python-version: 3.12 + poetry-version: 1.8.3 + + - name: Install dbt packages + run: | + poetry run dbt deps + + - name: Prepare dbt Base environment + run: | + git checkout main + poetry run dbt seed -t prod + poetry run dbt build -t prod --target-path target-base + poetry run dbt docs generate -t prod --target-path target-base + + - name: Prepare dbt Current environment + run: | + git checkout - + poetry run dbt clone --state target-base --full-refresh + poetry run dbt build -s state:modified+ --state target-base + poetry run dbt docs generate + + - name: Run Recce CI + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + RECCE_STATE_PASSWORD: ${{ vars.RECCE_STATE_PASSWORD}} + run: | + poetry run recce run --cloud + + - name: Upload Recce State File + uses: actions/upload-artifact@v4 + id: duckdb-uploader + with: + name: duckdb + path: | + jaffle_shop.duckdb + + - name: Prepare Recce Summary + id: recce-summary + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + RECCE_STATE_PASSWORD: ${{ vars.RECCE_STATE_PASSWORD}} + run: | + set -eo pipefail + + poetry run recce summary --cloud > recce_summary.md + + # Add next steps message + cat << EOF >> recce_summary.md + + ## Next Steps + To view detailed Recce results: + 1. Checkout the PR branch: \`git checkout ${{ github.event.pull_request.head.ref }}\` + 2. Launch the Recce server: \`recce server --review --cloud\` + 3. Open http://localhost:8000 in your browser + EOF + + # Truncate summary if it exceeds GitHub's comment size limit + if [[ $(wc -c < recce_summary.md) -ge 65535 ]]; then + truncate -s 65000 recce_summary.md + echo " + ... (Summary truncated due to size limit) + + For the full summary, please check the Job Summary page: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}} + " >> recce_summary.md + fi + + - name: Comment on pull request + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: recce_summary.md + comment_tag: recce diff --git a/.gitignore b/.gitignore index 262295a..d38e6f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # dbt .user.yml target/ +target-base/ dbt_packages/ logs/ diff --git a/package-lock.yml b/package-lock.yml new file mode 100644 index 0000000..502c44a --- /dev/null +++ b/package-lock.yml @@ -0,0 +1,8 @@ +packages: + - package: dbt-labs/audit_helper + version: 0.12.0 + - package: data-mie/dbt_profiler + version: 0.8.3 + - package: dbt-labs/dbt_utils + version: 1.3.0 +sha1_hash: 28d7cfe7e3dc5b633c976b979449074a46d5e422 diff --git a/packages.yml b/packages.yml new file mode 100644 index 0000000..2b75168 --- /dev/null +++ b/packages.yml @@ -0,0 +1,5 @@ +packages: + - package: dbt-labs/audit_helper + version: 0.12.0 + - package: data-mie/dbt_profiler + version: 0.8.3