Skip to content

Commit

Permalink
update pull-request-checks to work with dbt-adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Nov 22, 2024
1 parent ff8fa55 commit 607074e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/_unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ jobs:
- uses: pypa/hatch@install
- run: hatch run unit-tests
shell: bash
working-directory: ./${{ inputs.package }}
73 changes: 73 additions & 0 deletions .github/workflows/_verify-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "Verify build"

on:
workflow_call:
inputs:
package:
description: "Choose the package to build"
type: string
default: "dbt-adapters"
branch:
description: "Choose the branch to build"
type: string
default: "main"
repository:
description: "Choose the repository to build, (used primarily when testing a fork)"
type: string
default: "dbt-labs/dbt-adapters"
os:
description: "Choose the OS to test against"
type: string
default: ${{ vars.DEFAULT_RUNNER }}
python-version:
description: "Choose the Python version to test against"
type: string
default: ${{ vars.DEFAULT_PYTHON_VERSION }}
workflow_dispatch:
inputs:
package:
description: "Choose the package to build"
type: choice
options: ["dbt-adapters", "dbt-tests-adapter"]
branch:
description: "Choose the branch to build"
type: string
default: "main"
repository:
description: "Choose the repository to build, (used primarily when testing a fork)"
type: string
default: "dbt-labs/dbt-adapters"
os:
description: "Choose the OS to test against"
type: string
default: ${{ vars.DEFAULT_RUNNER }}
python-version:
description: "Choose the Python version to test against"
type: choice
options: ["3.9", "3.10", "3.11", "3.12"]

permissions: read-all

defaults:
run:
shell: bash

jobs:
package:
uses: ./.github/workflows/_package-directory.yml
with:
package: ${{ inputs.package }}

build:
needs: package
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- uses: pypa/hatch@install
- run: hatch build && hatch run build:check-all
working-directory: ./${{ needs.package.outputs.directory }}
20 changes: 16 additions & 4 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,33 @@ jobs:
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

unit-tests:
uses: ./.github/workflows/_unit-tests.yml
verify-builds:
uses: ./.github/workflows/_verify-build.yml
strategy:
matrix:
package: ["dbt-adapters", "dbt-tests-adapter"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
python-version: ${{ matrix.python-version }}

unit-tests:
uses: ./.github/workflows/_unit-tests.yml
strategy:
matrix:
package: ["dbt-adapters"]
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

# This job does nothing and is only used for branch protection
results:
name: "Pull request checks"
name: "Pull request checks" # keep this name, branch protection references it
if: always()
needs: [code-quality, unit-tests]
needs: [code-quality, verify-builds, unit-tests]
runs-on: ${{ vars.DEFAULT_RUNNER }}
steps:
- uses: re-actors/alls-green@release/v1
Expand Down

0 comments on commit 607074e

Please sign in to comment.