From 550521ebaba99e4666f6b0908f429ec062fb6d8b Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Thu, 1 Aug 2024 14:59:06 -0400 Subject: [PATCH] Integration workflow update to support all-in-one adapter testing (#133) --- ...s.sh => update_dev_dependency_branches.sh} | 16 +++--- .github/workflows/integration-tests.yml | 49 +++++++++++++++++-- 2 files changed, 55 insertions(+), 10 deletions(-) rename .github/scripts/{update_dev_packages.sh => update_dev_dependency_branches.sh} (61%) diff --git a/.github/scripts/update_dev_packages.sh b/.github/scripts/update_dev_dependency_branches.sh similarity index 61% rename from .github/scripts/update_dev_packages.sh rename to .github/scripts/update_dev_dependency_branches.sh index c0f207b4..cf652c31 100755 --- a/.github/scripts/update_dev_packages.sh +++ b/.github/scripts/update_dev_dependency_branches.sh @@ -2,16 +2,20 @@ set -e -adapters_git_branch=$1 -core_git_branch=$2 +dbt_adapters_branch=$1 +dbt_core_branch=$2 +dbt_common_branch=$3 target_req_file="pyproject.toml" -core_req_sed_pattern="s|dbt-core.git.*#subdirectory=core|dbt-core.git@${core_git_branch}#subdirectory=core|g" -adapters_req_sed_pattern="s|dbt-adapters.git|dbt-adapters.git@${adapters_git_branch}|g" +core_req_sed_pattern="s|dbt-core.git.*#subdirectory=core|dbt-core.git@${dbt_core_branch}#subdirectory=core|g" +adapters_req_sed_pattern="s|dbt-adapters.git|dbt-adapters.git@${dbt_adapters_branch}|g" +common_req_sed_pattern="s|dbt-common.git|dbt-common.git@${dbt_common_branch}|g" if [[ "$OSTYPE" == darwin* ]]; then # mac ships with a different version of sed that requires a delimiter arg - sed -i "" "$core_req_sed_pattern" $target_req_file sed -i "" "$adapters_req_sed_pattern" $target_req_file + sed -i "" "$core_req_sed_pattern" $target_req_file + sed -i "" "$common_req_sed_pattern" $target_req_file else - sed -i "$core_req_sed_pattern" $target_req_file sed -i "$adapters_req_sed_pattern" $target_req_file + sed -i "$core_req_sed_pattern" $target_req_file + sed -i "$common_req_sed_pattern" $target_req_file fi diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 45fe8d4f..590f6f67 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,5 +1,7 @@ name: Integration Tests +run-name: "${{ (contains(github.event_name, 'workflow_') && inputs.name) || github.event_name }}: ${{ (contains(github.event_name, 'workflow_') && inputs.adapter_branch) || github.ref_name }} by @${{ github.actor }}" + on: push: branches: @@ -8,28 +10,58 @@ on: pull_request: workflow_dispatch: inputs: + name: + description: "Name to associate with run (example: 'dbt-adapters-242')" + required: false + type: string + default: "Adapter Integration Tests" + adapter_branch: + description: "The branch of this adapter repository to use" + type: string + required: false + default: "main" dbt_adapters_branch: description: "The branch of dbt-adapters to use" type: string required: false default: "main" - core_branch: + dbt_core_branch: description: "The branch of dbt-core to use" type: string required: false default: "main" + dbt_common_branch: + description: "The branch of dbt-common to use" + type: string + required: false + default: "main" workflow_call: inputs: + name: + description: "name to associate with run" + required: false + type: string + default: "Adapter Integration Tests" + adapter_branch: + description: "The branch of this adapter repository to use" + type: string + required: false + default: "main" dbt_adapters_branch: description: "The branch of dbt-adapters to use" type: string required: false default: "main" - core_branch: + dbt_core_branch: description: "The branch of dbt-core to use" type: string required: false default: "main" + dbt_common_branch: + description: "The branch of dbt-common to use" + type: string + required: false + default: "main" permissions: read-all @@ -67,14 +99,23 @@ jobs: steps: - name: Check out repository + if: ${{ github.event_name == 'pull_request'|| github.event_name == 'push' }} uses: actions/checkout@v4 + - name: Check out the repository (workflow_dispatch) + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' }} + uses: actions/checkout@v4 + with: + ref: ${{ inputs.adapter_branch }} + - name: Update Adapters and Core branches if: ${{ github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch'}} run: | - ./.github/scripts/update_dev_packages.sh \ + ./.github/scripts/update_dev_dependency_branches.sh \ ${{ inputs.dbt_adapters_branch }} \ - ${{ inputs.core_branch }} + ${{ inputs.dbt_core_branch }} \ + ${{ inputs.dbt_common_branch }} + cat pyproject.toml - name: Setup postgres run: psql -f ./scripts/setup_test_database.sql