DBT Gitlab run #536
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: DBT Gitlab run | |
| permissions: | |
| contents: write | |
| on: | |
| schedule: | |
| - cron: '0 3 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| sql-logic-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| name: DBT Gitlab run | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Create assets dir | |
| working-directory: ./test/dbt_integration_tests/dbt-gitlab | |
| run: | | |
| mkdir assets | |
| - name: DBT Gitlab run | |
| working-directory: ./test/dbt_integration_tests/dbt-gitlab | |
| run: | | |
| ./run.sh --target embucket | |
| # Generate Test Assets | |
| - name: Generate data for commit message | |
| working-directory: ./test/dbt_integration_tests/dbt-gitlab | |
| run: | | |
| # Get coverage percentage for commit message | |
| COVERAGE=$(grep -o '[0-9.]\+%' assets/dbt_success_badge.txt | tr -d '%') | |
| echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV | |
| # Push Assets to Branch | |
| - name: Push Assets to Branch | |
| run: | | |
| # Copy test assets and statistics file to a temporary location before switching branches | |
| mkdir -p /tmp/embucket-assets | |
| cp -r test/dbt_integration_tests/dbt-gitlab/assets/* /tmp/embucket-assets/ | |
| rm -rf test/dbt_integration_tests/dbt-gitlab/assets/ | |
| # Setup git | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| # Fetch and checkout the existing assets branch | |
| git fetch origin assets_dbt | |
| git checkout assets_dbt | |
| # Clean the branch content (but keep .git folder) | |
| # find . -mindepth 1 -not -path "./.git*" -delete | |
| # Create assets directory | |
| mkdir -p assets_dbt | |
| # Copy assets from the temporary location | |
| cp -r /tmp/embucket-assets/* assets_dbt/ | |
| # Add and commit | |
| git add assets_dbt | |
| git commit -m "Update test assets [DBT Gitlab run result: $COVERAGE%] [skip ci]" || echo "No changes to commit" | |
| # Push to the existing assets branch | |
| git push origin assets_dbt |