diff --git a/.github/workflows/_unit-tests.yml b/.github/workflows/_unit-tests.yml index be2cac09..8e113b88 100644 --- a/.github/workflows/_unit-tests.yml +++ b/.github/workflows/_unit-tests.yml @@ -63,4 +63,3 @@ jobs: - uses: pypa/hatch@install - run: hatch run unit-tests shell: bash - working-directory: ./${{ inputs.package }} diff --git a/.github/workflows/_verify-build.yml b/.github/workflows/_verify-build.yml new file mode 100644 index 00000000..241b28c0 --- /dev/null +++ b/.github/workflows/_verify-build.yml @@ -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 }} diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 2322ff91..770deef3 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -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