Skip to content

Commit

Permalink
Split deployment workflow into multiple jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
portovep committed Oct 19, 2023
1 parent 4184c39 commit 79f2c84
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ on:
required: true
type: string

env:
POSTGRES_HOST: ${{ vars.POSTGRES_HOST }}
POSTGRES_USER: ${{ vars.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ vars.POSTGRES_DB }}

jobs:
deploy-test:
name: Deploy to test environment
seed-source-tables:
name: Seed source tables
runs-on: ubuntu-latest
environment: ${{ inputs.environment-name }}
container:
image: ghcr.io/dbt-labs/dbt-postgres:1.6.3
env:
POSTGRES_HOST: ${{ vars.POSTGRES_HOST }}
POSTGRES_USER: ${{ vars.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ vars.POSTGRES_DB }}

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -29,9 +29,38 @@ jobs:
- name: Run seeds
run: |
dbt seed --target ${{ inputs.environment-name }}
source-contract-tests:
name: Run source contract tests
needs: [seed-source-tables]
runs-on: ubuntu-latest
environment: ${{ inputs.environment-name }}
container:
image: ghcr.io/dbt-labs/dbt-postgres:1.6.3
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
dbt deps
- name: Run seeds
run: |
dbt seed --target ${{ inputs.environment-name }}\
- name: Run source contract tests
run: |
dbt test --target ${{ inputs.environment-name }} --select tag:contract-test-source
deploy:
name: Deploy
needs: [source-contract-tests]
runs-on: ubuntu-latest
environment: ${{ inputs.environment-name }}
container:
image: ghcr.io/dbt-labs/dbt-postgres:1.6.3
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
dbt deps
- name: Run data transformations
run: |
dbt run --target ${{ inputs.environment-name }}

0 comments on commit 79f2c84

Please sign in to comment.