Skip to content

OpenBB bug Fix

OpenBB bug Fix #1949

name: Build and deploy to dev
on:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
branches:
- 'main'
# Cancel any existing runs of this workflow on the same branch/pr
# We always want to build/deploy/test a new commit over an older one
concurrency:
group: ${{ github.workflow_ref }}
cancel-in-progress: true
jobs:
# Looks for labels like "deploy-to-<env>" attached to a PR so we can deploy to those envs
get-deploy-labels:
name: Get Deploy Envs
runs-on: mdb-dev
environment:
name: ${{ github.event.pull_request.head.repo.fork && 'manual-approval' || '' }}
outputs:
deploy-envs: ${{ steps.get-labels.outputs.deploy-envs }}
steps:
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
- id: get-labels
uses: ./github-actions/get-deploy-labels
# Build our docker images based on our bake file
build:
name: Build Docker Images
runs-on: mdb-dev
needs: [get-deploy-labels]
if: needs.get-deploy-labels.outputs.deploy-envs != '[]'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
# Build the bakefile and push
- uses: ./github-actions/docker-bake
with:
git-sha: ${{ github.event.pull_request.head.sha }}
# Build our docker images based on our bake file
# This job only pushes the layers to the cache repo
# It's done separately so other jobs can run without waiting for this one
build_cache:
name: Build Docker Cache
runs-on: mdb-dev
needs: [build]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
- uses: ./github-actions/docker-bake-cache
with:
git-sha: ${{ github.event.pull_request.head.sha }}
# Call our deployment workflow, so long as this is not a forked PR
# This will run the deployment workflow in the base branch, not in the PR.
# So if you change the deploy workflow in your PR, the changes won't be reflected in this run.
deploy:
name: Deploy
needs: [build, get-deploy-labels]
if: needs.get-deploy-labels.outputs.deploy-envs != '[]'
uses: ./.github/workflows/deploy.yml
with:
deploy-envs: ${{ needs.get-deploy-labels.outputs.deploy-envs }}
image-tag: ${{ github.event.pull_request.head.sha }}
secrets: inherit
# Run integration tests
# TODO: Run these against the deployed environment
run_tests:
name: Run Integration Tests
needs: [deploy]
uses: ./.github/workflows/test_on_deploy.yml
secrets: inherit