Added databricks asset bundle files #3
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: Databricks Asset Bundle CI/CD - DEV Only | |
| on: | |
| push: | |
| branches: [dbx-asset-bundles] | |
| pull_request: | |
| branches: [dbx-asset-bundles] | |
| # Personal Access Token (PAT) authentication for DEV environment | |
| jobs: | |
| # Continuous Integration | |
| validate: | |
| name: Validate Bundle | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Setup Databricks CLI | |
| uses: databricks/setup-cli@main | |
| - name: Install dependencies | |
| run: | | |
| pip install -r ci-cd/requirements.txt || echo "No requirements.txt found" | |
| - name: Validate Bundle Configuration | |
| env: | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| run: | | |
| databricks bundle validate | |
| - name: Run Bundle Syntax Check (DEV only) | |
| env: | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| run: | | |
| databricks bundle validate --target dev | |
| # Unit Tests (if you have test files) | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install test dependencies | |
| run: | | |
| pip install pytest databricks-connect | |
| pip install -r ci-cd/requirements.txt || echo "No requirements.txt found" | |
| - name: Run unit tests | |
| run: | | |
| pytest ci-cd/tests/ -v || echo "No tests found" | |
| # Deploy to Development | |
| deploy-dev: | |
| name: Deploy to Development | |
| runs-on: ubuntu-latest | |
| needs: [validate] | |
| if: github.ref == 'refs/heads/dbx-asset-bundles' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Databricks CLI | |
| uses: databricks/setup-cli@main | |
| - name: Deploy to Development | |
| env: | |
| DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} | |
| DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }} | |
| run: | | |
| databricks bundle deploy --target dev | |
| - name: Run Integration Tests (Optional) | |
| run: | | |
| # You can trigger specific jobs for validation | |
| # databricks jobs run-now --job-id <job-id> | |
| echo "Integration tests would run here" | |