[DEV] Testing two jobs workflow #4
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
name: Recce with dbt cloud | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
prepare-artifacts: | |
name: Prepare for Recce | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger the dbt cloud job and fetch artifacts for Recce | |
uses: datarecce/dbt-cloud-action@main | |
id: recce_dbt_cloud_run | |
with: | |
dbt_cloud_token: ${{ secrets.DBT_CLOUD_API_TOKEN }} | |
dbt_cloud_account_id: 62083 | |
dbt_cloud_base_job_id: 747906 | |
dbt_cloud_current_job_id: 747907 | |
failure_on_error: true | |
- name: Upload DBT Artifacts for CICD job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: target | |
path: target/ | |
- name: Upload DBT Artifacts for Prod job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: target-base | |
path: target-base/ | |
recce-run: | |
needs: prepare-artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- uses: "google-github-actions/auth@v2" | |
id: google-auth | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY_JSON }} | |
- name: Download artifactss | |
uses: actions/download-artifact@v4 | |
- name: Update dbt dependencies | |
run: dbt deps | |
- name: Run Recce in cloud mode | |
env: | |
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }} | |
BQ_DATASET: recce_ci | |
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }} | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
RECCE_STATE_PASSWORD: ${{ secrets.RECCE_STATE_PASSWORD }} | |
run: recce run --cloud | |
- name: Prepare Recce Summary | |
id: recce-summary | |
env: | |
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }} | |
BQ_DATASET: recce_ci | |
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }} | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
RECCE_STATE_PASSWORD: ${{ secrets.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 |