Setup Recce CI #1
This file contains hidden or 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
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: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12.x" | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
dbt deps | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Prepare dbt Base environment | |
run: | | |
dbt seed -t prod | |
dbt build -t prod --target-path target-base | |
dbt docs generate -t prod --target-path target-base | |
- name: Checkout back PR branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Prepare dbt Current environment | |
run: | | |
dbt seed | |
dbt build | |
dbt docs generate | |
- name: Run Recce CI | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
RECCE_STATE_PASSWORD: ${{ vars.RECCE_STATE_PASSWORD}} | |
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 | |
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 |