Skip to content

Break apart CI workflows into composite actions #6253

Break apart CI workflows into composite actions

Break apart CI workflows into composite actions #6253

Workflow file for this run

# **what?**
# Runs all integration tests for supported OS's and Python versions.
# If triggered by a PR, the workflow will only run tests related to code changes.
#
# **why?**
# Check the functionality of dbt from a user's perspective and attempt to catch functional regressions.
#
# **how?**
# Run the workflow in Actions.
# Create a PR against a protected branch. If the PR is from a fork, include the `ok to test` label.
# Use the `test all` label to run all integration tests regardless of changes.
# Use the `ok to test` label to mark PRs from forks that are safe to run integration tests for.
# Requires secrets to run against different warehouses.
#
# **when?**
# A commit is pushed to a PR against a protected branch.
# A PR is merged into a protected branch.
# Manually triggered.
name: Adapter Integration Tests
on:
push:
branches:
- "main"
- "develop"
- "*.latest"
- "releases/*"
pull_request_target:
workflow_dispatch:
inputs:
dbt-core-branch:
description: "Branch of dbt-core to test against"
required: false
type: string
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
ok-to-test:
name: OK to Test
runs-on: ubuntu-latest
if: >-
github.event_name != 'pull_request_target' ||
github.event.pull_request.head.repo.full_name == github.repository ||
contains(github.event.pull_request.labels.*.name, 'ok to test')
steps:
- run: echo "OK to Test"
approval-required:
name: Approval Required
runs-on: ubuntu-latest
needs: ok-to-test
if: ${{ needs.ok-to-test.result == 'skipped' }}
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: unsplash/comment-on-pr@master
with:
msg: |
"You do not have permissions to run integration tests, @dbt-labs/core "\
"needs to label this PR with `ok to test` in order to run integration tests!"
check_for_duplicate_msg: true
integration-tests:
name: Integration Tests / Python ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: ok-to-test
if: ${{ needs.ok-to-test.result == 'success' }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: ['3.8', '3.9', '3.10', '3.11']
- os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8']
env:
SNOWFLAKE_TEST_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }}
SNOWFLAKE_TEST_PASSWORD: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }}
SNOWFLAKE_TEST_USER: ${{ secrets.SNOWFLAKE_TEST_USER }}
SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_WAREHOUSE }}
SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN: ${{ secrets.SNOWFLAKE_TEST_OAUTH_REFRESH_TOKEN }}
SNOWFLAKE_TEST_OAUTH_CLIENT_ID: ${{ secrets.SNOWFLAKE_TEST_OAUTH_CLIENT_ID }}
SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET: ${{ secrets.SNOWFLAKE_TEST_OAUTH_CLIENT_SECRET }}
SNOWFLAKE_TEST_ALT_DATABASE: ${{ secrets.SNOWFLAKE_TEST_ALT_DATABASE }}
SNOWFLAKE_TEST_ALT_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_ALT_WAREHOUSE }}
SNOWFLAKE_TEST_DATABASE: ${{ secrets.SNOWFLAKE_TEST_DATABASE }}
SNOWFLAKE_TEST_QUOTED_DATABASE: ${{ secrets.SNOWFLAKE_TEST_QUOTED_DATABASE }}
SNOWFLAKE_TEST_ROLE: ${{ secrets.SNOWFLAKE_TEST_ROLE }}
DBT_TEST_USER_1: dbt_test_role_1
DBT_TEST_USER_2: dbt_test_role_2
DBT_TEST_USER_3: dbt_test_role_3
steps:
- uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.event_name != 'pull_request_target'
with:
persist-credentials: false
- uses: ./.github/actions/run-integration-tests
with:
python-version: ${{ matrix.python-version }}
dbt-core-branch: ${{ inputs.dbt-core-branch }}
dd-api-key: ${{ secrets.DD_API_KEY }}
- uses: ./.github/actions/archive-test-results
with:
python-version: ${{ matrix.python-version }}
file-name-stub: integration_results