Merge pull request #4 from TechnologyEnhancedLearning/poc-dab-workflow #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
| # Rely on ci.yml and branch rules to ensure bundle validation and linting | |
| # we are not going from staging straight to prod, because we use staging for manual testing as well | |
| # [use as a ref](https://github.com/evanaze/dbx-asset-bundle-deployment/blob/main/.github/workflows/dev-ci.yml) | |
| name: Deploy to Databricks Staging and Trigger Tests in Databricks | |
| on: | |
| push: | |
| branches: | |
| - staging #longer name for communication in the poc reduce when using it | |
| - staging-data-test-team-shared | |
| jobs: | |
| deploy_to_staging: | |
| name: "Deploy Bundle to Stage Environment" | |
| runs-on: ubuntu-latest | |
| environment: staging | |
| env: | |
| DATABRICKS_HOST: ${{ vars.DBX_HOST }} | |
| DATABRICKS_CLIENT_ID: ${{ vars.DBX_SP_ID }} | |
| DATABRICKS_CLIENT_SECRET: ${{ secrets.DBX_SP_SECRET }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| ### maybe put in later | |
| # - name: Set up Python | |
| # uses: actions/setup-python@v4 | |
| # with: | |
| # python-version: '3.10' | |
| # - name: Install dependencies | |
| # run: | | |
| # pip install -r requirements.txt | |
| # qqqq add a step to make a version number so can see its changed and print it as part of the job | |
| #DAB_VERSION: "staging-${GITHUB_SHA::7}" # short commit hash | |
| # databricks bundle deploy --environment staging --version $DAB_VERSION | |
| - name: Set up Databricks CLI | |
| uses: databricks/setup-cli@main | |
| - name: Validate Staging Bundle | |
| # trigger target the staging deploy in databricks.yml | |
| run: databricks bundle validate -t staging --profile "" # forces use of env vars only | |
| - name: Deploy Staging Bundle | |
| # trigger target the staging deploy in databricks.yml | |
| run: databricks bundle deploy -t staging --profile "" # forces use of env vars only #??--auto-approve | |
| # working-directory: . | |
| # testing: | |
| # name: "Integration Testing" | |
| # runs-on: ubuntu-latest | |
| # needs: deploy_to_staging | |
| # environment: staging | |
| # env: | |
| # DATABRICKS_HOST: ${{ vars.DBX_HOST }} | |
| # DATABRICKS_CLIENT_ID: ${{ vars.DBX_SP_ID }} | |
| # DATABRICKS_CLIENT_SECRET: ${{ secrets.DBX_SP_SECRET }} | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-python@v5 | |
| # id: cache | |
| # name: Cache Python build | |
| # with: | |
| # python-version: "3.x" | |
| # cache-dependency-path: "requirements-dev.txt" | |
| # cache: "pip" | |
| # - name: Install dependencies | |
| # run: pip install -r requirements-dev.txt | |
| # - name: Integration Testing | |
| # run: pytest tests/integration |